Skip to content

Add support for starting GitLab using Systemd services

What does this MR do?

  • Adds sample Systemd unit / target definitions for starting / stopping gitlab services (#299753 (moved))
  • Adds sample Rsyslog sample configuration that will route syslog events generated via systemd logs into log files

Screenshots (strongly suggested)

# systemctl status gitlab.target
● gitlab.target - GitLab
   Loaded: loaded (/etc/systemd/system/gitlab.target; enabled; vendor preset: disabled)
   Active: active since Sun 2021-01-24 05:26:52 UTC; 5h 12min ago

Jan 24 05:26:52 fe1 systemd[1]: Reached target GitLab.
# systemctl status gitlab-gitaly.service
● gitlab-gitaly.service - GitLab Gitaly
   Loaded: loaded (/etc/systemd/system/gitlab-gitaly.service; enabled; vendor preset: disabled)
   Active: active (running) since Sun 2021-01-24 05:26:52 UTC; 5h 13min ago
 Main PID: 1757 (gitaly)
   CGroup: /system.slice/gitlab-gitaly.service
           ├─1757 /home/git/gitaly/gitaly /home/git/gitaly/config.toml
           ├─1771 ruby /home/git/gitaly/ruby/bin/gitaly-ruby 1757 /tmp/gitaly-internal835233833/ruby.0
           └─1775 ruby /home/git/gitaly/ruby/bin/gitaly-ruby 1757 /tmp/gitaly-internal835233833/ruby.1

Jan 24 10:36:01 fe1 gitlab-gitaly[1757]: time="2021-01-24T10:36:01Z" level=info msg="finished unary call with code OK" correlation_id=01EWSZDY17ZR9SS72VNST34JKG grpc.code=OK grpc.meta.auth_ver...="2021-01-24T1
Jan 24 10:36:01 fe1 gitlab-gitaly[1757]: time="2021-01-24T10:36:01Z" level=info msg="finished unary call with code OK" correlation_id=01EWSZDY17ZR9SS72VNST34JKG grpc.code=OK grpc.meta.auth_ver...1-01-24T10:36:
Jan 24 10:36:01 fe1 gitlab-gitaly[1757]: time="2021-01-24T10:36:01Z" level=info msg="finished unary call with code OK" correlation_id=01EWSZDY17ZR9SS72VNST34JKG grpc.code=OK grpc.meta.auth_ver...="2021-01-24T1
Jan 24 10:36:01 fe1 gitlab-gitaly[1757]: time="2021-01-24T10:36:01Z" level=info msg="finished unary call with code OK" correlation_id=01EWSZDY17ZR9SS72VNST34JKG grpc.code=OK grpc.meta.auth_ver...1-01-24T10:36:
Jan 24 10:36:01 fe1 gitlab-gitaly[1757]: time="2021-01-24T10:36:01Z" level=info msg="finished unary call with code OK" correlation_id=01EWSZDY17ZR9SS72VNST34JKG grpc.code=OK grpc.meta.auth_ver...="2021-01-24T1
Jan 24 10:36:01 fe1 gitlab-gitaly[1757]: time="2021-01-24T10:36:01Z" level=info msg="finished unary call with code OK" correlation_id=01EWSZDY17ZR9SS72VNST34JKG grpc.code=OK grpc.meta.auth_ver...1-01-24T10:36:
Jan 24 10:36:02 fe1 gitlab-gitaly[1757]: time="2021-01-24T10:36:02Z" level=info msg="finished unary call with code OK" correlation_id=01EWSZE0JXWHGABH1JWT90FDW4 grpc.code=OK grpc.meta.auth_ver...="2021-01-24T1
Jan 24 10:36:02 fe1 gitlab-gitaly[1757]: time="2021-01-24T10:36:02Z" level=info msg="finished unary call with code OK" correlation_id=01EWSZE0JXWHGABH1JWT90FDW4 grpc.code=OK grpc.meta.auth_ver...1-01-24T10:36:
Jan 24 10:36:02 fe1 gitlab-gitaly[1757]: time="2021-01-24T10:36:02Z" level=info msg="finished unary call with code OK" correlation_id=01EWSZE0JXWHGABH1JWT90FDW4 grpc.code=OK grpc.meta.auth_ver...="2021-01-24T1
Jan 24 10:36:02 fe1 gitlab-gitaly[1757]: time="2021-01-24T10:36:02Z" level=info msg="finished unary call with code OK" correlation_id=01EWSZE0JXWHGABH1JWT90FDW4 grpc.code=OK grpc.meta.auth_ver...1-01-24T10:36:
# systemctl status gitlab-puma.service
● gitlab-puma.service - GitLab
   Loaded: loaded (/etc/systemd/system/gitlab-puma.service; enabled; vendor preset: disabled)
   Active: active (running) since Sun 2021-01-24 05:49:38 UTC; 4h 50min ago
 Main PID: 6930 (bundle)
   CGroup: /system.slice/gitlab-puma.service
           ├─ 6930 puma 5.1.1 (unix:///home/git/gitlab/tmp/sockets/gitlab.socket) [gitlab-puma-worker]
           ├─26840 puma: cluster worker 2: 6930 [gitlab-puma-worker]
           ├─27124 puma: cluster worker 1: 6930 [gitlab-puma-worker]
           └─27151 puma: cluster worker 0: 6930 [gitlab-puma-worker]

Jan 24 05:49:39 fe1 gitlab-puma[6930]: {"timestamp":"2021-01-24T05:49:39.556Z","pid":6930,"message":"*  Environment: production"}
Jan 24 05:49:39 fe1 gitlab-puma[6930]: {"timestamp":"2021-01-24T05:49:39.556Z","pid":6930,"message":"*   Master PID: 6930"}
Jan 24 05:49:39 fe1 gitlab-puma[6930]: {"timestamp":"2021-01-24T05:49:39.556Z","pid":6930,"message":"*      Workers: 3"}
Jan 24 05:49:39 fe1 gitlab-puma[6930]: {"timestamp":"2021-01-24T05:49:39.556Z","pid":6930,"message":"*     Restarts: (✔) hot (✖) phased"}
Jan 24 05:49:39 fe1 gitlab-puma[6930]: {"timestamp":"2021-01-24T05:49:39.556Z","pid":6930,"message":"* Preloading application"}
Jan 24 05:50:33 fe1 gitlab-puma[6930]: {"timestamp":"2021-01-24T05:50:33.442Z","pid":6930,"message":"* Listening on unix:///home/git/gitlab/tmp/sockets/gitlab.socket"}
Jan 24 05:50:33 fe1 gitlab-puma[6930]: {"timestamp":"2021-01-24T05:50:33.442Z","pid":6930,"message":"! WARNING: Detected 2 Thread(s) started in app boot:"}
Jan 24 05:50:33 fe1 gitlab-puma[6930]: {"timestamp":"2021-01-24T05:50:33.442Z","pid":6930,"message":"! #\u003cThread:0x000055639cb51af8 /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.3.4/li...
Jan 24 05:50:33 fe1 gitlab-puma[6930]: {"timestamp":"2021-01-24T05:50:33.442Z","pid":6930,"message":"! #\u003cThread:0x00005563c5d0c838 /home/git/gitlab/vendor/bundle/ruby/2.7.0/gems/rack-timeout-0.5.2/lib/...
Jan 24 05:50:33 fe1 gitlab-puma[6930]: {"timestamp":"2021-01-24T05:50:33.442Z","pid":6930,"message":"Use Ctrl-C to stop"}
# systemctl status gitlab-sidekiq.service
● gitlab-sidekiq.service - GitLab Sidekiq
   Loaded: loaded (/etc/systemd/system/gitlab-sidekiq.service; enabled; vendor preset: disabled)
   Active: active (running) since Sun 2021-01-24 05:26:52 UTC; 5h 13min ago
 Main PID: 1754 (bundle)
   CGroup: /system.slice/gitlab-sidekiq.service
           └─1754 sidekiq 5.2.9 gitlab [0 of 10 busy]

Jan 24 10:33:01 fe1 gitlab-sidekiq[1754]: {"severity":"INFO","time":"2021-01-24T10:33:01.826Z","queue":"cronjob:update_all_mirrors","args":[],"class":"UpdateAllMirrorsWorker","retry":0,"versio...ob","correlati
Jan 24 10:33:01 fe1 gitlab-sidekiq[1754]: {"severity":"INFO","time":"2021-01-24T10:33:01.892Z","queue":"cronjob:update_all_mirrors","args":[],"class":"UpdateAllMirrorsWorker","retry":0,"versio...ob","correlati
Jan 24 10:35:05 fe1 gitlab-sidekiq[1754]: {"severity":"INFO","time":"2021-01-24T10:35:05.894Z","queue":"cronjob:update_all_mirrors","args":[],"class":"UpdateAllMirrorsWorker","retry":0,"versio...ob","correlati
Jan 24 10:35:05 fe1 gitlab-sidekiq[1754]: {"severity":"INFO","time":"2021-01-24T10:35:05.933Z","queue":"cronjob:update_all_mirrors","args":[],"class":"UpdateAllMirrorsWorker","retry":0,"versio...ob","correlati
Jan 24 10:36:04 fe1 gitlab-sidekiq[1754]: {"severity":"INFO","time":"2021-01-24T10:36:04.357Z","queue":"cronjob:update_all_mirrors","args":[],"class":"UpdateAllMirrorsWorker","retry":0,"versio...ob","correlati
Jan 24 10:36:04 fe1 gitlab-sidekiq[1754]: {"severity":"INFO","time":"2021-01-24T10:36:04.375Z","queue":"cronjob:update_all_mirrors","args":[],"class":"UpdateAllMirrorsWorker","retry":0,"versio...ob","correlati
Jan 24 10:38:13 fe1 gitlab-sidekiq[1754]: {"severity":"INFO","time":"2021-01-24T10:38:13.095Z","queue":"cronjob:schedule_merge_request_cleanup_refs","args":[],"class":"ScheduleMergeRequestClea...13.092Z","meta
Jan 24 10:38:13 fe1 gitlab-sidekiq[1754]: {"severity":"INFO","time":"2021-01-24T10:38:13.108Z","queue":"cronjob:schedule_merge_request_cleanup_refs","args":[],"class":"ScheduleMergeRequestClea...13.092Z","meta
Jan 24 10:40:02 fe1 gitlab-sidekiq[1754]: {"severity":"INFO","time":"2021-01-24T10:40:02.533Z","queue":"cronjob:geo_verification_cron","args":[],"class":"Geo::VerificationCronWorker","retry":0...":"Cronjob","c
Jan 24 10:40:02 fe1 gitlab-sidekiq[1754]: {"severity":"INFO","time":"2021-01-24T10:40:02.809Z","queue":"cronjob:geo_verification_cron","args":[],"class":"Geo::VerificationCronWorker","retry":0...":"Cronjob","c
# systemctl status gitlab-workhorse.service
● gitlab-workhorse.service - GitLab Workhorse
   Loaded: loaded (/etc/systemd/system/gitlab-workhorse.service; enabled; vendor preset: disabled)
   Active: active (running) since Sun 2021-01-24 05:26:52 UTC; 5h 13min ago
 Main PID: 1756 (gitlab-workhors)
   CGroup: /system.slice/gitlab-workhorse.service
           └─1756 /home/git/gitlab-workhorse/gitlab-workhorse -listenUmask 0 -listenNetwork unix -listenAddr /home/git/gitlab/tmp/sockets/gitlab-workhorse.socket -authBackend http://127.0.0.1:8080 -authSock...

Jan 24 10:40:12 fe1 gitlab-workhorse[1756]: git.example.com 1.2.3.4 - - [2021/01/24:10:40:12 +0000] "POST /api/v4/jobs/request HTTP/1.1" 204 0 "" "gitlab-runner 13.7.0 (13-7-stable; go1...nux/amd64)" 23
Jan 24 10:40:12 fe1 gitlab-workhorse[1756]: git.example.com 1.2.3.4 - - [2021/01/24:10:40:12 +0000] "GET /users/sign_in HTTP/1.1" 200 54881 "" "GoogleStackdriverMonitoring-UptimeChecks(...onitoring)" 43
Jan 24 10:40:13 fe1 gitlab-workhorse[1756]: git.example.com 1.2.3.4 - - [2021/01/24:10:40:13 +0000] "POST /api/v4/jobs/request HTTP/1.1" 204 0 "" "gitlab-runner 13.7.0 (13-7-stable; go1...nux/amd64)" 17

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Edited by Matthew Muscat

Merge request reports