Add first draft of systemd services. Fix #14 Implement #43

This commit is contained in:
Axilleas Pipinellis
2013-08-18 23:48:23 +03:00
parent 2f555a5ed4
commit 471ee5660e
4 changed files with 83 additions and 0 deletions

43
init/systemd/README.md Normal file
View File

@@ -0,0 +1,43 @@
## GitLab startup services for systemd (Archlinux, Fedora, etc)
GitLab requires a couple of services:
* Web server (apache, nginx, etc.)
* Redis server
* Mail server (postfix or other)
* GitLab Sidekiq service (`gitlab-sidekiq.service`)
* Unicorn (`gitlab-unicorn.service`)
## Setup GitLab Sidekiq service
Copy files to `/etc/systemd/system/`:
```
su -
cd /etc/systemd/system/
wget -O gitlab-sidekiq.service https://raw.github.com/gitlabhq/gitlab-recipes/master/init/systemd/gitlab-sidekiq.service
wget -O gitlab-unicorn.service https://raw.github.com/gitlabhq/gitlab-recipes/master/init/systemd/gitlab-unicorn.service
wget -O gitlab.target https://raw.github.com/gitlabhq/gitlab-recipes/master/init/systemd/gitlab.target
```
Reload systemd:
sudo systemctl --system daemon-reload
Start the services:
sudo systemctl start gitlab-sidekiq gitlab-unicorn
Enable them to start at boot:
sudo systemctl enable gitlab-sidekiq gitlab-unicorn
## 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

View File

@@ -0,0 +1,19 @@
[Unit]
Description=GitLab Sidekiq Worker
Requires=redis.service
After=syslog.target network.target redis.service
Wants=mysqld.service
[Service]
Type=forking
User=git
WorkingDirectory=/home/git/gitlab
Environment=RAILS_ENV=production
SyslogIdentifier=gitlab-sidekiq
PidFile=/home/git/gitlab/tmp/pids/sidekiq.pid
ExecStart=/usr/bin/bundle exec rake sidekiq:start
ExecStop=/usr/bin/bundle exec rake sidekiq:stop
[Install]
WantedBy=gitlab.target

View File

@@ -0,0 +1,16 @@
[Unit]
Description=GitLab Unicorn Server
Requires=redis.service
After=network.target mysqld.service redis.service
[Service]
User=git
WorkingDirectory=/home/git/gitlab
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"
[Install]
WantedBy=gitlab.target

View File

@@ -0,0 +1,5 @@
[Unit]
Description=GitLab - Self Hosted Git Management
[Install]
WantedBy=multi-user.target