Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve gracefull shutdown of artifacts #113

Merged
merged 1 commit into from
Feb 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ RUN make install
# Install start scripts
COPY full_listing_cache_update.sh /full_listing_cache_update.sh
COPY github_auth_cache_cleaner.sh /github_auth_cache_cleaner.sh
COPY start.sh /start.sh
COPY start.sh stop.sh /

# Install HTML browse includes
COPY include/browse_header.html /etc/nginx/browse_header.html
Expand Down
2 changes: 1 addition & 1 deletion charts/artifacts/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ spec:
lifecycle:
preStop:
exec:
command: ["/bin/sh","-c","nginx -s quit; while killall -0 nginx; do sleep 1; done"]
command: ["/stop.sh"]
volumes:
- name: cache
emptyDir: {}
Expand Down
14 changes: 14 additions & 0 deletions stop.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/sh

export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH

echo "Stopping nginx..."
# Wait a bit before signaling the process to stop
sleep 5
PID=$(cat /run/nginx.pid)
nginx -s quit

echo "Waiting for nginx PID: ${PID} to stop..."
while [ -d /proc/$PID ]; do
sleep 0.1
done
Loading