File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -10,6 +10,11 @@ puts-error() {
1010 echo " !!! $@ "
1111}
1212
13+ kill-containers () {
14+ puts-step " destroying containers"
15+ docker rm -f " $MINIO_JOB " " $PG_JOB "
16+ }
17+
1318# make sure we are in this dir
1419CURRENT_DIR=$( cd $( dirname $0 ) ; pwd)
1520
@@ -49,6 +54,9 @@ MINIO_JOB=$(docker run -dv $CURRENT_DIR/tmp/aws-admin:/var/run/secrets/deis/mini
4954# boot postgres, linking the minio container and setting DEIS_MINIO_SERVICE_HOST and DEIS_MINIO_SERVICE_PORT
5055PG_JOB=$( docker run -d --link $MINIO_JOB :minio -e BACKUP_FREQUENCY=1s -e DEIS_MINIO_SERVICE_HOST=minio -e DEIS_MINIO_SERVICE_PORT=9000 -v $CURRENT_DIR /tmp/creds:/var/run/secrets/deis/database/creds -v $CURRENT_DIR /tmp/aws-user:/etc/wal-e.d/env $1 )
5156
57+ # kill containers when this script exits or errors out
58+ trap kill-containers INT TERM
59+
5260# wait for postgres to boot
5361puts-step " sleeping for 90s while postgres is booting..."
5462sleep 90s
@@ -70,8 +78,3 @@ if [[ ! "$NUM_BACKUPS" -eq "5" ]]; then
7078 puts-error " did not find 5 base backups, which is the default (found $NUM_BACKUPS )"
7179 exit 1
7280fi
73-
74- # success, kill off jobs
75- puts-step " destroying containers"
76- docker rm -f $MINIO_JOB
77- docker rm -f $PG_JOB
You can’t perform that action at this time.
0 commit comments