Use a lightweight process manager (tini) to run processes
What does this MR do?
This will avoid zombie processes since PID 1 is expected to reap processes, but most of the GitLab processes don't do this. If USE_TINI=1
is set, then tini willl launch with these processes.
Related issues
Relates to:
Testing
- First, verify that Cloud Native GitLab works without
tini
enabled. - Reinstall with
USE_TINI=1
inextraEnv
. - Check that all processes are running with
tini
at PID 1. - Verify that sending
SIGTERM
to PID 1 shuts down the container and the process under supervision. - Go to
-/user_settings/gpg_keys
and add/remove GPG keys. - Check that the
webservice
andsidekiq
pods don't have defunct processes.
Current exceptions, for future iteration:
- gitlab-kas
- prometheus
gitlab-shell
bash-4.4$ ps -ef
UID PID PPID C STIME TTY TIME CMD
git 1 0 0 19:50 ? 00:00:00 /usr/bin/tini -- /scripts/process-wrapper
git 16 1 0 19:50 ? 00:00:01 /srv/gitlab-shell/bin/gitlab-sshd -config-dir /srv/gitlab-shell
git 28 0 0 21:39 pts/0 00:00:00 bash
git 35 28 0 21:39 pts/0 00:00:00 ps -ef
gitlab-sidekiq
git@gitlab-sidekiq-all-in-1-v2-855b4d56c9-wzfjc:/$ ps -ef
UID PID PPID C STIME TTY TIME CMD
git 1 0 0 21:41 ? 00:00:00 /usr/bin/tini -- /scripts/exec-env /scripts/process-wrapper
git 19 1 3 21:41 ? 00:00:02 ruby /srv/gitlab/bin/sidekiq-cluster -r /srv/gitlab -e production -c 20 -t 25 *
git 20 19 0 21:41 ? 00:00:00 /usr/local/bin/gitlab-logger /var/log/gitlab
git 25 19 56 21:41 ? 00:00:33 sidekiq 7.1.6 queues:default,mailers [0 of 20 busy]
git 27 19 0 21:41 ? 00:00:00 sidekiq_exporter
git 80 0 0 21:42 pts/0 00:00:00 bash
git 87 80 0 21:42 pts/0 00:00:00 ps -ef
gitlab-webservice
webservice
git@gitlab-webservice-default-76c9b9c94c-6rxtj:/$ ps -ef
UID PID PPID C STIME TTY TIME CMD
git 1 0 0 21:36 ? 00:00:00 /usr/bin/tini -- /scripts/exec-env /scripts/process-wrapper
git 19 1 17 21:36 ? 00:00:40 puma 6.4.0 (tcp://0.0.0.0:8080) [gitlab-puma-worker]
git 22 19 0 21:36 ? 00:00:00 /usr/local/bin/gitlab-logger /var/log/gitlab
git 42 19 1 21:37 ? 00:00:02 ruby /srv/gitlab/bin/metrics-server
git 45 19 0 21:37 ? 00:00:01 puma: cluster worker 0: 19 [gitlab-puma-worker]
git 47 19 0 21:37 ? 00:00:01 puma: cluster worker 1: 19 [gitlab-puma-worker]
git 100 0 0 21:40 pts/0 00:00:00 bash
git 107 100 0 21:40 pts/0 00:00:00 ps -ef
gitlab-workhorse
git@gitlab-webservice-default-76c9b9c94c-6rxtj:/$ ps -ef
UID PID PPID C STIME TTY TIME CMD
git 1 0 0 21:36 ? 00:00:00 /usr/bin/tini -- /scripts/exec-env /scripts/start-workhorse
git 22 1 0 21:36 ? 00:00:00 gitlab-workhorse -logFile stdout -logFormat json -authBackend http://localhost:8080 -listenNetwork unix -listen
git 208 0 0 21:40 pts/0 00:00:00 bash
git 215 208 0 21:40 pts/0 00:00:00 ps -ef
gitlab-mailroom
git@gitlab-mailroom-86c8f7b55b-p58rv:/$ ps -ef
UID PID PPID C STIME TTY TIME CMD
git 1 0 0 21:36 ? 00:00:00 /usr/bin/tini -- /scripts/exec-env /usr/bin/mail_room -c /var/opt/gitlab/mail_room.yml --log-exit-as json
git 9 1 0 21:36 ? 00:00:00 /usr/bin/ruby /usr/bin/mail_room -c /var/opt/gitlab/mail_room.yml --log-exit-as json
git 357 0 0 21:43 pts/0 00:00:00 bash
git 365 357 0 21:43 pts/0 00:00:00 ps -ef
Checklist
See Definition of done.
For anything in this list which will not be completed, please provide a reason in the MR discussion
Required
-
Merge Request Title, and Description are up to date, accurate, and descriptive -
MR targeting the appropriate branch -
MR has a green pipeline on GitLab.com -
When ready for review, MR is labeled "~workflow::ready for review" per the Distribution MR workflow
Expected (please provide an explanation if not completing)
-
Test plan indicating conditions for success has been posted and passes -
Documentation created/updated -
Integration tests added to GitLab QA -
The impact any change in container size has should be evaluated -
New dependencies are managed with dependencies.io
Edited by Jason Plum