Skip to content

Commit 9671a73

Browse files
authored
Improve gracefull shutdown of artifacts (#113)
1 parent 6527ea3 commit 9671a73

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ RUN make install
8484
# Install start scripts
8585
COPY full_listing_cache_update.sh /full_listing_cache_update.sh
8686
COPY github_auth_cache_cleaner.sh /github_auth_cache_cleaner.sh
87-
COPY start.sh /start.sh
87+
COPY start.sh stop.sh /
8888

8989
# Install HTML browse includes
9090
COPY include/browse_header.html /etc/nginx/browse_header.html

charts/artifacts/templates/deployment.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ spec:
6060
lifecycle:
6161
preStop:
6262
exec:
63-
command: ["/bin/sh","-c","nginx -s quit; while killall -0 nginx; do sleep 1; done"]
63+
command: ["/stop.sh"]
6464
volumes:
6565
- name: cache
6666
emptyDir: {}

stop.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/sh
2+
3+
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
4+
5+
echo "Stopping nginx..."
6+
# Wait a bit before signaling the process to stop
7+
sleep 5
8+
PID=$(cat /run/nginx.pid)
9+
nginx -s quit
10+
11+
echo "Waiting for nginx PID: ${PID} to stop..."
12+
while [ -d /proc/$PID ]; do
13+
sleep 0.1
14+
done

0 commit comments

Comments
 (0)