Rewrite terrible upstream .service files:
* added meta "gitlab.service" that work alike corresponding init.d script * new .service files with support for "reload" and propagation of "reload" from "gitlab.service" * non-forking PIDFILE-less implementation This commit fixes services' start-up and postinst error on first install.
This commit is contained in:
parent
2568098b28
commit
2e41d2b0a3
8 changed files with 129 additions and 8 deletions
20
debian/gitlab.gitlab-mailroom.service
vendored
Normal file
20
debian/gitlab.gitlab-mailroom.service
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
[Unit]
|
||||
Description=Gitlab mailroom Worker
|
||||
PartOf=gitlab.target
|
||||
Requires=gitlab-unicorn.service
|
||||
Wants=gitlab-unicorn.service
|
||||
After=gitlab-unicorn.service
|
||||
PartOf=gitlab.service
|
||||
ReloadPropagatedFrom=gitlab-unicorn.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=gitlab
|
||||
WorkingDirectory=/usr/share/gitlab
|
||||
EnvironmentFile=/etc/gitlab/gitlab-debian.conf
|
||||
SyslogIdentifier=gitlab-mailroom
|
||||
ExecStart=/usr/bin/bundle exec mail_room -q -c /etc/gitlab/mail_room.yml
|
||||
Restart=on-abnormal
|
||||
|
||||
[Install]
|
||||
WantedBy=gitlab.target
|
34
debian/gitlab.gitlab-sidekiq.service
vendored
Normal file
34
debian/gitlab.gitlab-sidekiq.service
vendored
Normal file
|
@ -0,0 +1,34 @@
|
|||
[Unit]
|
||||
Description=GitLab Sidekiq Worker
|
||||
PartOf=gitlab.target
|
||||
Requires=redis-server.service
|
||||
Wants=postgresql.service
|
||||
After=redis-server.service postgresql.service
|
||||
PartOf=gitlab.service
|
||||
ReloadPropagatedFrom=gitlab.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=gitlab
|
||||
WorkingDirectory=/usr/share/gitlab
|
||||
EnvironmentFile=/etc/gitlab/gitlab-debian.conf
|
||||
SyslogIdentifier=gitlab-sidekiq
|
||||
ExecStart=/usr/bin/bundle exec sidekiq \
|
||||
-q post_receive \
|
||||
-q mailers \
|
||||
-q archive_repo \
|
||||
-q system_hook \
|
||||
-q project_web_hook \
|
||||
-q gitlab_shell \
|
||||
-q incoming_email \
|
||||
-q runner \
|
||||
-q common \
|
||||
-q default \
|
||||
-e $RAILS_ENV
|
||||
Restart=on-abnormal
|
||||
|
||||
## No "Type=notify" support; wait for service to initialise:
|
||||
ExecStartPost=-/bin/sh -c "for i in 4 4 4 4 4 4 4 4; do sleep $i; (ps -h -o command -p $MAINPID | grep -q -P \"sidekiq\s\d\.\d\.\d\") && exit 0; done"
|
||||
|
||||
[Install]
|
||||
WantedBy=gitlab.target
|
22
debian/gitlab.gitlab-unicorn.service
vendored
Normal file
22
debian/gitlab.gitlab-unicorn.service
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
[Unit]
|
||||
Description=GitLab Unicorn Server
|
||||
PartOf=gitlab.target
|
||||
Requires=redis-server.service
|
||||
Wants=postgresql.service
|
||||
After=redis-server.service postgresql.service
|
||||
PartOf=gitlab.service
|
||||
ReloadPropagatedFrom=gitlab.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=gitlab
|
||||
WorkingDirectory=/usr/share/gitlab
|
||||
EnvironmentFile=/etc/gitlab/gitlab-debian.conf
|
||||
EnvironmentFile=-/etc/default/gitlab
|
||||
SyslogIdentifier=gitlab-unicorn
|
||||
ExecStart=/usr/bin/bundle exec unicorn_rails -c config/unicorn.rb -E $RAILS_ENV
|
||||
ExecReload=/bin/kill -USR2 $MAINPID
|
||||
Restart=on-abnormal
|
||||
|
||||
[Install]
|
||||
WantedBy=gitlab.target
|
26
debian/gitlab.gitlab-workhorse.service
vendored
Normal file
26
debian/gitlab.gitlab-workhorse.service
vendored
Normal file
|
@ -0,0 +1,26 @@
|
|||
[Unit]
|
||||
Description=Gitlab Workhorse handles slow HTTP requests for Gitlab.
|
||||
PartOf=gitlab.target
|
||||
Requires=gitlab-unicorn.service
|
||||
Wants=gitlab-unicorn.service
|
||||
After=gitlab-unicorn.service
|
||||
PartOf=gitlab.service
|
||||
ReloadPropagatedFrom=gitlab-unicorn.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=gitlab
|
||||
WorkingDirectory=/usr/share/gitlab
|
||||
EnvironmentFile=/etc/gitlab/gitlab-debian.conf
|
||||
SyslogIdentifier=gitlab-workhorse
|
||||
ExecStart=/usr/bin/gitlab-workhorse \
|
||||
-listenUmask 0 \
|
||||
-listenNetwork unix \
|
||||
-listenAddr ${gitlab_pid_path}/gitlab-workhorse.socket \
|
||||
-authBackend http://127.0.0.1:8080 \
|
||||
-authSocket ${gitlab_pid_path}/gitlab.socket \
|
||||
-documentRoot ${gitlab_app_root}/public
|
||||
Restart=on-abnormal
|
||||
|
||||
[Install]
|
||||
WantedBy=gitlab.target
|
13
debian/gitlab.lintian-overrides
vendored
13
debian/gitlab.lintian-overrides
vendored
|
@ -14,5 +14,14 @@ gitlab: package-contains-timestamped-gzip usr/share/gitlab/spec/fixtures/ci_buil
|
|||
gitlab: executable-not-elf-or-script usr/share/gitlab/bin/upgrade.rb
|
||||
gitlab: executable-not-elf-or-script usr/share/gitlab/bin/ci/upgrade.rb
|
||||
|
||||
# gitlab.target is provided for systemd
|
||||
gitlab: systemd-no-service-for-init-script gitlab
|
||||
# False-positives: there are no init.d files for those services:
|
||||
init.d-script-not-marked-as-conffile etc/init.d/gitlab-sidekiq
|
||||
init.d-script-not-marked-as-conffile etc/init.d/gitlab-workhorse
|
||||
init.d-script-not-marked-as-conffile etc/init.d/gitlab-unicorn
|
||||
init.d-script-not-marked-as-conffile etc/init.d/gitlab-mailroom
|
||||
|
||||
# Not needed; SysV uses one 'gitlab' init script.
|
||||
init.d-script-not-included-in-package etc/init.d/gitlab-workhorse
|
||||
init.d-script-not-included-in-package etc/init.d/gitlab-sidekiq
|
||||
init.d-script-not-included-in-package etc/init.d/gitlab-mailroom
|
||||
init.d-script-not-included-in-package etc/init.d/gitlab-unicorn
|
||||
|
|
13
debian/gitlab.service
vendored
Normal file
13
debian/gitlab.service
vendored
Normal file
|
@ -0,0 +1,13 @@
|
|||
[Unit]
|
||||
Description=GitLab Services
|
||||
BindsTo=gitlab-unicorn.service gitlab-sidekiq.service gitlab-mailroom.service gitlab-workhorse.service
|
||||
After=gitlab-unicorn.service gitlab-sidekiq.service gitlab-mailroom.service gitlab-workhorse.service
|
||||
|
||||
[Service]
|
||||
Type=idle
|
||||
RemainAfterExit=yes
|
||||
ExecStart=-/bin/true
|
||||
ExecReload=-/bin/true
|
||||
|
||||
[Install]
|
||||
WantedBy=gitlab.target
|
1
debian/install
vendored
1
debian/install
vendored
|
@ -5,7 +5,6 @@ debian/conf/gitlab.yml.example usr/share/doc/gitlab
|
|||
debian/conf/resque.yml etc/gitlab
|
||||
debian/conf/gitlab-debian.conf.example usr/share/doc/gitlab
|
||||
debian/conf/*.target lib/systemd/system
|
||||
debian/conf/*.service lib/systemd/system
|
||||
debian/conf/smtp_settings.rb etc/gitlab/initializers
|
||||
debian/conf/tmpfiles.d/gitlab.conf usr/lib/tmpfiles.d
|
||||
debian/adduser.sh usr/lib/gitlab/scripts
|
||||
|
|
8
debian/rake-tasks.sh
vendored
8
debian/rake-tasks.sh
vendored
|
@ -45,12 +45,10 @@ echo "Precompiling assets..."
|
|||
su ${gitlab_user} -s /bin/sh -c 'bundle exec rake assets:precompile RAILS_ENV=production'
|
||||
|
||||
# Start gitlab
|
||||
if [ -d "/run/systemd/system" ]; then
|
||||
systemctl start gitlab.target
|
||||
else
|
||||
invoke-rc.d gitlab start
|
||||
fi
|
||||
printf "Starting GitLab...\n"
|
||||
service gitlab start
|
||||
|
||||
# Check gitlab is configured correctly
|
||||
printf "Check if Gitlab is configured correctly...\n"
|
||||
su ${gitlab_user} -s /bin/sh -c 'bundle exec rake gitlab:check RAILS_ENV=production'
|
||||
|
||||
|
|
Loading…
Reference in a new issue