mirror of
https://github.com/gitlabhq/gitlab-recipes.git
synced 2026-01-10 06:58:06 -05:00
43
init/systemd/README.md
Normal file
43
init/systemd/README.md
Normal 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
|
||||
19
init/systemd/gitlab-sidekiq.service
Normal file
19
init/systemd/gitlab-sidekiq.service
Normal 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
|
||||
16
init/systemd/gitlab-unicorn.service
Normal file
16
init/systemd/gitlab-unicorn.service
Normal 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
|
||||
5
init/systemd/gitlab.target
Normal file
5
init/systemd/gitlab.target
Normal file
@@ -0,0 +1,5 @@
|
||||
[Unit]
|
||||
Description=GitLab - Self Hosted Git Management
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
Reference in New Issue
Block a user