FP: Option to skip / pause reconfigure in Docker entrypoint
Summary
In customer ticket 545132, the database migrations failed after upgrading to a known issue (Problem with upgrading to 17.1 due to epics.iss... (gitlab#468875 - closed)).
This lead to a situation where the Docker container was restarted in an endless loop.
To remediate this, it was necessary to run a gitlab-rake
task inside the container, which proved difficult as the Container was restarting 🫠 We managed to find an execution window to run the Rake task, but this involved timing and some luck. I want to eliminate these factors.
I'm speculating the loop formed like this:
- The Docker container starts, docker/assets/wrapper is executed as the entry point
-
runsvdir-start
is run in the background gitlab-ctl reconfigure
is run- Cinc is running into troubles, halting and sending a non-zero exit code to the parent process
-
gitlab-ctl reconfigure
is exiting non-zero with the followingSTDERR
message:
Mixlib::ShellOut::ShellCommandFailed: rails_migration[gitlab-rails] (gitlab::database_migrations line 51) had an error:
[...]
STDERR:
---- End output of "bash" ----
Ran "bash" returned 1
- As
set -e
is present in the entrypoint script, the script terminates non-zero - This terminates the container
- The container is then restarted by Docker, due to restart policy being set to
always
Proposal
Introduce a flag (ENV variable?) to temporarily stop gitlab-ctl reconfigure
from being run, allowing administrators to perform maintenance, and restart GitLab without the flag present.
The implementation could be as simple as wrapping this line in an if
statement.