.d/`.
+
+If you manually made changes to the unit files or added drop-in configuration files (without using `systemctl edit`), run the following command for them to take effect:
+
+```shell
+sudo systemctl daemon-reload
+```
+
+Make GitLab start on boot:
+
+```shell
+sudo systemctl enable gitlab.target
+```
+
+#### Install SysV init script
+
+Use these steps if you use the SysV init script. If you use systemd, follow the [systemd unit steps](#install-systemd-units).
+
+Download the init script (is `/etc/init.d/gitlab`):
+
+```shell
+cd /home/git/gitlab
+sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab
+```
+
+And if you are installing with a non-default folder or user, copy and edit the defaults file:
+
+```shell
+sudo cp lib/support/init.d/gitlab.default.example /etc/default/gitlab
+```
+
+If you installed GitLab in another directory or as a user other than the default, you should change these settings in `/etc/default/gitlab`. Do not edit `/etc/init.d/gitlab` as it is changed on upgrade.
+
+Make GitLab start on boot:
+
+```shell
+sudo update-rc.d gitlab defaults 21
+# or if running this on a machine running systemd
+sudo systemctl daemon-reload
+sudo systemctl enable gitlab.service
+```
+
+### Set up Logrotate
+
+```shell
+sudo cp lib/support/logrotate/gitlab /etc/logrotate.d/gitlab
+```
+
### Start Gitaly
Gitaly must be running for the next section.
-```shell
-gitlab_path=/home/git/gitlab
-gitaly_path=/home/git/gitaly
+- To start Gitaly using systemd:
-sudo -u git -H sh -c "$gitlab_path/bin/daemon_with_pidfile $gitlab_path/tmp/pids/gitaly.pid \
- $gitaly_path/_build/bin/gitaly $gitaly_path/config.toml >> $gitlab_path/log/gitaly.log 2>&1 &"
-```
+ ```shell
+ sudo systemctl start gitlab-gitaly.service
+ ```
+
+- To manually start Gitaly for SysV:
+
+ ```shell
+ gitlab_path=/home/git/gitlab
+ gitaly_path=/home/git/gitaly
+
+ sudo -u git -H sh -c "$gitlab_path/bin/daemon_with_pidfile $gitlab_path/tmp/pids/gitaly.pid \
+ $gitaly_path/_build/bin/gitaly $gitaly_path/config.toml >> $gitlab_path/log/gitaly.log 2>&1 &"
+ ```
### Initialize Database and Activate Advanced Features
@@ -724,34 +871,6 @@ The `secrets.yml` file stores encryption keys for sessions and secure variables.
Backup `secrets.yml` someplace safe, but don't store it in the same place as your database backups.
Otherwise, your secrets are exposed if one of your backups is compromised.
-### Install Init Script
-
-Download the init script (is `/etc/init.d/gitlab`):
-
-```shell
-sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab
-```
-
-And if you are installing with a non-default folder or user, copy and edit the defaults file:
-
-```shell
-sudo cp lib/support/init.d/gitlab.default.example /etc/default/gitlab
-```
-
-If you installed GitLab in another directory or as a user other than the default, you should change these settings in `/etc/default/gitlab`. Do not edit `/etc/init.d/gitlab` as it is changed on upgrade.
-
-Make GitLab start on boot:
-
-```shell
-sudo update-rc.d gitlab defaults 21
-```
-
-### Set up Logrotate
-
-```shell
-sudo cp lib/support/logrotate/gitlab /etc/logrotate.d/gitlab
-```
-
### Check Application Status
Check if GitLab and its environment are configured correctly:
@@ -782,9 +901,11 @@ sudo -u git -H bundle exec rake gitlab:assets:compile RAILS_ENV=production NODE_
### Start Your GitLab Instance
```shell
+# For systems running systemd
+sudo systemctl start gitlab.target
+
+# For systems running SysV init
sudo service gitlab start
-# or
-sudo /etc/init.d/gitlab restart
```
## 9. NGINX
@@ -857,6 +978,10 @@ nginx: configuration file /etc/nginx/nginx.conf test failed
### Restart
```shell
+# For systems running systemd
+sudo systemctl restart nginx.service
+
+# For systems running SysV init
sudo service nginx restart
```
@@ -889,7 +1014,10 @@ earlier and login. After login, you can change the username if you wish.
**Enjoy!**
-You can use `sudo service gitlab start` and `sudo service gitlab stop` to start and stop GitLab.
+To start and stop GitLab when using:
+
+- systemd units: use `sudo systemctl start gitlab.target` or `sudo systemctl stop gitlab.target`.
+- The SysV init script: use `sudo service gitlab start` or `sudo service gitlab stop`.
## Advanced Setup Tips
diff --git a/doc/install/relative_url.md b/doc/install/relative_url.md
index b992658400d..569f6e02ea4 100644
--- a/doc/install/relative_url.md
+++ b/doc/install/relative_url.md
@@ -101,8 +101,9 @@ Make sure to follow all steps below:
gitlab_url: http://127.0.0.1/gitlab
```
-1. Make sure you have copied the supplied init script and the defaults file
- as stated in the [installation guide](installation.md#install-init-script).
+1. Make sure you have copied either the supplied systemd services, or the init
+ script and the defaults file, as stated in the
+ [installation guide](installation.md#install-the-service).
Then, edit `/etc/default/gitlab` and set in `gitlab_workhorse_options` the
`-authBackend` setting to read like:
diff --git a/doc/update/index.md b/doc/update/index.md
index ca44c22a10e..748a3ed9fe8 100644
--- a/doc/update/index.md
+++ b/doc/update/index.md
@@ -306,8 +306,8 @@ and [Helm Chart deployments](https://docs.gitlab.com/charts/). They come with ap
### 14.5.0
When `make` is run, Gitaly builds are now created in `_build/bin` and no longer in the root directory of the source directory. If you
-are using a source install, update paths to these binaries in your init scripts by
-[following the documentation](upgrading_from_source.md#init-script).
+are using a source install, update paths to these binaries in your [systemd unit files](upgrading_from_source.md#configure-systemd-units)
+or [init scripts](upgrading_from_source.md#configure-sysv-init-script) by [following the documentation](upgrading_from_source.md).
### 14.4.0
diff --git a/doc/update/patch_versions.md b/doc/update/patch_versions.md
index d09f19d143b..a2d672e00ac 100644
--- a/doc/update/patch_versions.md
+++ b/doc/update/patch_versions.md
@@ -20,6 +20,10 @@ It's useful to make a backup just in case things go south. Depending on the inst
### 1. Stop server
```shell
+# For systems running systemd
+sudo systemctl stop gitlab.target
+
+# For systems running SysV init
sudo service gitlab stop
```
@@ -108,6 +112,11 @@ Please follow the [install instruction](../integration/elasticsearch.md#install-
### 9. Start application
```shell
+# For systems running systemd
+sudo systemctl start gitlab.target
+sudo systemctl restart nginx.service
+
+# For systems running SysV init
sudo service gitlab start
sudo service nginx restart
```
diff --git a/doc/update/upgrading_from_source.md b/doc/update/upgrading_from_source.md
index 67559db2cf0..e1e2acd211d 100644
--- a/doc/update/upgrading_from_source.md
+++ b/doc/update/upgrading_from_source.md
@@ -54,6 +54,10 @@ sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production
### 2. Stop server
```shell
+# For systems running systemd
+sudo systemctl stop gitlab.target
+
+# For systems running SysV init
sudo service gitlab stop
```
@@ -230,7 +234,29 @@ ActionMailer::Base.delivery_method = :smtp
See [`smtp_settings.rb.sample`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/initializers/smtp_settings.rb.sample#L13) as an example.
-#### Init script
+#### Configure systemd units
+
+If using the SysV init script, see [Configure SysV init script](#configure-sysv-init-script).
+
+Check if the systemd units have been updated:
+
+```shell
+cd /home/git/gitlab
+
+git diff origin/PREVIOUS_BRANCH:lib/support/systemd origin/BRANCH:lib/support/systemd
+```
+
+Copy them over:
+
+```shell
+sudo mkdir -p /usr/local/lib/systemd/system
+sudo cp lib/support/systemd/* /usr/local/lib/systemd/system/
+sudo systemctl daemon-reload
+```
+
+#### Configure SysV init script
+
+If using systemd units, see [Configure systemd units](#configure-systemd-units).
There might be new configuration options available for
[`gitlab.default.example`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/support/init.d/gitlab.default.example).
@@ -250,7 +276,7 @@ cd /home/git/gitlab
sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab
```
-For Ubuntu 16.04.1 LTS:
+If you are using the init script on a system running systemd as init, because you have not switched to native systemd units yet, run:
```shell
sudo systemctl daemon-reload
@@ -342,6 +368,11 @@ sudo -u git -H make
### 15. Start application
```shell
+# For systems running systemd
+sudo systemctl start gitlab.target
+sudo systemctl restart nginx.service
+
+# For systems running SysV init
sudo service gitlab start
sudo service nginx restart
```
diff --git a/doc/user/markdown.md b/doc/user/markdown.md
index 60ad0b9fcd2..d20e9c7a30e 100644
--- a/doc/user/markdown.md
+++ b/doc/user/markdown.md
@@ -125,8 +125,6 @@ You can also use [Kroki](https://kroki.io) to create a wide variety of diagrams.
#### Mermaid
-> [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/15107) in GitLab 10.3.
-
Visit the [official page](https://mermaidjs.github.io/) for more details. The
[Mermaid Live Editor](https://mermaid-js.github.io/mermaid-live-editor/) helps you
learn Mermaid and debug issues in your Mermaid code. Use it to identify and resolve
@@ -211,7 +209,7 @@ Sometimes you want to :monkey: around a bit and add some :star2: to your :speech
You can use it to point out a :bug: or warn about :speak_no_evil: patches. And if someone improves your really :snail: code, send them some :birthday:. People :heart: you for that.
-If you're new to this, don't be :fearful:. You can join the emoji :family:. All you need to do is to look up one of the supported codes.
+If you're new to this, don't be :fearful:. You can join the emoji :family:. Just look up one of the supported codes.
Consult the [Emoji Cheat Sheet](https://www.emojicopy.com) for a list of all supported emoji codes. :thumbsup:
```
@@ -222,7 +220,7 @@ Sometimes you want to or warn about patches. If someone improves your really code, send them some . People you for that.
-If you're new to this, don't be . You can join the emoji . All you need to do is to look up one of the supported codes.
+If you're new to this, don't be . You can join the emoji . Just look up one of the supported codes.
Consult the [Emoji Cheat Sheet](https://www.webfx.com/tools/emoji-cheat-sheet/) for a list of all supported emoji codes.
@@ -244,8 +242,6 @@ this font installed by default.
### Front matter
-> [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/23331) in GitLab 11.6.
-
Front matter is metadata included at the beginning of a Markdown document, preceding
the content. This data can be used by static site generators like [Jekyll](https://jekyllrb.com/docs/front-matter/),
[Hugo](https://gohugo.io/content-management/front-matter/), and many other applications.
@@ -356,18 +352,18 @@ in a [code block](#code-spans-and-blocks) with the language declared as `math` i
on a separate line:
````markdown
-This math is inline $`a^2+b^2=c^2`$.
+This math is inline: $`a^2+b^2=c^2`$.
-This is on a separate line:
+This math is on a separate line:
```math
a^2+b^2=c^2
```
````
-This math is inline $`a^2+b^2=c^2`$.
+This math is inline: $`a^2+b^2=c^2`$.
-This is on a separate line
+This math is on a separate line:
```math
a^2+b^2=c^2
@@ -408,16 +404,17 @@ To create a task list, follow the format of an ordered or unordered list:
### Table of contents
A table of contents is an unordered list that links to subheadings in the document.
-
-To add a table of contents to a Markdown file, wiki page, issue request, or merge request
-description, add either the `[[_TOC_]]` or `[TOC]` tag on its own line.
-
-NOTE:
You can add a table of contents to issues and merge requests, but you can't add one
-to notes or comments.
+to notes or comments. Add either the `[[_TOC_]]` or `[TOC]` tag on its own line
+to the **Description** field of any of the supported content types:
+
+- Markdown files.
+- Wiki pages.
+- Issues.
+- Merge requests.
```markdown
-This is an intro sentence to my Wiki page.
+This sentence introduces my wiki page.
[[_TOC_]]
@@ -579,7 +576,7 @@ by starting the lines of the blockquote with `>`:
Quote break.
-> This is a very long line that is still quoted properly when it wraps. Keep writing to make sure this line is long enough to actually wrap for everyone. You can also *add* **Markdown** into a blockquote.
+> This very long line is still quoted properly when it wraps. Keep writing to make sure this line is long enough to actually wrap for everyone. You can also *add* **Markdown** into a blockquote.
```
> Blockquotes help you emulate reply text.
@@ -587,7 +584,7 @@ Quote break.
Quote break.
-> This is a very long line that is still quoted properly when it wraps. Keep writing to make sure this line is long enough to actually wrap for everyone. You can also *add* **Markdown** into a blockquote.
+> This very long line is still quoted properly when it wraps. Keep writing to make sure this line is long enough to actually wrap for everyone. You can also *add* **Markdown** into a blockquote.
#### Multiline blockquote
@@ -706,7 +703,7 @@ puts markdown.to_html
```
No language indicated, so no syntax highlighting.
-s = "There is no highlighting for this."
+s = "No highlighting is shown for this line."
But let's throw in a tag.
```
````
@@ -733,13 +730,13 @@ puts markdown.to_html
```plaintext
No language indicated, so no syntax highlighting.
-s = "There is no highlighting for this."
+s = "No highlighting is shown for this line."
But let's throw in a tag.
```
### Emphasis
-There are multiple ways to emphasize text in Markdown. You can italicize, bold, strikethrough,
+In Markdown, you can emphasize text in multiple ways. You can italicize, bold, strikethrough,
and combine these emphasis styles together.
Strikethrough is not part of the core Markdown standard, but is part of GitLab Flavored Markdown.
@@ -819,9 +816,9 @@ Do not edit the following codeblock. It uses HTML to skip the Vale ReferenceLink
This reference tag is a mix of letters and numbers. [^footnote-42]
-[^1]: This is the text inside a footnote.
+[^1]: This text is inside a footnote.
-[^footnote-42]: This is another footnote.
+[^footnote-42]: This text is another footnote.
A footnote reference tag looks like this:[^1]
@@ -833,9 +830,9 @@ Do not delete the single space before the [^1] and [^footnotes] references below
These are used to force the Vale ReferenceLinks check to skip these examples.
-->
- [^1]: This is the text inside a footnote.
+ [^1]: This text is inside a footnote.
- [^footnote-42]: This is another footnote.
+ [^footnote-42]: This text is another footnote.
### Headers
@@ -893,8 +890,8 @@ Would generate the following link IDs:
1. `this-header-has-spaces-in-it-2`
1. `this-header-has-3-5-in-it-and-parentheses`
-Note that the emoji processing happens before the header IDs are generated, so the
-emoji is converted to an image which is then removed from the ID.
+Emoji processing happens before the header IDs are generated. The
+emoji is converted to an image, which is then removed from the ID.
### Horizontal Rule
@@ -934,7 +931,7 @@ Reference-style (hover to see title text):
@@ -951,7 +948,7 @@ Do not change to a reference style link.
![alt text](img/markdown_logo.png "Title Text")
-In the rare case where you need to set a specific height or width for an image,
+In the rare case where you must set a specific height or width for an image,
you can use the `img` HTML tag instead of Markdown and set its `height` and
`width` parameters.
@@ -1129,8 +1126,8 @@ These details remain hidden until expanded.
### Line breaks
A line break is inserted (a new paragraph starts) if the previous text is
-ended with two newlines, like when you hit Enter twice in a row. If you only
-use one newline (hit Enter once), the next sentence remains part of the
+ended with two newlines, like when you press Enter twice in a row. If you only
+use one newline (select Enter once), the next sentence remains part of the
same paragraph. Use this approach if you want to keep long lines from wrapping, and keep
them editable:
@@ -1156,7 +1153,8 @@ in the *same paragraph*.
#### Newlines
-GitLab Flavored Markdown adheres to the Markdown specification in how [paragraphs and line breaks are handled](https://spec.commonmark.org/current/).
+GitLab Flavored Markdown adheres to the Markdown specification for handling
+[paragraphs and line breaks](https://spec.commonmark.org/current/).
A paragraph is one or more consecutive lines of text, separated by one or
more blank lines (two newlines at the end of the first paragraph), as [explained above](#line-breaks).
@@ -1178,25 +1176,25 @@ A new line due to the previous backslash.
### Links
-There are two ways to create links, inline-style and reference-style:
+You can create links two ways: inline-style and reference-style. For example:
-- This is an [inline-style link](https://www.google.com)
-- This is a [link to a repository file in the same directory](index.md)
-- This is a [relative link to a readme one directory higher](../index.md)
-- This is a [link that also has title text](https://www.google.com "This link takes you to Google!")
+- This line shows an [inline-style link](https://www.google.com)
+- This line shows a [link to a repository file in the same directory](index.md)
+- This line shows a [relative link to a readme one directory higher](../index.md)
+- This line shows a [link that also has title text](https://www.google.com "This link takes you to Google!")
Using header ID anchors:
-- This links to [a section on a different Markdown page, using a "#" and the header ID](index.md#overview)
-- This links to [a different section on the same page, using a "#" and the header ID](#header-ids-and-links)
+- This line links to [a section on a different Markdown page, using a "#" and the header ID](index.md#overview)
+- This line links to [a different section on the same page, using a "#" and the header ID](#header-ids-and-links)
Using references:
-- This is a [reference-style link, see below][Arbitrary case-insensitive reference text]
+- This line shows a [reference-style link, see below][Arbitrary case-insensitive reference text]
- You can [use numbers for reference-style link definitions, see below][1]
- Or leave it empty and use the [link text itself][], see below.
@@ -1207,15 +1205,15 @@ Some text to show that the reference links can follow later.
[link text itself]: https://www.reddit.com
-- This is an [inline-style link](https://www.google.com)
-- This is a [link to a repository file in the same directory](index.md)
-- This is a [relative link to a README one directory higher](../index.md)
-- This is a [link that also has title text](https://www.google.com "This link takes you to Google!")
+- This line shows an [inline-style link](https://www.google.com)
+- This line shows a [link to a repository file in the same directory](index.md)
+- This line shows a [relative link to a README one directory higher](../index.md)
+- This line shows a [link that also has title text](https://www.google.com "This link takes you to Google!")
Using header ID anchors:
-- This links to [a section on a different Markdown page, using a "#" and the header ID](index.md#overview)
-- This links to [a different section on the same page, using a "#" and the header ID](#header-ids-and-links)
+- This line links to [a section on a different Markdown page, using a "#" and the header ID](index.md#overview)
+- This line links to [a different section on the same page, using a "#" and the header ID](#header-ids-and-links)
Using references:
@@ -1224,7 +1222,7 @@ The example below uses in-line links to pass the Vale ReferenceLinks test.
Do not change to reference style links.
-->
-- This is a [reference-style link, see below](https://www.mozilla.org/en-US/)
+- This line is a [reference-style link, see below](https://www.mozilla.org/en-US/)
- You can [use numbers for reference-style link definitions, see below](https://slashdot.org)
- Or leave it empty and use the [link text itself](https://www.reddit.com), see below.
@@ -1232,7 +1230,7 @@ Some text to show that the reference links can follow later.
NOTE:
Relative links do not allow the referencing of project files in a wiki
-page, or a wiki page in a project file. The reason for this is that a wiki is always
+page, or a wiki page in a project file. The reason: a wiki is always
in a separate Git repository in GitLab. For example, `[I'm a reference-style link](style)`
points the link to `wikis/style` only when the link is inside of a wiki Markdown file.
@@ -1261,14 +1259,14 @@ GitLab Flavored Markdown auto-links almost any URL you put into your text:
### Lists
-Ordered and unordered lists can be created.
+You can create ordered and unordered lists.
For an ordered list, add the number you want the list
to start with, like `1.`, followed by a space, at the start of each line for ordered lists.
-After the first number, it does not matter what number you use, ordered lists are
+After the first number, it does not matter what number you use. Ordered lists are
numbered automatically by vertical order, so repeating `1.` for all items in the
same list is common. If you start with a number other than `1.`, it uses that as the first
-number, and count up from there.
+number, and counts up from there.
Examples:
@@ -1360,10 +1358,9 @@ Example:
---
-If the paragraph of the first item is not indented with the proper number of spaces,
+If the first item's paragraph isn't indented with the proper number of spaces,
the paragraph appears outside the list, instead of properly indented under the list item.
-
-Example:
+For example:
```markdown
1. First ordered list item
@@ -1455,13 +1452,13 @@ use `
` tags to force a cell to have multiple lines:
```markdown
| Name | Details |
| --- | --- |
-| Item1 | This is on one line |
+| Item1 | This text is on one line |
| Item2 | This item has:
- Multiple items
- That we want listed separately |
```
| Name | Details |
| --- | --- |
-| Item1 | This is on one line |
+| Item1 | This text is on one line |
| Item2 | This item has:
- Multiple items
- That we want listed separately |
You can use HTML formatting in GitLab itself to add [task lists](#task-lists) with checkboxes,
diff --git a/lib/support/systemd/gitlab-gitaly.service b/lib/support/systemd/gitlab-gitaly.service
new file mode 100644
index 00000000000..49f04563292
--- /dev/null
+++ b/lib/support/systemd/gitlab-gitaly.service
@@ -0,0 +1,17 @@
+[Unit]
+Description=GitLab Gitaly
+ReloadPropagatedFrom=gitlab.target
+PartOf=gitlab.target
+After=network.target
+
+[Service]
+Type=simple
+User=git
+WorkingDirectory=/home/git/gitlab
+ExecStart=/home/git/gitaly/_build/bin/gitaly /home/git/gitaly/config.toml
+Restart=on-failure
+SyslogIdentifier=gitlab-gitaly
+Slice=gitlab.slice
+
+[Install]
+WantedBy=gitlab.target
diff --git a/lib/support/systemd/gitlab-mailroom.service b/lib/support/systemd/gitlab-mailroom.service
new file mode 100644
index 00000000000..4186126c128
--- /dev/null
+++ b/lib/support/systemd/gitlab-mailroom.service
@@ -0,0 +1,19 @@
+[Unit]
+Description=GitLab Mailroom
+PartOf=gitlab.target
+After=network.target
+StartLimitIntervalSec=100s
+
+[Service]
+Type=simple
+User=git
+WorkingDirectory=/home/git/gitlab
+Environment=RAILS_ENV=production
+ExecStart=/usr/local/bin/bundle exec mail_room --log-exit-as json --quiet --config /home/git/gitlab/config/mail_room.yml
+Restart=on-failure
+RestartSec=1
+SyslogIdentifier=gitlab-mailroom
+Slice=gitlab.slice
+
+[Install]
+WantedBy=gitlab.target
diff --git a/lib/support/systemd/gitlab-pages.service b/lib/support/systemd/gitlab-pages.service
new file mode 100644
index 00000000000..2060f01be01
--- /dev/null
+++ b/lib/support/systemd/gitlab-pages.service
@@ -0,0 +1,19 @@
+[Unit]
+Description=GitLab Pages
+ReloadPropagatedFrom=gitlab.target
+PartOf=gitlab.target
+After=network.target gitlab-puma.service
+Wants=gitlab-puma.service
+
+[Service]
+Type=simple
+User=git
+WorkingDirectory=/home/git/gitlab
+ExecStart=/home/git/gitlab-pages/gitlab-pages -config /home/git/gitlab-pages/gitlab-pages.conf
+Restart=on-failure
+RestartSec=1
+SyslogIdentifier=gitlab-pages
+Slice=gitlab.slice
+
+[Install]
+WantedBy=gitlab.target
diff --git a/lib/support/systemd/gitlab-puma.service b/lib/support/systemd/gitlab-puma.service
new file mode 100644
index 00000000000..c0affa92ddf
--- /dev/null
+++ b/lib/support/systemd/gitlab-puma.service
@@ -0,0 +1,26 @@
+[Unit]
+Description=GitLab
+Conflicts=gitlab.service
+ReloadPropagatedFrom=gitlab.target
+PartOf=gitlab.target
+After=network.target
+StartLimitIntervalSec=100s
+
+[Service]
+Type=notify
+User=git
+WorkingDirectory=/home/git/gitlab
+Environment=RAILS_ENV=production
+ExecStart=/usr/local/bin/bundle exec puma --config /home/git/gitlab/config/puma.rb --environment production --pidfile /home/git/gitlab/tmp/pids/puma.pid
+ExecReload=/usr/bin/kill -USR2 $MAINPID
+PIDFile=/home/git/gitlab/tmp/pids/puma.pid
+# puma can be slow to start
+TimeoutStartSec=120
+WatchdogSec=10
+Restart=on-failure
+RestartSec=1
+SyslogIdentifier=gitlab-puma
+Slice=gitlab.slice
+
+[Install]
+WantedBy=gitlab.target
diff --git a/lib/support/systemd/gitlab-sidekiq.service b/lib/support/systemd/gitlab-sidekiq.service
new file mode 100644
index 00000000000..81046f5348a
--- /dev/null
+++ b/lib/support/systemd/gitlab-sidekiq.service
@@ -0,0 +1,22 @@
+[Unit]
+Description=GitLab Sidekiq
+ReloadPropagatedFrom=gitlab.target
+PartOf=gitlab.target
+After=network.target
+JoinsNamespaceOf=gitlab-puma.service
+
+[Service]
+Type=simple
+User=git
+WorkingDirectory=/home/git/gitlab
+Environment=RAILS_ENV=production
+ExecStart=/usr/local/bin/bundle exec sidekiq --config /home/git/gitlab/config/sidekiq_queues.yml --environment production
+ExecStop=/usr/local/bin/bundle exec sidekiqctl stop /run/gitlab/sidekiq.pid
+PIDFile=/home/git/gitlab/tmp/pids/sidekiq.pid
+Restart=on-failure
+RestartSec=1
+SyslogIdentifier=gitlab-sidekiq
+Slice=gitlab.slice
+
+[Install]
+WantedBy=gitlab.target
diff --git a/lib/support/systemd/gitlab-workhorse.service b/lib/support/systemd/gitlab-workhorse.service
new file mode 100644
index 00000000000..3e9a72d3cb2
--- /dev/null
+++ b/lib/support/systemd/gitlab-workhorse.service
@@ -0,0 +1,21 @@
+[Unit]
+Description=GitLab Workhorse
+ReloadPropagatedFrom=gitlab.target
+PartOf=gitlab.target
+After=network.target gitlab-puma.service
+Wants=gitlab-puma.service
+
+[Service]
+Type=simple
+User=git
+WorkingDirectory=/home/git/gitlab
+Environment=PATH=/home/git/gitlab-workhorse:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
+ExecStart=/home/git/gitlab-workhorse/gitlab-workhorse -listenUmask 0 -listenNetwork unix -listenAddr /home/git/gitlab/tmp/sockets/gitlab-workhorse.socket -authBackend http://127.0.0.1:8080 -authSocket /home/git/gitlab/tmp/sockets/gitlab.socket -documentRoot /home/git/gitlab/public -secretPath /home/git/gitlab/.gitlab_workhorse_secret
+ExecReload=/usr/bin/kill -USR2 $MAINPID
+Restart=on-failure
+RestartSec=1
+SyslogIdentifier=gitlab-workhorse
+Slice=gitlab.slice
+
+[Install]
+WantedBy=gitlab.target
diff --git a/lib/support/systemd/gitlab.slice b/lib/support/systemd/gitlab.slice
new file mode 100644
index 00000000000..2c447f6224a
--- /dev/null
+++ b/lib/support/systemd/gitlab.slice
@@ -0,0 +1,8 @@
+[Unit]
+Description=Slice to bundle all GitLab services
+Before=slices.target
+
+[Slice]
+MemoryAccounting=true
+IOAccounting=true
+CPUAccounting=true
diff --git a/lib/support/systemd/gitlab.target b/lib/support/systemd/gitlab.target
new file mode 100644
index 00000000000..e0538c3ff81
--- /dev/null
+++ b/lib/support/systemd/gitlab.target
@@ -0,0 +1,6 @@
+[Unit]
+Description=GitLab
+Wants=gitlab-gitaly.service gitlab-puma.service gitlab-sidekiq.service gitlab-workhorse.service
+
+[Install]
+WantedBy=multi-user.target
diff --git a/lib/system_check/app/init_script_exists_check.rb b/lib/system_check/app/init_script_exists_check.rb
deleted file mode 100644
index 7be92acdc37..00000000000
--- a/lib/system_check/app/init_script_exists_check.rb
+++ /dev/null
@@ -1,29 +0,0 @@
-# frozen_string_literal: true
-
-module SystemCheck
- module App
- class InitScriptExistsCheck < SystemCheck::BaseCheck
- set_name 'Init script exists?'
- set_skip_reason 'skipped (omnibus-gitlab has no init script)'
-
- def skip?
- omnibus_gitlab?
- end
-
- def check?
- script_path = '/etc/init.d/gitlab'
- File.exist?(script_path)
- end
-
- def show_error
- try_fixing_it(
- 'Install the init script'
- )
- for_more_information(
- see_installation_guide_section('Install Init Script')
- )
- fix_and_rerun
- end
- end
- end
-end
diff --git a/lib/system_check/app/init_script_up_to_date_check.rb b/lib/system_check/app/init_script_up_to_date_check.rb
deleted file mode 100644
index cf841d5e659..00000000000
--- a/lib/system_check/app/init_script_up_to_date_check.rb
+++ /dev/null
@@ -1,47 +0,0 @@
-# frozen_string_literal: true
-
-module SystemCheck
- module App
- class InitScriptUpToDateCheck < SystemCheck::BaseCheck
- SCRIPT_PATH = '/etc/init.d/gitlab'
-
- set_name 'Init script up-to-date?'
- set_skip_reason 'skipped (omnibus-gitlab has no init script)'
-
- def skip?
- return true if omnibus_gitlab?
-
- unless init_file_exists?
- self.skip_reason = "can't check because of previous errors"
-
- true
- end
- end
-
- def check?
- recipe_path = Rails.root.join('lib/support/init.d/', 'gitlab')
-
- recipe_content = File.read(recipe_path)
- script_content = File.read(SCRIPT_PATH)
-
- recipe_content == script_content
- end
-
- def show_error
- try_fixing_it(
- 'Re-download the init script'
- )
- for_more_information(
- see_installation_guide_section('Install Init Script')
- )
- fix_and_rerun
- end
-
- private
-
- def init_file_exists?
- File.exist?(SCRIPT_PATH)
- end
- end
- end
-end
diff --git a/lib/system_check/app/systemd_unit_files_or_init_script_exist_check.rb b/lib/system_check/app/systemd_unit_files_or_init_script_exist_check.rb
new file mode 100644
index 00000000000..b2f059d212b
--- /dev/null
+++ b/lib/system_check/app/systemd_unit_files_or_init_script_exist_check.rb
@@ -0,0 +1,39 @@
+# frozen_string_literal: true
+
+module SystemCheck
+ module App
+ class SystemdUnitFilesOrInitScriptExistCheck < SystemCheck::BaseCheck
+ set_name 'Systemd unit files or init script exist?'
+ set_skip_reason 'skipped (omnibus-gitlab has neither init script nor systemd units)'
+
+ def skip?
+ omnibus_gitlab?
+ end
+
+ def check?
+ unit_paths = [
+ '/usr/local/lib/systemd/system/gitlab-gitaly.service',
+ '/usr/local/lib/systemd/system/gitlab-mailroom.service',
+ '/usr/local/lib/systemd/system/gitlab-puma.service',
+ '/usr/local/lib/systemd/system/gitlab-sidekiq.service',
+ '/usr/local/lib/systemd/system/gitlab.slice',
+ '/usr/local/lib/systemd/system/gitlab.target',
+ '/usr/local/lib/systemd/system/gitlab-workhorse.service'
+ ]
+ script_path = '/etc/init.d/gitlab'
+
+ unit_paths.all? { |s| File.exist?(s) } || File.exist?(script_path)
+ end
+
+ def show_error
+ try_fixing_it(
+ 'Install the Service'
+ )
+ for_more_information(
+ see_installation_guide_section('Install the Service')
+ )
+ fix_and_rerun
+ end
+ end
+ end
+end
diff --git a/lib/system_check/app/systemd_unit_files_or_init_script_up_to_date_check.rb b/lib/system_check/app/systemd_unit_files_or_init_script_up_to_date_check.rb
new file mode 100644
index 00000000000..10bc772a83c
--- /dev/null
+++ b/lib/system_check/app/systemd_unit_files_or_init_script_up_to_date_check.rb
@@ -0,0 +1,80 @@
+# frozen_string_literal: true
+
+module SystemCheck
+ module App
+ class SystemdUnitFilesOrInitScriptUpToDateCheck < SystemCheck::BaseCheck
+ SCRIPT_PATH = '/etc/init.d/gitlab'
+ UNIT_PATHS = [
+ '/usr/local/lib/systemd/system/gitlab-gitaly.service',
+ '/usr/local/lib/systemd/system/gitlab-mailroom.service',
+ '/usr/local/lib/systemd/system/gitlab-puma.service',
+ '/usr/local/lib/systemd/system/gitlab-sidekiq.service',
+ '/usr/local/lib/systemd/system/gitlab.slice',
+ '/usr/local/lib/systemd/system/gitlab.target',
+ '/usr/local/lib/systemd/system/gitlab-workhorse.service'
+ ].freeze
+
+ set_name 'Systemd unit files or init script up-to-date?'
+ set_skip_reason 'skipped (omnibus-gitlab has neither init script nor systemd units)'
+
+ def skip?
+ return true if omnibus_gitlab?
+
+ unless unit_files_exist? || init_file_exists?
+ self.skip_reason = "can't check because of previous errors"
+
+ true
+ end
+ end
+
+ def check?
+ if unit_files_exist?
+ return unit_files_up_to_date?
+ end
+
+ init_file_up_to_date?
+ end
+
+ def show_error
+ try_fixing_it(
+ 'Install the Service'
+ )
+ for_more_information(
+ see_installation_guide_section('Install the Service')
+ )
+ fix_and_rerun
+ end
+
+ private
+
+ def init_file_exists?
+ File.exist?(SCRIPT_PATH)
+ end
+
+ def unit_files_exist?
+ UNIT_PATHS.all? { |s| File.exist?(s) }
+ end
+
+ def init_file_up_to_date?
+ recipe_path = Rails.root.join('lib/support/init.d/', 'gitlab')
+
+ recipe_content = File.read(recipe_path)
+ script_content = File.read(SCRIPT_PATH)
+
+ recipe_content == script_content
+ end
+
+ def unit_files_up_to_date?
+ UNIT_PATHS.all? do |unit|
+ unit_name = File.basename(unit)
+ recipe_path = Rails.root.join('lib/support/systemd/', unit_name)
+
+ recipe_content = File.read(recipe_path)
+ unit_content = File.read(unit)
+
+ recipe_content == unit_content
+ end
+ end
+ end
+ end
+end
diff --git a/lib/system_check/incoming_email/initd_configured_check.rb b/lib/system_check/incoming_email/mail_room_enabled_check.rb
similarity index 50%
rename from lib/system_check/incoming_email/initd_configured_check.rb
rename to lib/system_check/incoming_email/mail_room_enabled_check.rb
index acb4b5a9e74..8e725aabd03 100644
--- a/lib/system_check/incoming_email/initd_configured_check.rb
+++ b/lib/system_check/incoming_email/mail_room_enabled_check.rb
@@ -2,20 +2,21 @@
module SystemCheck
module IncomingEmail
- class InitdConfiguredCheck < SystemCheck::BaseCheck
- set_name 'Init.d configured correctly?'
+ class MailRoomEnabledCheck < SystemCheck::BaseCheck
+ include ::SystemCheck::InitHelpers
+ set_name 'Mailroom enabled?'
def skip?
omnibus_gitlab?
end
def check?
- mail_room_configured?
+ mail_room_enabled? || mail_room_configured?
end
def show_error
try_fixing_it(
- 'Enable mail_room in the init.d configuration.'
+ 'Enable mail_room'
)
for_more_information(
'doc/administration/reply_by_email.md'
@@ -25,6 +26,13 @@ module SystemCheck
private
+ def mail_room_enabled?
+ target = '/usr/local/lib/systemd/system/gitlab.target'
+ service = '/usr/local/lib/systemd/system/gitlab-mailroom.service'
+
+ File.exist?(target) && File.exist?(service) && systemd_get_wants('gitlab.target').include?("gitlab-mailroom.service")
+ end
+
def mail_room_configured?
path = '/etc/default/gitlab'
File.exist?(path) && File.read(path).include?('mail_room_enabled=true')
diff --git a/lib/system_check/incoming_email/mail_room_running_check.rb b/lib/system_check/incoming_email/mail_room_running_check.rb
index b7aead4624e..38bb1e46364 100644
--- a/lib/system_check/incoming_email/mail_room_running_check.rb
+++ b/lib/system_check/incoming_email/mail_room_running_check.rb
@@ -3,12 +3,13 @@
module SystemCheck
module IncomingEmail
class MailRoomRunningCheck < SystemCheck::BaseCheck
+ include ::SystemCheck::InitHelpers
set_name 'MailRoom running?'
def skip?
return true if omnibus_gitlab?
- unless mail_room_configured?
+ unless mail_room_enabled? || mail_room_configured?
self.skip_reason = "can't check because of previous errors"
true
end
@@ -20,10 +21,10 @@ module SystemCheck
def show_error
try_fixing_it(
- sudo_gitlab('RAILS_ENV=production bin/mail_room start')
+ 'Start mail_room'
)
for_more_information(
- see_installation_guide_section('Install Init Script'),
+ 'doc/administration/incoming_email.md',
'see log/mail_room.log for possible errors'
)
fix_and_rerun
@@ -31,6 +32,13 @@ module SystemCheck
private
+ def mail_room_enabled?
+ target = '/usr/local/lib/systemd/system/gitlab.target'
+ service = '/usr/local/lib/systemd/system/gitlab-mailroom.service'
+
+ File.exist?(target) && File.exist?(service) && systemd_get_wants('gitlab.target').include?("gitlab-mailroom.service")
+ end
+
def mail_room_configured?
path = '/etc/default/gitlab'
File.exist?(path) && File.read(path).include?('mail_room_enabled=true')
diff --git a/lib/system_check/incoming_email_check.rb b/lib/system_check/incoming_email_check.rb
index 84033ada710..3cae9450b94 100644
--- a/lib/system_check/incoming_email_check.rb
+++ b/lib/system_check/incoming_email_check.rb
@@ -14,7 +14,7 @@ module SystemCheck
end
if Rails.env.production?
- checks << SystemCheck::IncomingEmail::InitdConfiguredCheck
+ checks << SystemCheck::IncomingEmail::MailRoomEnabledCheck
checks << SystemCheck::IncomingEmail::MailRoomRunningCheck
end
diff --git a/lib/system_check/init_helpers.rb b/lib/system_check/init_helpers.rb
new file mode 100644
index 00000000000..2573f06b716
--- /dev/null
+++ b/lib/system_check/init_helpers.rb
@@ -0,0 +1,24 @@
+# frozen_string_literal: true
+
+require 'open3'
+
+module SystemCheck
+ module InitHelpers
+ # Return the Wants= of a unit, empty if the unit doesn't exist
+ def systemd_get_wants(unitname)
+ stdout, _stderr, status = Open3.capture3("systemctl", "--no-pager", "show", unitname)
+
+ unless status
+ return []
+ end
+
+ wantsline = stdout.lines.find { |line| line.start_with?("Wants=") }
+
+ unless wantsline
+ return []
+ end
+
+ wantsline.delete_prefix("Wants=").strip.split
+ end
+ end
+end
diff --git a/lib/system_check/rake_task/app_task.rb b/lib/system_check/rake_task/app_task.rb
index f7d2bf86c78..892417d67ec 100644
--- a/lib/system_check/rake_task/app_task.rb
+++ b/lib/system_check/rake_task/app_task.rb
@@ -23,8 +23,8 @@ module SystemCheck
SystemCheck::App::UploadsDirectoryExistsCheck,
SystemCheck::App::UploadsPathPermissionCheck,
SystemCheck::App::UploadsPathTmpPermissionCheck,
- SystemCheck::App::InitScriptExistsCheck,
- SystemCheck::App::InitScriptUpToDateCheck,
+ SystemCheck::App::SystemdUnitFilesOrInitScriptExistCheck,
+ SystemCheck::App::SystemdUnitFilesOrInitScriptUpToDateCheck,
SystemCheck::App::ProjectsHaveNamespaceCheck,
SystemCheck::App::RedisVersionCheck,
SystemCheck::App::RubyVersionCheck,
diff --git a/lib/system_check/sidekiq_check.rb b/lib/system_check/sidekiq_check.rb
index 7ac1bd58ede..ab048433b37 100644
--- a/lib/system_check/sidekiq_check.rb
+++ b/lib/system_check/sidekiq_check.rb
@@ -39,6 +39,12 @@ module SystemCheck
if (cluster_count == 1 && worker_count > 0) || (cluster_count == 0 && worker_count == 1)
$stdout.puts "#{cluster_count}/#{worker_count}".color(:green)
+ elsif File.symlink?('/run/systemd/units/invocation:gitlab-sidekiq.service')
+ $stdout.puts "#{cluster_count}/#{worker_count}".color(:red)
+ try_fixing_it(
+ 'sudo systemctl restart gitlab-sidekiq.service'
+ )
+ fix_and_rerun
else
$stdout.puts "#{cluster_count}/#{worker_count}".color(:red)
try_fixing_it(
diff --git a/scripts/regenerate-schema b/scripts/regenerate-schema
index 485bb2d5505..06230942dcd 100755
--- a/scripts/regenerate-schema
+++ b/scripts/regenerate-schema
@@ -126,7 +126,7 @@ class SchemaRegenerator
# In order to properly reset the database and re-run migrations
# the schema migrations for new migrations must be removed.
def remove_schema_migration_files
- (untracked_schema_migrations + commited_schema_migrations).each do |schema_migration|
+ (untracked_schema_migrations + committed_schema_migrations).each do |schema_migration|
FileUtils.rm(schema_migration)
end
end
@@ -144,7 +144,7 @@ class SchemaRegenerator
# List of untracked schema migrations
#
# Get a list of schema migrations that have been committed since the last
- def commited_schema_migrations
+ def committed_schema_migrations
git_command = "git diff --name-only --diff-filter=A #{merge_base} -- #{SCHEMA_MIGRATIONS_DIR}"
run(git_command).chomp.split("\n")
end
diff --git a/spec/frontend/ide/stores/mutations_spec.js b/spec/frontend/ide/stores/mutations_spec.js
index 23fe23bdef9..4602a0837e0 100644
--- a/spec/frontend/ide/stores/mutations_spec.js
+++ b/spec/frontend/ide/stores/mutations_spec.js
@@ -86,12 +86,12 @@ describe('Multi-file store mutations', () => {
mutations.SET_EMPTY_STATE_SVGS(localState, {
emptyStateSvgPath: 'emptyState',
noChangesStateSvgPath: 'noChanges',
- committedStateSvgPath: 'commited',
+ committedStateSvgPath: 'committed',
});
expect(localState.emptyStateSvgPath).toBe('emptyState');
expect(localState.noChangesStateSvgPath).toBe('noChanges');
- expect(localState.committedStateSvgPath).toBe('commited');
+ expect(localState.committedStateSvgPath).toBe('committed');
});
});
diff --git a/spec/frontend/monitoring/components/dashboard_spec.js b/spec/frontend/monitoring/components/dashboard_spec.js
index 9c5bc876a64..faa8264b488 100644
--- a/spec/frontend/monitoring/components/dashboard_spec.js
+++ b/spec/frontend/monitoring/components/dashboard_spec.js
@@ -408,7 +408,7 @@ describe('Dashboard', () => {
});
});
- describe('when all requests have been commited by the store', () => {
+ describe('when all requests have been committed by the store', () => {
beforeEach(() => {
store.commit(`monitoringDashboard/${types.SET_INITIAL_STATE}`, {
currentEnvironmentName: 'production',
diff --git a/spec/lib/system_check/incoming_email_check_spec.rb b/spec/lib/system_check/incoming_email_check_spec.rb
index 710702b93fc..5d93b810045 100644
--- a/spec/lib/system_check/incoming_email_check_spec.rb
+++ b/spec/lib/system_check/incoming_email_check_spec.rb
@@ -28,7 +28,7 @@ RSpec.describe SystemCheck::IncomingEmailCheck do
it 'runs IMAP and mailroom checks' do
expect(SystemCheck).to receive(:run).with('Reply by email', [
SystemCheck::IncomingEmail::ImapAuthenticationCheck,
- SystemCheck::IncomingEmail::InitdConfiguredCheck,
+ SystemCheck::IncomingEmail::MailRoomEnabledCheck,
SystemCheck::IncomingEmail::MailRoomRunningCheck
])
@@ -43,7 +43,7 @@ RSpec.describe SystemCheck::IncomingEmailCheck do
it 'runs mailroom checks' do
expect(SystemCheck).to receive(:run).with('Reply by email', [
- SystemCheck::IncomingEmail::InitdConfiguredCheck,
+ SystemCheck::IncomingEmail::MailRoomEnabledCheck,
SystemCheck::IncomingEmail::MailRoomRunningCheck
])