Skip to content

Commit 545bdb7

Browse files
committed
fix(services): prevent units from stopping as "failed/failed"
Deis' systemd units always return "failed/failed" after being stopped by fleetctl. Somehow our ExecStop command to remove the service container conflicts with our ExecStart command and causes it to return an error code. This is fixed by removing the ExecStop commands and adding a `--rm` flag to the docker command in ExecStart. Additionally, our on_exit() handler in each /app/bin/boot script was not returning 0. TESTING: Run `make run`, then `make stop` on a Deis cluster. You should see all units stop and return to "inactive/dead" status, whereas before they would show "failed/failed."
1 parent 170c6e3 commit 545bdb7

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

bin/boot

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ GUNICORN_PID=$!
6666
function on_exit() {
6767
kill -TERM $CELERY_PID $GUNICORN_PID
6868
wait $CELERY_PID $GUNICORN_PID 2>/dev/null
69+
exit 0
6970
}
7071
trap on_exit INT TERM
7172

systemd/deis-controller.service

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ EnvironmentFile=/etc/environment
88
TimeoutStartSec=20m
99
ExecStartPre=/bin/sh -c "docker history deis/controller >/dev/null || docker pull deis/controller:latest"
1010
ExecStartPre=/bin/sh -c "docker inspect deis-controller >/dev/null && docker rm -f deis-controller || true"
11-
ExecStart=/usr/bin/docker run --name deis-controller -p 8000:8000 -e PUBLISH=8000 -e HOST=${COREOS_PRIVATE_IPV4} --volumes-from=deis-logger deis/controller
12-
ExecStop=/usr/bin/docker rm -f deis-controller
11+
ExecStart=/usr/bin/docker run --name deis-controller --rm -p 8000:8000 -e PUBLISH=8000 -e HOST=${COREOS_PRIVATE_IPV4} --volumes-from=deis-logger deis/controller
1312

1413
[Install]
1514
WantedBy=multi-user.target

0 commit comments

Comments
 (0)