mirror of
https://github.com/gitlabhq/gitlab-recipes.git
synced 2026-01-09 14:37:57 -05:00
Updated systemd service files
- Do not use a target to specify dependencies. - Added postgresql and mysqld as optional dependencies. The service files work if the user has installed mysql or postgres either. - Removed ExecStop in gitlab-unicorn.service. It is entirely wrong to do it in such a way, see [1] - Added daemonize flags as it fixes systemd errors and warnings. Without this flags I was not able to start/stop a service properly because systemd has caught the wrong MainPIDs. Furthermore I had problems with service timouts as systemd caught the wrong return codes and considered the services as failed. - Updated README.md. [1]: http://lists.freedesktop.org/archives/systemd-devel/2014-January/016417.html
This commit is contained in:
@@ -13,31 +13,26 @@ GitLab requires a couple of services:
|
||||
Copy files to `/etc/systemd/system/`:
|
||||
|
||||
```
|
||||
su -
|
||||
sudo su
|
||||
cd /etc/systemd/system/
|
||||
wget -O gitlab-sidekiq.service https://gitlab.com/gitlab-org/gitlab-recipes/raw/master/init/systemd/gitlab-sidekiq.service
|
||||
wget -O gitlab-unicorn.service https://gitlab.com/gitlab-org/gitlab-recipes/raw/master/init/systemd/gitlab-unicorn.service
|
||||
wget -O gitlab.target https://gitlab.com/gitlab-org/gitlab-recipes/raw/master/init/systemd/gitlab.target
|
||||
```
|
||||
|
||||
Reload systemd:
|
||||
|
||||
sudo systemctl --system daemon-reload
|
||||
sudo systemctl daemon-reload
|
||||
|
||||
Start the services:
|
||||
|
||||
sudo systemctl start gitlab-sidekiq gitlab-unicorn
|
||||
sudo systemctl start gitlab-sidekiq.service gitlab-unicorn.service
|
||||
|
||||
Enable them to start at boot:
|
||||
|
||||
sudo systemctl enable gitlab.target gitlab-sidekiq gitlab-unicorn
|
||||
sudo systemctl enable gitlab-sidekiq.service gitlab-unicorn.service
|
||||
|
||||
## Notes
|
||||
|
||||
* If you installed GitLab in other path than `/home/git/gitlab` change the service files accordingly.
|
||||
|
||||
* `/etc/systemd/system/` have a higher precedence over `/lib/systemd/system`.
|
||||
|
||||
* For older systemd versions you need to append `service` after the service name. For example:
|
||||
|
||||
sudo systemctl start gitlab-sidekiq.service
|
||||
* `/etc/systemd/system/` have a higher precedence over `/usr/lib/systemd/system`.
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
#####################################################
|
||||
#
|
||||
# GitLab version : 5.x - 6.x
|
||||
# Contributors : davispuh, mtorromeo, axilleas, boeserwolf91
|
||||
# GitLab version : 5.x - 7.x
|
||||
# Contributors : davispuh, mtorromeo, axilleas, boeserwolf91, Stefan Tatschner (rumpelsepp)
|
||||
# Downloaded from : https://gitlab.com/gitlab-org/gitlab-recipes/tree/master/init/systemd
|
||||
#
|
||||
####################################################
|
||||
|
||||
[Unit]
|
||||
Description=GitLab Sidekiq Worker
|
||||
Requires=redis.service
|
||||
Wants=mysqld.service postgresql.service
|
||||
After=redis.service mysqld.service postgresql.service
|
||||
|
||||
[Service]
|
||||
Type=forking
|
||||
@@ -17,8 +20,8 @@ Environment=RAILS_ENV=production
|
||||
SyslogIdentifier=gitlab-sidekiq
|
||||
PIDFile=/home/git/gitlab/tmp/pids/sidekiq.pid
|
||||
|
||||
ExecStart=/usr/bin/bundle exec "sidekiq -q post_receive,mailer,system_hook,project_web_hook,gitlab_shell,common,default -e production -P tmp/pids/sidekiq.pid -d -L log/sidekiq.log >> log/sidekiq.log 2>&1"
|
||||
ExecStart=/usr/bin/bundle exec "sidekiq -d -q post_receive,mailer,system_hook,project_web_hook,gitlab_shell,common,default -e production -P tmp/pids/sidekiq.pid -d -L log/sidekiq.log >> log/sidekiq.log 2>&1"
|
||||
ExecStop=/usr/bin/bundle exec "sidekiqctl stop /home/git/gitlab/tmp/pids/sidekiq.pid >> /home/git/gitlab/log/sidekiq.log 2>&1"
|
||||
|
||||
[Install]
|
||||
WantedBy=gitlab.target
|
||||
WantedBy=multi-user.target
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
#####################################################
|
||||
#
|
||||
# GitLab version : 5.x - 6.x
|
||||
# Contributors : davispuh, mtorromeo, axilleas, boeserwolf91
|
||||
# GitLab version : 5.x - 7.x
|
||||
# Contributors : davispuh, mtorromeo, axilleas, boeserwolf91, Stefan Tatschner (rumpelsepp)
|
||||
# Downloaded from : https://gitlab.com/gitlab-org/gitlab-recipes/tree/master/init/systemd
|
||||
#
|
||||
####################################################
|
||||
|
||||
[Unit]
|
||||
Description=GitLab Unicorn Server
|
||||
Requires=redis.service
|
||||
Wants=mysqld.service postgresql.service
|
||||
After=redis.service mysqld.service postgresql.service
|
||||
|
||||
[Service]
|
||||
User=git
|
||||
@@ -16,9 +19,7 @@ Environment=RAILS_ENV=production
|
||||
SyslogIdentifier=gitlab-unicorn
|
||||
PIDFile=/home/git/gitlab/tmp/pids/unicorn.pid
|
||||
|
||||
ExecStart=/usr/bin/bundle exec "unicorn_rails -c /home/git/gitlab/config/unicorn.rb -E production"
|
||||
ExecStop=/usr/bin/kill -QUIT $MAINPID
|
||||
ExecReload=/usr/bin/kill -USR2 $MAINPID
|
||||
ExecStart=/usr/bin/bundle exec "unicorn_rails -D -c /home/git/gitlab/config/unicorn.rb -E production"
|
||||
|
||||
[Install]
|
||||
WantedBy=gitlab.target
|
||||
WantedBy=multi-user.target
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
###########################################################################################
|
||||
#
|
||||
# GitLab version : 5.x - 6.x
|
||||
# Contributors : davispuh, mtorromeo, axilleas, boeserwolf91
|
||||
# Downloaded from : https://gitlab.com/gitlab-org/gitlab-recipes/tree/master/init/systemd
|
||||
#
|
||||
###########################################################################################
|
||||
|
||||
[Unit]
|
||||
Description=GitLab - Self Hosted Git Management
|
||||
Requires=redis.service mysqld.service
|
||||
After=redis.service mysqld.service syslog.target network.target
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
Reference in New Issue
Block a user