Commit 857efa0d authored by Joerg Behrmann's avatar Joerg Behrmann

Add native systemd units

This commit adds native systemd units for the source installation as an
alternative to the current init script.

The units are:
- Service files can be used to seperately start and stop the individual
  GitLab daemons and the target.
- A target unit to logically group the individual services and to start
  and stop GitLab as a whole.
- A slice unit for resource monitoring.

Changelog: added
parent 60884298
[Unit]
Description=GitLab Gitaly
ReloadPropagatedFrom=gitlab.target
PartOf=gitlab.target
After=network.target gitlab-puma.service
[Service]
Type=simple
User=git
WorkingDirectory=/home/git/gitlab
ExecStart=/home/git/gitaly/_build/bin/gitaly /home/git/gitaly/config.toml
Restart=on-failure
SyslogIdentifier=gitlab-gitaly
Slice=gitlab.slice
[Install]
WantedBy=gitlab.target
[Unit]
Description=GitLab Mailroom
PartOf=gitlab.target
After=network.target
StartLimitIntervalSec=100s
[Service]
Type=simple
User=git
WorkingDirectory=/home/git/gitlab
Environment=RAILS_ENV=production
ExecStart=/usr/local/bin/bundle exec mail_room --log-exit-as json --quiet --config /home/git/gitlab/config/mail_room.yml
Restart=on-failure
RestartSec=1
SyslogIdentifier=gitlab-mailroom
Slice=gitlab.slice
[Install]
WantedBy=gitlab.target
[Unit]
Description=GitLab Pages
ReloadPropagatedFrom=gitlab.target
PartOf=gitlab.target
After=network.target gitlab-puma.service
Wants=gitlab-puma.service
[Service]
Type=simple
User=git
WorkingDirectory=/home/git/gitlab
ExecStart=/home/git/gitlab-pages/gitlab-pages -config /home/git/gitlab-pages/gitlab-pages.conf
Restart=on-failure
RestartSec=1
SyslogIdentifier=gitlab-pages
Slice=gitlab.slice
[Install]
WantedBy=gitlab.target
[Unit]
Description=GitLab
Conflicts=gitlab.service
ReloadPropagatedFrom=gitlab.target
PartOf=gitlab.target
# # You might want to add these if you run redis and postgres on the same
# # machine as gitlab. Do this by either uncommenting the following `Requires=`
# # and `After=` or, preferedly, running `systemctl edit gitlab-puma.service`
# # and adding a `[Unit]` section and the respective keys below it.
# Requires=redis-server.service postgresql.service
# After=redis-server.service postgresql.service
After=network.target
StartLimitIntervalSec=100s
[Service]
Type=notify
User=git
WorkingDirectory=/home/git/gitlab
Environment=RAILS_ENV=production
ExecStart=/usr/local/bin/bundle exec puma --config /home/git/gitlab/config/puma.rb --environment production --pidfile /home/git/gitlab/tmp/pids/puma.pid
ExecReload=/usr/bin/kill -USR2 $MAINPID
PIDFile=/home/git/gitlab/tmp/pids/puma.pid
# puma can be slow to start
TimeoutStartSec=120
WatchdogSec=10
Restart=on-failure
RestartSec=1
SyslogIdentifier=gitlab-puma
Slice=gitlab.slice
[Install]
WantedBy=gitlab.target
[Unit]
Description=GitLab Sidekiq
ReloadPropagatedFrom=gitlab.target
PartOf=gitlab.target
After=network.target
# # You might want to add these if you run redis and postgres on the same
# # machine as gitlab. Do this by either uncommenting the following `Requires=`
# # and `After=` or, preferedly, running `systemctl edit gitlab-puma.service`
# # and adding a `[Unit]` section and the respective keys below it.
# Wants=redis-server.service postgresql.service
# After=redis-server.service postgresql.service
JoinsNamespaceOf=gitlab-puma.service
[Service]
Type=simple
User=git
WorkingDirectory=/home/git/gitlab
Environment=RAILS_ENV=production
ExecStart=/usr/local/bin/bundle exec sidekiq --config /home/git/gitlab/config/sidekiq_queues.yml --environment production
ExecStop=/usr/local/bin/bundle exec sidekiqctl stop /run/gitlab/sidekiq.pid
PIDFile=/home/git/gitlab/tmp/pids/sidekiq.pid
Restart=on-failure
RestartSec=1
SyslogIdentifier=gitlab-sidekiq
Slice=gitlab.slice
[Install]
WantedBy=gitlab.target
[Unit]
Description=GitLab Workhorse
ReloadPropagatedFrom=gitlab.target
PartOf=gitlab.target
After=network.target gitlab-puma.service
Wants=gitlab-puma.service
[Service]
Type=simple
User=git
WorkingDirectory=/home/git/gitlab
Environment=PATH=/home/git/gitlab-workhorse:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
ExecStart=/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 -authSocket /home/git/gitlab/tmp/sockets/gitlab.socket -documentRoot /home/git/gitlab/public -secretPath /home/git/gitlab/.gitlab_workhorse_secret
ExecReload=/usr/bin/kill -USR2 $MAINPID
Restart=on-failure
RestartSec=1
SyslogIdentifier=gitlab-workhorse
Slice=gitlab.slice
[Install]
WantedBy=gitlab.target
[Unit]
Description=Slice to bundle all GitLab services
Before=slices.target
[Slice]
MemoryAccounting=true
IOAccounting=true
CPUAccounting=true
[Unit]
Description=GitLab
Wants=gitlab-gitaly.service gitlab-puma.service gitlab-sidekiq.service gitlab-workhorse.service
[Install]
WantedBy=multi-user.target
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment