diff --git a/deisctl/units/deis-builder.service b/deisctl/units/deis-builder.service index cb434b4e5d..99b442ad8c 100644 --- a/deisctl/units/deis-builder.service +++ b/deisctl/units/deis-builder.service @@ -4,8 +4,9 @@ Description=deis-builder [Service] EnvironmentFile=/etc/environment TimeoutStartSec=30m -ExecStartPre=/bin/sh -c "docker inspect deis-builder-data >/dev/null 2>&1 || docker run --name deis-builder-data -v /var/lib/docker alpine:3.2 /bin/true" -ExecStartPre=/bin/sh -c "IMAGE=`/run/deis/bin/get_image /deis/builder` && docker history $IMAGE >/dev/null 2>&1 || docker pull $IMAGE" +ExecStartPre=/bin/sh -c "IMAGE=alpine:3.2 && docker history $IMAGE >/dev/null 2>&1 || flock -w 1200 /var/run/lock/alpine-pull docker pull $IMAGE" +ExecStartPre=/bin/sh -c "IMAGE=alpine:3.2 && docker inspect deis-builder-data >/dev/null 2>&1 || docker run --name deis-builder-data -v /var/lib/docker $IMAGE /bin/true" +ExecStartPre=/bin/sh -c "IMAGE=`/run/deis/bin/get_image /deis/builder` && docker history $IMAGE >/dev/null 2>&1 || flock -w 1200 /var/run/lock/alpine-pull docker pull $IMAGE" ExecStartPre=/bin/sh -c "docker inspect deis-builder >/dev/null 2>&1 && docker rm -f deis-builder || true" ExecStartPre=-/bin/sh -c "/sbin/losetup -f" ExecStart=/bin/sh -c "IMAGE=`/run/deis/bin/get_image /deis/builder` && docker run --name deis-builder --rm -p 2223:2223 --volumes-from=deis-builder-data -c 800 -e EXTERNAL_PORT=2223 -e HOST=$COREOS_PRIVATE_IPV4 --privileged -v /etc/environment_proxy:/etc/environment_proxy $IMAGE" diff --git a/deisctl/units/deis-controller.service b/deisctl/units/deis-controller.service index aaac24197b..c32f5b9059 100644 --- a/deisctl/units/deis-controller.service +++ b/deisctl/units/deis-controller.service @@ -6,7 +6,7 @@ After=fleet.socket [Service] EnvironmentFile=/etc/environment TimeoutStartSec=20m -ExecStartPre=/bin/sh -c "IMAGE=`/run/deis/bin/get_image /deis/controller` && docker history $IMAGE >/dev/null 2>&1 || docker pull $IMAGE" +ExecStartPre=/bin/sh -c "IMAGE=`/run/deis/bin/get_image /deis/controller` && docker history $IMAGE >/dev/null 2>&1 || flock -w 1200 /var/run/lock/alpine-pull docker pull $IMAGE" ExecStartPre=/bin/sh -c "docker inspect deis-controller >/dev/null 2>&1 && docker rm -f deis-controller || true" ExecStart=/bin/sh -c "IMAGE=`/run/deis/bin/get_image /deis/controller` && docker run --name deis-controller --rm -p 8000:8000 -e EXTERNAL_PORT=8000 -e HOST=$COREOS_PRIVATE_IPV4 -v /var/run/fleet.sock:/var/run/fleet.sock $IMAGE" ExecStop=-/usr/bin/docker stop deis-controller diff --git a/deisctl/units/deis-database.service b/deisctl/units/deis-database.service index 5e18c66639..e01999ae66 100644 --- a/deisctl/units/deis-database.service +++ b/deisctl/units/deis-database.service @@ -4,8 +4,9 @@ Description=deis-database [Service] EnvironmentFile=/etc/environment TimeoutStartSec=20m -ExecStartPre=/bin/sh -c "docker inspect deis-database-data >/dev/null 2>&1 || docker run --name deis-database-data -v /var/lib/postgresql alpine:3.2 /bin/true" -ExecStartPre=/bin/sh -c "IMAGE=`/run/deis/bin/get_image /deis/database` && docker history $IMAGE >/dev/null 2>&1 || docker pull $IMAGE" +ExecStartPre=/bin/sh -c "IMAGE=alpine:3.2 && docker history $IMAGE >/dev/null 2>&1 || flock -w 1200 /var/run/lock/alpine-pull docker pull $IMAGE" +ExecStartPre=/bin/sh -c "IMAGE=alpine:3.2 && docker inspect deis-database-data >/dev/null 2>&1 || docker run --name deis-database-data -v /var/lib/postgresql $IMAGE /bin/true" +ExecStartPre=/bin/sh -c "IMAGE=`/run/deis/bin/get_image /deis/database` && docker history $IMAGE >/dev/null 2>&1 || flock -w 1200 /var/run/lock/alpine-pull docker pull $IMAGE" ExecStartPre=/bin/sh -c "docker inspect deis-database >/dev/null 2>&1 && docker rm -f deis-database >/dev/null 2>&1 || true" ExecStart=/bin/sh -c "IMAGE=`/run/deis/bin/get_image /deis/database` && docker run --name deis-database --rm --volumes-from=deis-database-data -p 5432:5432 -e EXTERNAL_PORT=5432 -e HOST=$COREOS_PRIVATE_IPV4 $IMAGE" ExecStop=-/usr/bin/docker exec deis-database sudo -u postgres envdir /etc/wal-e.d/env wal-e backup-push /var/lib/postgresql/9.3/main diff --git a/deisctl/units/deis-logger.service b/deisctl/units/deis-logger.service index 86dc7c61db..2320f20286 100644 --- a/deisctl/units/deis-logger.service +++ b/deisctl/units/deis-logger.service @@ -6,7 +6,7 @@ After=deis-store-volume.service [Service] EnvironmentFile=/etc/environment TimeoutStartSec=20m -ExecStartPre=/bin/sh -c "IMAGE=`/run/deis/bin/get_image /deis/logger` && docker history $IMAGE >/dev/null 2>&1 || docker pull $IMAGE" +ExecStartPre=/bin/sh -c "IMAGE=`/run/deis/bin/get_image /deis/logger` && docker history $IMAGE >/dev/null 2>&1 || flock -w 1200 /var/run/lock/alpine-pull docker pull $IMAGE" ExecStartPre=/bin/sh -c "docker inspect deis-logger >/dev/null 2>&1 && docker rm -f deis-logger || true" ExecStart=/bin/sh -c "IMAGE=`/run/deis/bin/get_image /deis/logger` && docker run --name deis-logger --rm -p 8088:8088/tcp -p 514:514/udp -e EXTERNAL_PORT=514 -e HOST=$COREOS_PRIVATE_IPV4 -v /var/lib/deis/store:/data $IMAGE" ExecStop=-/usr/bin/docker stop deis-logger diff --git a/deisctl/units/deis-registry.service b/deisctl/units/deis-registry.service index ca7df4a28e..cab4d8e686 100644 --- a/deisctl/units/deis-registry.service +++ b/deisctl/units/deis-registry.service @@ -5,7 +5,7 @@ Description=deis-registry EnvironmentFile=/etc/environment TimeoutStartSec=30m ExecStartPre=-/usr/bin/etcdctl mkdir /deis/cache >/dev/null 2>&1 -ExecStartPre=/bin/sh -c "IMAGE=`/run/deis/bin/get_image /deis/registry` && docker history $IMAGE >/dev/null 2>&1 || docker pull $IMAGE" +ExecStartPre=/bin/sh -c "IMAGE=`/run/deis/bin/get_image /deis/registry` && docker history $IMAGE >/dev/null 2>&1 || flock -w 1200 /var/run/lock/alpine-pull docker pull $IMAGE" ExecStartPre=/bin/sh -c "docker inspect deis-registry >/dev/null 2>&1 && docker rm -f deis-registry || true" ExecStart=/bin/sh -c "IMAGE=`/run/deis/bin/get_image /deis/registry` && docker run --name deis-registry --rm -p 5000:5000 -e EXTERNAL_PORT=5000 -e HOST=$COREOS_PRIVATE_IPV4 $IMAGE" ExecStop=-/usr/bin/docker stop deis-registry diff --git a/deisctl/units/deis-router.service b/deisctl/units/deis-router.service index 15791016d2..325188159c 100644 --- a/deisctl/units/deis-router.service +++ b/deisctl/units/deis-router.service @@ -5,7 +5,7 @@ Description=deis-router EnvironmentFile=/etc/environment TimeoutStartSec=20m ExecStartPre=-/usr/bin/etcdctl mkdir /registry/services/ >/dev/null 2>&1 -ExecStartPre=/bin/sh -c "IMAGE=`/run/deis/bin/get_image /deis/router` && docker history $IMAGE >/dev/null 2>&1 || docker pull $IMAGE" +ExecStartPre=/bin/sh -c "IMAGE=`/run/deis/bin/get_image /deis/router` && docker history $IMAGE >/dev/null 2>&1 || flock -w 1200 /var/run/lock/alpine-pull docker pull $IMAGE" ExecStartPre=/bin/sh -c "docker inspect deis-router >/dev/null 2>&1 && docker rm -f deis-router || true" ExecStart=/bin/sh -c "IMAGE=`/run/deis/bin/get_image /deis/router` && docker run --name deis-router --rm -p 80:80 -p 2222:2222 -p 443:443 -p 9090:9090 -e EXTERNAL_PORT=80 -e HOST=$COREOS_PRIVATE_IPV4 $IMAGE" ExecStop=-/usr/bin/docker stop deis-router