mirror of
https://github.com/sameersbn/docker-gitlab.git
synced 2026-01-18 13:58:25 +00:00
`wait` will throw an error if a process it waits for is terminated by an external signal. Together with `set -e` this will stop the whole entrypoint script. I guess this issues only crops up very rarely, as the `kill` command already waits for the supervisor process to shut down, and the test using `ps h -p $SUPERVISOR_PID` returns false and thus `wait` is never called. You can check the behavior using following simple script: ```bash #!/bin/bash #set -e echo "Testing wait command" sleep 20 & pid=$! kill $pid wait $pid echo $pid was terminated. ``` as long as `set -e` is commented out, `$pid was terminated` will print. If you enable `set -e`, the last line will not be printed, as the script fails in the `wait` command.
51 lines
1.3 KiB
Bash
Executable File
51 lines
1.3 KiB
Bash
Executable File
#!/bin/bash
|
|
set -e
|
|
source ${GITLAB_RUNTIME_DIR}/functions
|
|
|
|
[[ $DEBUG == true ]] && set -x
|
|
|
|
case ${1} in
|
|
app:init|app:start|app:sanitize|app:rake)
|
|
|
|
initialize_system
|
|
configure_gitlab
|
|
configure_gitlab_shell
|
|
configure_gitlab_pages
|
|
configure_nginx
|
|
|
|
case ${1} in
|
|
app:start)
|
|
/usr/bin/supervisord -nc /etc/supervisor/supervisord.conf &
|
|
SUPERVISOR_PID=$!
|
|
migrate_database
|
|
kill -15 $SUPERVISOR_PID
|
|
ps h -p $SUPERVISOR_PID > /dev/null && wait $SUPERVISOR_PID || true
|
|
rm -rf /var/run/supervisor.sock
|
|
exec /usr/bin/supervisord -nc /etc/supervisor/supervisord.conf
|
|
;;
|
|
app:init)
|
|
migrate_database
|
|
;;
|
|
app:sanitize)
|
|
sanitize_datadir
|
|
;;
|
|
app:rake)
|
|
shift 1
|
|
execute_raketask $@
|
|
;;
|
|
esac
|
|
;;
|
|
app:help)
|
|
echo "Available options:"
|
|
echo " app:start - Starts the gitlab server (default)"
|
|
echo " app:init - Initialize the gitlab server (e.g. create databases, compile assets), but don't start it."
|
|
echo " app:sanitize - Fix repository/builds directory permissions."
|
|
echo " app:rake <task> - Execute a rake task."
|
|
echo " app:help - Displays the help"
|
|
echo " [command] - Execute the specified command, eg. bash."
|
|
;;
|
|
*)
|
|
exec "$@"
|
|
;;
|
|
esac
|