From 1e6b6b9f64591252c7e57401402c485c898b46fe Mon Sep 17 00:00:00 2001 From: itsdalmo Date: Wed, 3 Oct 2018 09:45:39 +0200 Subject: [PATCH 1/3] Fix log level for workers --- modules/worker/cloud-config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/worker/cloud-config.yml b/modules/worker/cloud-config.yml index 8303d6f..5bad0aa 100644 --- a/modules/worker/cloud-config.yml +++ b/modules/worker/cloud-config.yml @@ -52,6 +52,7 @@ write_files: Environment="CONCOURSE_TEAM=${worker_team}" Environment="CONCOURSE_BIND_IP=0.0.0.0" + Environment="CONCOURSE_LOG_LEVEL=${log_level}" Environment="CONCOURSE_WORK_DIR=/concourse" Environment="CONCOURSE_TSA_HOST=${tsa_host}:${tsa_port}" Environment="CONCOURSE_BAGGAGECLAIM_BIND_IP=0.0.0.0" From cb92539b0d26d7bfe3cfedb9714d6d4eb7713039 Mon Sep 17 00:00:00 2001 From: itsdalmo Date: Wed, 3 Oct 2018 10:53:51 +0200 Subject: [PATCH 2/3] Use pgrep to wait for a graceful shutdown --- modules/worker/cloud-config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/worker/cloud-config.yml b/modules/worker/cloud-config.yml index 5bad0aa..45217f9 100644 --- a/modules/worker/cloud-config.yml +++ b/modules/worker/cloud-config.yml @@ -65,8 +65,8 @@ write_files: ExecStart=/usr/local/bin/concourse worker ExecStop=/usr/local/bin/concourse retire-worker - ExecStop=/bin/bash -c "while ! /usr/local/bin/concourse retire-worker | grep worker-not-found > /dev/null; do sleep 5; done" - ExecStop=/bin/kill -s TERM $MAINPID + ExecStop=/bin/bash -c "while pgrep concourse; do sleep 5; done" + ExecStop=/bin/kill -s TERM -- $MAINPID [Install] WantedBy=multi-user.target From fddbe3fd7ee17115ad37fc98652be880f31050c9 Mon Sep 17 00:00:00 2001 From: itsdalmo Date: Wed, 3 Oct 2018 14:17:13 +0200 Subject: [PATCH 3/3] Change KillMode and remove ExecStop as MAINPID fails to interpolate. --- modules/worker/cloud-config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/worker/cloud-config.yml b/modules/worker/cloud-config.yml index 45217f9..6eb928a 100644 --- a/modules/worker/cloud-config.yml +++ b/modules/worker/cloud-config.yml @@ -49,6 +49,7 @@ write_files: RestartSec=30s TimeoutStartSec=5m TimeoutStopSec=1h + KillMode=process Environment="CONCOURSE_TEAM=${worker_team}" Environment="CONCOURSE_BIND_IP=0.0.0.0" @@ -65,8 +66,7 @@ write_files: ExecStart=/usr/local/bin/concourse worker ExecStop=/usr/local/bin/concourse retire-worker - ExecStop=/bin/bash -c "while pgrep concourse; do sleep 5; done" - ExecStop=/bin/kill -s TERM -- $MAINPID + ExecStop=/bin/bash -c "while pgrep concourse >> /dev/null; do echo draining worker... && sleep 5; done; echo done draining!" [Install] WantedBy=multi-user.target