Skip to content

Commit

Permalink
fix: 🐛 Fix broken nginx handling for container restarts (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
max06 committed Jan 24, 2024
1 parent 15da831 commit d3b6d7b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
},
// Features to add to the dev container. More info: https://containers.dev/features.
"features": {
"ghcr.io/devcontainers/features/git:1": {}
"ghcr.io/devcontainers/features/git:1": {},
"ghcr.io/devcontainers/features/docker-in-docker:2": {}
},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [
Expand Down
13 changes: 11 additions & 2 deletions localfs/startup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,19 @@ if [ -d "/tmp/.X11-unix" ]; then
rm -rf /tmp/.X11-unix
fi

# check if nginx is already running
# Read pid from file and check if process is running
if [ -f /var/run/nginx.pid ]; then
nginx -s reload
pid=$(cat /var/run/nginx.pid)
if ! ps -p "${pid}" > /dev/null; then
echo "nginx is not running, starting it now"
rm /var/run/nginx.pid
nginx
else
echo "nginx is running, sending reload signal"
nginx -s reload
fi
else
echo "nginx is not running, starting it now"
nginx
fi

Expand Down

0 comments on commit d3b6d7b

Please sign in to comment.