Add document on restarting GitLab

[ci skip]
This commit is contained in:
Achilleas Pipinellis 2016-01-20 10:33:59 +01:00
parent a382ad99ef
commit 9d756f3d8b
3 changed files with 150 additions and 0 deletions

View file

@ -53,6 +53,7 @@
- [Custom git hooks](hooks/custom_hooks.md) Custom git hooks (on the filesystem) for when web hooks aren't enough.
- [Install](install/README.md) Requirements, directory structures and installation from source.
- [Restart GitLab](administration/restart_gitlab.md) Learn how to restart GitLab and its components
- [Integration](integration/README.md) How to integrate with systems such as JIRA, Redmine, LDAP and Twitter.
- [Issue closing](customization/issue_closing.md) Customize how to close an issue from commit messages.
- [Libravatar](customization/libravatar.md) Use Libravatar for user avatars.

View file

@ -0,0 +1,138 @@
# How to restart GitLab
Depending on how you installed GitLab, there are different methods to restart
its service(s).
If you want the TL;DR versions, jump to:
- [Omnibus GitLab restart](#omnibus-gitlab-restart)
- [Omnibus GitLab reconfigure](#omnibus-gitlab-reconfigure)
- [Source installation restart](#installations-from-source)
## Omnibus installations
If you have used the [Omnibus packages][omnibus-dl] to install GitLab, then
you should already have `gitlab-ctl` in your `PATH`. To find out, run:
```bash
which gitlab-ctl
```
The output should be: `/usr/bin/gitlab-ctl`.
`gitlab-ctl` interacts with the Omnibus packages and can be used to restart the
GitLab Rails application (Unicorn) as well as the other components, like:
- GitLab Workhorse
- Sidekiq
- PostgreSQL (if you are using the bundled one)
- NGINX (if you are using the bundled one)
- Redis (if you are using the bundled one)
- [Mailroom][]
- Logrotate.
### Omnibus GitLab restart
When you are asked to _restart GitLab_, you need to run the following command:
```bash
sudo gitlab-ctl restart
```
The output should be similar to this:
```
ok: run: gitlab-workhorse: (pid 11291) 1s
ok: run: logrotate: (pid 11299) 0s
ok: run: mailroom: (pid 11306) 0s
ok: run: nginx: (pid 11309) 0s
ok: run: postgresql: (pid 11316) 1s
ok: run: redis: (pid 11325) 0s
ok: run: sidekiq: (pid 11331) 1s
ok: run: unicorn: (pid 11338) 0s
```
To restart a component separately, you can append its service name to the
`restart` command. For example, to restart **only** NGINX you would run:
```bash
sudo gitlab-ctl restart nginx
```
To check the status of GitLab services, run:
```bash
sudo gitlab-ctl status
```
Notice that all services say `ok: run`. If you get any weird results, like the
unicorn service not starting, you may need to
[reconfigure GitLab](#omnibus-gitlab-reconfigure) instead.
### Omnibus GitLab reconfigure
There may be times where you will be asked to _reconfigure_ GitLab. Remember
that this method applies only for the Omnibus packages.
Reconfigure Omnibus GitLab with:
```bash
sudo gitlab-ctl reconfigure
```
Reconfiguring GitLab should occur in the event that something in its
configuration (`/etc/gitlab/gitlab.rb`) has changed.
When you run this command, [Chef], the underlying configuration management
application that powers Omnibus GitLab, will make sure that all directories,
permissions, services, etc., are in place and in the same shape that they were
initially shipped. This is where the _idempotency_ buzz-word you've been reading
here and there fits.
## Installations from source
If you have followed the official installation guide to [install GitLab from
source][install], run the following command to restart GitLab:
```
sudo service gitlab restart
```
The output should be similar to this:
```
Shutting down GitLab Unicorn
Shutting down GitLab Sidekiq
Shutting down GitLab Workhorse
Shutting down GitLab MailRoom
...
GitLab is not running.
Starting GitLab Unicorn
Starting GitLab Sidekiq
Starting GitLab Workhorse
Starting GitLab MailRoom
...
The GitLab Unicorn web server with pid 28059 is running.
The GitLab Sidekiq job dispatcher with pid 28176 is running.
The GitLab Workhorse with pid 28122 is running.
The GitLab MailRoom email processor with pid 28114 is running.
GitLab and all its components are up and running.
```
This should restart Unicorn, Sidekiq, GitLab Workhorse and [Mailroom][]
(if enabled). The init service file that does all the magic can be found in
[`lib/support/init.d/gitlab`][src-service].
---
If you are using other init systems, like systemd, you can check the
[GitLab Recipes][gl-recipes] repository for some unofficial services. These are
**not** officially supported so use at your own risk.
[omnibus-dl]: https://about.gitlab.com/downloads/ "Download the Omnibus packages"
[install]: ../install/installation.md "Documentation to install GitLab from source"
[mailroom]: ../incoming_email/README.md "Used for replying by email in GitLab issues and merge requests"
[chef]: https://www.chef.io/chef/ "Chef official website"
[src-service]: https://gitlab.com/gitlab-org/gitlab-ce/blob/master/lib/support/init.d/gitlab "GitLab init service file"
[gl-recipes]: https://gitlab.com/gitlab-org/gitlab-recipes/tree/master/init "GitLab Recipes repository"

View file

@ -103,6 +103,17 @@ Inside the document:
`_**Note:** This feature was introduced in GitLab EE 8.3_`. Otherwise, leave
this mention out
## References
- There are many cases that a restart/reconfigure of GitLab is required. To
avoid duplication, link to the special document that can be found in
`doc/administration/restart_gitlab.md`. Usually the text will read like:
```
Save the file and [reconfigure GitLab](../administration/restart_gitlab.md) for the changes to take effect.
```
Replace `reconfigure` with `restart` where appropriate.
## API
Here is a list of must-have items. Use them in the exact order that appears