Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Gemfile1
-rw-r--r--Gemfile.lock2
-rw-r--r--app/assets/javascripts/error_tracking/details.js7
-rw-r--r--app/assets/javascripts/vue_merge_request_widget/components/states/ready_to_merge.vue15
-rw-r--r--app/assets/stylesheets/framework/files.scss28
-rw-r--r--app/models/concerns/update_highest_role.rb2
-rw-r--r--doc/administration/incoming_email.md44
-rw-r--r--doc/administration/pages/source.md29
-rw-r--r--doc/administration/restart_gitlab.md34
-rw-r--r--doc/api/repository_files.md6
-rw-r--r--doc/ci/pipelines/parent_child_pipelines.md32
-rw-r--r--doc/ci/resource_groups/index.md2
-rw-r--r--doc/ci/triggers/index.md3
-rw-r--r--doc/ci/yaml/index.md161
-rw-r--r--doc/development/testing_guide/testing_migrations_guide.md140
-rw-r--r--doc/install/installation.md184
-rw-r--r--doc/install/relative_url.md5
-rw-r--r--doc/update/index.md4
-rw-r--r--doc/update/patch_versions.md9
-rw-r--r--doc/update/upgrading_from_source.md35
-rw-r--r--doc/user/markdown.md111
-rw-r--r--lib/support/systemd/gitlab-gitaly.service17
-rw-r--r--lib/support/systemd/gitlab-mailroom.service19
-rw-r--r--lib/support/systemd/gitlab-pages.service19
-rw-r--r--lib/support/systemd/gitlab-puma.service26
-rw-r--r--lib/support/systemd/gitlab-sidekiq.service22
-rw-r--r--lib/support/systemd/gitlab-workhorse.service21
-rw-r--r--lib/support/systemd/gitlab.slice8
-rw-r--r--lib/support/systemd/gitlab.target6
-rw-r--r--lib/system_check/app/init_script_exists_check.rb29
-rw-r--r--lib/system_check/app/init_script_up_to_date_check.rb47
-rw-r--r--lib/system_check/app/systemd_unit_files_or_init_script_exist_check.rb39
-rw-r--r--lib/system_check/app/systemd_unit_files_or_init_script_up_to_date_check.rb80
-rw-r--r--lib/system_check/incoming_email/mail_room_enabled_check.rb (renamed from lib/system_check/incoming_email/initd_configured_check.rb)16
-rw-r--r--lib/system_check/incoming_email/mail_room_running_check.rb14
-rw-r--r--lib/system_check/incoming_email_check.rb2
-rw-r--r--lib/system_check/init_helpers.rb24
-rw-r--r--lib/system_check/rake_task/app_task.rb4
-rw-r--r--lib/system_check/sidekiq_check.rb6
-rwxr-xr-xscripts/regenerate-schema4
-rw-r--r--spec/frontend/ide/stores/mutations_spec.js4
-rw-r--r--spec/frontend/monitoring/components/dashboard_spec.js2
-rw-r--r--spec/lib/system_check/incoming_email_check_spec.rb4
43 files changed, 837 insertions, 430 deletions
diff --git a/Gemfile b/Gemfile
index 3a04f1e1395..e2b93f37d74 100644
--- a/Gemfile
+++ b/Gemfile
@@ -186,6 +186,7 @@ gem 'rack-timeout', '~> 0.5.1', require: 'rack/timeout/base'
group :puma do
gem 'puma', '~> 5.3.1', require: false
gem 'puma_worker_killer', '~> 0.3.1', require: false
+ gem 'sd_notify', '~> 0.1.0', require: false
end
# State machine
diff --git a/Gemfile.lock b/Gemfile.lock
index 7497734d6dc..e0257c136db 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -1153,6 +1153,7 @@ GEM
addressable (>= 2.3.5)
faraday (> 0.8, < 2.0)
scientist (1.6.0)
+ sd_notify (0.1.0)
securecompare (1.0.0)
seed-fu (2.3.7)
activerecord (>= 3.1)
@@ -1605,6 +1606,7 @@ DEPENDENCIES
rugged (~> 1.1)
sanitize (~> 5.2.1)
sassc-rails (~> 2.1.0)
+ sd_notify (~> 0.1.0)
seed-fu (~> 2.3.7)
selenium-webdriver (~> 3.142)
sentry-raven (~> 3.1)
diff --git a/app/assets/javascripts/error_tracking/details.js b/app/assets/javascripts/error_tracking/details.js
index 37b8007d556..38245210b70 100644
--- a/app/assets/javascripts/error_tracking/details.js
+++ b/app/assets/javascripts/error_tracking/details.js
@@ -20,7 +20,12 @@ export default () => {
} = domEl.dataset;
const apolloProvider = new VueApollo({
- defaultClient: createDefaultClient(),
+ defaultClient: createDefaultClient(
+ {},
+ {
+ assumeImmutableResults: true,
+ },
+ ),
});
// eslint-disable-next-line no-new
diff --git a/app/assets/javascripts/vue_merge_request_widget/components/states/ready_to_merge.vue b/app/assets/javascripts/vue_merge_request_widget/components/states/ready_to_merge.vue
index 7d4bd4cf1bf..4c34002a8cf 100644
--- a/app/assets/javascripts/vue_merge_request_widget/components/states/ready_to_merge.vue
+++ b/app/assets/javascripts/vue_merge_request_widget/components/states/ready_to_merge.vue
@@ -557,6 +557,14 @@ export default {
v-if="shouldShowMergeControls"
class="gl-display-flex gl-align-items-center gl-flex-wrap"
>
+ <merge-train-helper-icon
+ v-if="shouldRenderMergeTrainHelperIcon"
+ :merge-train-when-pipeline-succeeds-docs-path="
+ mr.mergeTrainWhenPipelineSucceedsDocsPath
+ "
+ class="gl-mx-3"
+ />
+
<gl-form-checkbox
v-if="canRemoveSourceBranch"
id="remove-source-branch-input"
@@ -575,13 +583,6 @@ export default {
:is-disabled="isSquashReadOnly"
class="gl-mx-3"
/>
-
- <merge-train-helper-icon
- v-if="shouldRenderMergeTrainHelperIcon"
- :merge-train-when-pipeline-succeeds-docs-path="
- mr.mergeTrainWhenPipelineSucceedsDocsPath
- "
- />
</div>
<template v-else>
<div class="bold js-resolve-mr-widget-items-message gl-ml-3">
diff --git a/app/assets/stylesheets/framework/files.scss b/app/assets/stylesheets/framework/files.scss
index df78543f96d..4a45bcfb475 100644
--- a/app/assets/stylesheets/framework/files.scss
+++ b/app/assets/stylesheets/framework/files.scss
@@ -146,13 +146,6 @@
* Blame file
*/
&.blame {
- //
- // IMPORTANT PERFORMANCE OPTIMIZATION
- //
- // When viewinng a blame with many commits a lot of content is rendered on the page.
- // The line below ensures that we only render what is visible to the user, thus reducing TBT in the browser.
- content-visibility: auto;
-
table {
border: 0;
margin: 0;
@@ -167,12 +160,6 @@
}
td {
- //
- // IMPORTANT PERFORMANCE OPTIMIZATION
- //
- // When viewinng a blame with many commits a lot of content is rendered on the page.
- // The line below ensures that we only render what is visible to the user, thus reducing TBT in the browser.
- content-visibility: auto;
border-top: 0;
border-bottom: 0;
@@ -235,6 +222,21 @@
color: $gray-900;
}
}
+
+ //
+ // IMPORTANT PERFORMANCE OPTIMIZATION
+ //
+ // When viewinng a blame with many commits a lot of content is rendered on the page.
+ // Two selectors below ensure that we only render what is visible to the user, thus reducing TBT in the browser.
+ .commit {
+ content-visibility: auto;
+ contain-intrinsic-size: 1px 3em;
+ }
+
+ code .line {
+ content-visibility: auto;
+ contain-intrinsic-size: 1px 1.1875rem;
+ }
}
&.logs {
diff --git a/app/models/concerns/update_highest_role.rb b/app/models/concerns/update_highest_role.rb
index 6432cc794a5..2b0ec5c7e21 100644
--- a/app/models/concerns/update_highest_role.rb
+++ b/app/models/concerns/update_highest_role.rb
@@ -15,7 +15,7 @@ module UpdateHighestRole
# Schedule a Sidekiq job to update the highest role for a User
#
# The job will be called outside of a transaction in order to ensure the changes
- # to be commited before attempting to update the highest role.
+ # to be committed before attempting to update the highest role.
# The exlusive lease will not be released after completion to prevent multiple jobs
# being executed during the defined timeout.
def update_highest_role
diff --git a/doc/administration/incoming_email.md b/doc/administration/incoming_email.md
index 5b72583bc95..6b390cfc77a 100644
--- a/doc/administration/incoming_email.md
+++ b/doc/administration/incoming_email.md
@@ -155,6 +155,50 @@ Reply by email should now be working.
1. Find the `incoming_email` section in `config/gitlab.yml`, enable the feature
and fill in the details for your specific IMAP server and email account (see [examples](#configuration-examples) below).
+If you use systemd units to manage GitLab:
+
+1. Add `gitlab-mailroom.service` as a dependency to `gitlab.target`:
+
+ ```shell
+ sudo systemctl edit gitlab.target
+ ```
+
+ In the editor that opens, add the following and save the file:
+
+ ```plaintext
+ [Unit]
+ Wants=gitlab-mailroom.service
+ ```
+
+1. If you run Redis and PostgreSQL on the same machine, you should add a
+ dependency on Redis. Run:
+
+ ```shell
+ sudo systemctl edit gitlab-mailroom.service
+ ```
+
+ In the editor that opens, add the following and save the file:
+
+ ```plaintext
+ [Unit]
+ Wants=redis-server.service
+ After=redis-server.service
+ ```
+
+1. Start `gitlab-mailroom.service`:
+
+ ```shell
+ sudo systemctl start gitlab-mailroom.service
+ ```
+
+1. Verify that everything is configured correctly:
+
+ ```shell
+ sudo -u git -H bundle exec rake gitlab:incoming_email:check RAILS_ENV=production
+ ```
+
+If you use the SysV init script to manage GitLab:
+
1. Enable `mail_room` in the init script at `/etc/default/gitlab`:
```shell
diff --git a/doc/administration/pages/source.md b/doc/administration/pages/source.md
index 278d792052a..3a277204d21 100644
--- a/doc/administration/pages/source.md
+++ b/doc/administration/pages/source.md
@@ -132,11 +132,11 @@ The Pages daemon doesn't listen to the outside world.
https: false
artifacts_server: false
external_http: ["127.0.0.1:8090"]
- secret_file: /home/git/gitlab/gitlab-pages/gitlab-pages-secret
+ secret_file: /home/git/gitlab/gitlab-pages-secret
```
1. Add the following configuration file to
- `/home/git/gitlab/gitlab-pages/gitlab-pages.conf`, and be sure to change
+ `/home/git/gitlab-pages/gitlab-pages.conf`, and be sure to change
`example.io` to the FQDN from which you want to serve GitLab Pages and
`gitlab.example.com` to the URL of your GitLab instance:
@@ -159,12 +159,27 @@ The Pages daemon doesn't listen to the outside world.
sudo -u git -H openssl rand -base64 32 > /home/git/gitlab/gitlab-pages-secret
```
-1. Edit `/etc/default/gitlab` and set `gitlab_pages_enabled` to `true` in
- order to enable the pages daemon:
+1. To enable the pages daemon:
- ```ini
- gitlab_pages_enabled=true
- ```
+ - If your system uses systemd as init, run:
+
+ ```shell
+ sudo systemctl edit gitlab.target
+ ```
+
+ In the editor that opens, add the following and save the file:
+
+ ```plaintext
+ [Unit]
+ Wants=gitlab-pages.service
+ ```
+
+ - If your system uses SysV init instead, edit `/etc/default/gitlab` and set
+ `gitlab_pages_enabled` to `true`:
+
+ ```ini
+ gitlab_pages_enabled=true
+ ```
1. Copy the `gitlab-pages` NGINX configuration file:
diff --git a/doc/administration/restart_gitlab.md b/doc/administration/restart_gitlab.md
index b8f09b00773..9579d413bf8 100644
--- a/doc/administration/restart_gitlab.md
+++ b/doc/administration/restart_gitlab.md
@@ -103,39 +103,15 @@ If you have followed the official installation guide to [install GitLab from
source](../install/installation.md), run the following command to restart GitLab:
```shell
-sudo service gitlab restart
-```
+# For systems running systemd
+sudo systemctl restart gitlab.target
-The output should be similar to this:
-
-```plaintext
-Shutting down GitLab Puma
-Shutting down GitLab Sidekiq
-Shutting down GitLab Workhorse
-Shutting down GitLab MailRoom
-...
-GitLab is not running.
-Starting GitLab Puma
-Starting GitLab Sidekiq
-Starting GitLab Workhorse
-Starting GitLab MailRoom
-...
-The GitLab Puma 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.
+# For systems running SysV init
+sudo service gitlab restart
```
This should restart Puma, Sidekiq, GitLab Workhorse, and [Mailroom](reply_by_email.md)
-(if enabled). The init service file that does all the magic can be found on
-your server in `/etc/init.d/gitlab`.
-
----
-
-If you are using other init systems, like `systemd`, you can check the
-[GitLab Recipes](https://gitlab.com/gitlab-org/gitlab-recipes/tree/master/init) repository for some unofficial services. These are
-**not** officially supported so use them at your own risk.
+(if enabled).
## Helm chart installations
diff --git a/doc/api/repository_files.md b/doc/api/repository_files.md
index 4fb1a94e294..cc210eacd49 100644
--- a/doc/api/repository_files.md
+++ b/doc/api/repository_files.md
@@ -185,7 +185,7 @@ POST /projects/:id/repository/files/:file_path
```shell
curl --request POST --header 'PRIVATE-TOKEN: <your_access_token>' \
--header "Content-Type: application/json" \
- --data '{"branch": "master", "author_email": "author@example.com", "author_name": "Firstname Lastname", \
+ --data '{"branch": "master", "author_email": "author@example.com", "author_name": "Firstname Lastname",
"content": "some content", "commit_message": "create a new file"}' \
"https://gitlab.example.com/api/v4/projects/13083/repository/files/app%2Fproject%2Erb"
```
@@ -221,7 +221,7 @@ PUT /projects/:id/repository/files/:file_path
```shell
curl --request PUT --header 'PRIVATE-TOKEN: <your_access_token>' \
--header "Content-Type: application/json" \
- --data '{"branch": "master", "author_email": "author@example.com", "author_name": "Firstname Lastname", \
+ --data '{"branch": "master", "author_email": "author@example.com", "author_name": "Firstname Lastname",
"content": "some content", "commit_message": "update file"}' \
"https://gitlab.example.com/api/v4/projects/13083/repository/files/app%2Fproject%2Erb"
```
@@ -268,7 +268,7 @@ DELETE /projects/:id/repository/files/:file_path
```shell
curl --request DELETE --header 'PRIVATE-TOKEN: <your_access_token>' \
--header "Content-Type: application/json" \
- --data '{"branch": "master", "author_email": "author@example.com", "author_name": "Firstname Lastname", \
+ --data '{"branch": "master", "author_email": "author@example.com", "author_name": "Firstname Lastname",
"commit_message": "delete file"}' \
"https://gitlab.example.com/api/v4/projects/13083/repository/files/app%2Fproject%2Erb"
```
diff --git a/doc/ci/pipelines/parent_child_pipelines.md b/doc/ci/pipelines/parent_child_pipelines.md
index e48728a904a..64f4160c963 100644
--- a/doc/ci/pipelines/parent_child_pipelines.md
+++ b/doc/ci/pipelines/parent_child_pipelines.md
@@ -81,7 +81,8 @@ microservice_a:
trigger:
include:
- project: 'my-group/my-pipeline-library'
- file: 'path/to/ci-config.yml'
+ ref: 'main'
+ file: '/path/to/child-pipeline.yml'
```
The maximum number of entries that are accepted for `trigger:include:` is three.
@@ -98,7 +99,7 @@ microservice_a:
strategy: depend
```
-## Merge Request child pipelines
+## Merge request child pipelines
To trigger a child pipeline as a [Merge Request Pipeline](merge_request_pipelines.md) we need to:
@@ -149,7 +150,7 @@ microservice_a:
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/35632) in GitLab 12.9.
Instead of running a child pipeline from a static YAML file, you can define a job that runs
-your own script to generate a YAML file, which is then [used to trigger a child pipeline](../yaml/index.md#trigger-child-pipeline-with-generated-configuration-file).
+your own script to generate a YAML file, which is then used to trigger a child pipeline.
This technique can be very powerful in generating pipelines targeting content that changed or to
build a matrix of targets and architectures.
@@ -171,6 +172,31 @@ configuration for jobs, like scripts, that use the Windows runner would use `\`.
In GitLab 12.9, the child pipeline could fail to be created in certain cases, causing the parent pipeline to fail.
This is [resolved](https://gitlab.com/gitlab-org/gitlab/-/issues/209070) in GitLab 12.10.
+### Dynamic child pipeline example
+
+> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/35632) in GitLab 12.9.
+
+You can trigger a child pipeline from a [dynamically generated configuration file](../pipelines/parent_child_pipelines.md#dynamic-child-pipelines):
+
+```yaml
+generate-config:
+ stage: build
+ script: generate-ci-config > generated-config.yml
+ artifacts:
+ paths:
+ - generated-config.yml
+
+child-pipeline:
+ stage: test
+ trigger:
+ include:
+ - artifact: generated-config.yml
+ job: generate-config
+```
+
+The `generated-config.yml` is extracted from the artifacts and used as the configuration
+for triggering the child pipeline.
+
## Nested child pipelines
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/29651) in GitLab 13.4.
diff --git a/doc/ci/resource_groups/index.md b/doc/ci/resource_groups/index.md
index 7de3643c0d4..a1c02870217 100644
--- a/doc/ci/resource_groups/index.md
+++ b/doc/ci/resource_groups/index.md
@@ -177,7 +177,7 @@ deploy:
```
In a parent pipeline, it runs the `test` job that subsequently runs a child pipeline,
-and the [`strategy: depend` option](../yaml/index.md#linking-pipelines-with-triggerstrategy) makes the `test` job wait until the child pipeline has finished.
+and the [`strategy: depend` option](../yaml/index.md#triggerstrategy) makes the `test` job wait until the child pipeline has finished.
The parent pipeline runs the `deploy` job in the next stage, that requires a resource from the `production` resource group.
If the process mode is `oldest_first`, it executes the jobs from the oldest pipelines, meaning the `deploy` job is going to be executed next.
diff --git a/doc/ci/triggers/index.md b/doc/ci/triggers/index.md
index a2dd4ac91d5..afcf8ae629a 100644
--- a/doc/ci/triggers/index.md
+++ b/doc/ci/triggers/index.md
@@ -113,6 +113,9 @@ This means that whenever a new tag is pushed on project A, the job runs and the
`stage: deploy` ensures that this job runs only after all jobs with
`stage: test` complete successfully.
+NOTE:
+You [cannot use the API to start `when:manual` trigger jobs](https://gitlab.com/gitlab-org/gitlab/-/issues/284086).
+
## Triggering a pipeline from a webhook
To trigger a job from a webhook of another project you need to add the following
diff --git a/doc/ci/yaml/index.md b/doc/ci/yaml/index.md
index 07b238164d5..80d88407e83 100644
--- a/doc/ci/yaml/index.md
+++ b/doc/ci/yaml/index.md
@@ -3802,31 +3802,19 @@ deploystacks:
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/8997) in GitLab Premium 11.8.
> - [Moved](https://gitlab.com/gitlab-org/gitlab/-/issues/199224) to GitLab Free in 12.8.
-Use `trigger` to define a downstream pipeline trigger. When GitLab starts a `trigger` job,
-a downstream pipeline is created.
+Use `trigger` to start a downstream pipeline that is either:
-Jobs with `trigger` can only use a [limited set of keywords](../pipelines/multi_project_pipelines.md#define-multi-project-pipelines-in-your-gitlab-ciyml-file).
-For example, you can't run commands with [`script`](#script), [`before_script`](#before_script),
-or [`after_script`](#after_script).
+- [A multi-project pipeline](../pipelines/multi_project_pipelines.md).
+- [A child pipeline](../pipelines/parent_child_pipelines.md).
-You can use this keyword to create two different types of downstream pipelines:
-
-- [Multi-project pipelines](../pipelines/multi_project_pipelines.md#define-multi-project-pipelines-in-your-gitlab-ciyml-file)
-- [Child pipelines](../pipelines/parent_child_pipelines.md)
-
-In [GitLab 13.2 and later](https://gitlab.com/gitlab-org/gitlab/-/issues/197140/), you can
-view which job triggered a downstream pipeline. In the [pipeline graph](../pipelines/index.md#visualize-pipelines),
-hover over the downstream pipeline job.
+**Keyword type**: Job keyword. You can use it only as part of a job.
-In [GitLab 13.5 and later](https://gitlab.com/gitlab-org/gitlab/-/issues/201938), you
-can use [`when:manual`](#when) in the same job as `trigger`. In GitLab 13.4 and
-earlier, using them together causes the error `jobs:#{job-name} when should be on_success, on_failure or always`.
-You [cannot start `manual` trigger jobs with the API](https://gitlab.com/gitlab-org/gitlab/-/issues/284086).
+**Possible inputs**:
-#### Basic `trigger` syntax for multi-project pipelines
+- For multi-project pipelines, path to the downstream project.
+- For child pipelines, path to the child pipeline CI/CD configuration file.
-You can configure a downstream trigger by using the `trigger` keyword
-with a full path to a downstream project:
+**Example of `trigger` for multi-project pipeline**:
```yaml
rspec:
@@ -3838,47 +3826,7 @@ staging:
trigger: my/deployment
```
-#### Complex `trigger` syntax for multi-project pipelines
-
-You can configure a branch name that GitLab uses to create
-a downstream pipeline with:
-
-```yaml
-rspec:
- stage: test
- script: bundle exec rspec
-
-staging:
- stage: deploy
- trigger:
- project: my/deployment
- branch: stable
-```
-
-To mirror the status from a triggered pipeline:
-
-```yaml
-trigger_job:
- trigger:
- project: my/project
- strategy: depend
-```
-
-To mirror the status from an upstream pipeline:
-
-```yaml
-upstream_bridge:
- stage: test
- needs:
- pipeline: other/project
-```
-
-#### `trigger` syntax for child pipeline
-
-> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/16094) in GitLab 12.7.
-
-To create a [child pipeline](../pipelines/parent_child_pipelines.md), specify the path to the
-YAML file that contains the configuration of the child pipeline:
+**Example of `trigger` for child pipelines**:
```yaml
trigger_job:
@@ -3886,71 +3834,36 @@ trigger_job:
include: path/to/child-pipeline.yml
```
-Similar to [multi-project pipelines](../pipelines/multi_project_pipelines.md#mirror-status-of-a-triggered-pipeline-in-the-trigger-job),
-it's possible to mirror the status from a triggered pipeline:
-
-```yaml
-trigger_job:
- trigger:
- include:
- - local: path/to/child-pipeline.yml
- strategy: depend
-```
-
-##### Trigger child pipeline with generated configuration file
-
-> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/35632) in GitLab 12.9.
-
-You can also trigger a child pipeline from a [dynamically generated configuration file](../pipelines/parent_child_pipelines.md#dynamic-child-pipelines):
-
-```yaml
-generate-config:
- stage: build
- script: generate-ci-config > generated-config.yml
- artifacts:
- paths:
- - generated-config.yml
-
-child-pipeline:
- stage: test
- trigger:
- include:
- - artifact: generated-config.yml
- job: generate-config
-```
+**Additional details**:
-The `generated-config.yml` is extracted from the artifacts and used as the configuration
-for triggering the child pipeline.
+- Jobs with `trigger` can only use a [limited set of keywords](../pipelines/multi_project_pipelines.md#define-multi-project-pipelines-in-your-gitlab-ciyml-file).
+ For example, you can't run commands with [`script`](#script), [`before_script`](#before_script),
+ or [`after_script`](#after_script).
+- In [GitLab 13.5 and later](https://gitlab.com/gitlab-org/gitlab/-/issues/201938), you
+ can use [`when:manual`](#when) in the same job as `trigger`. In GitLab 13.4 and
+ earlier, using them together causes the error `jobs:#{job-name} when should be on_success, on_failure or always`.
+- In [GitLab 13.2 and later](https://gitlab.com/gitlab-org/gitlab/-/issues/197140/), you can
+ view which job triggered a downstream pipeline in the [pipeline graph](../pipelines/index.md#visualize-pipelines).
-##### Trigger child pipeline with files from another project
+**Related topics**:
-> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/205157) in GitLab 13.5.
+- [Multi-project pipeline configuration examples](../pipelines/multi_project_pipelines.md#define-multi-project-pipelines-in-your-gitlab-ciyml-file).
+- [Child pipeline configuration examples](../pipelines/parent_child_pipelines.md#examples).
+- To force a rebuild of a specific branch, tag, or commit, you can
+ [use an API call with a trigger token](../triggers/index.md).
+ The trigger token is different than the `trigger` keyword.
-To trigger child pipelines with files from another private project under the same
-GitLab instance, use [`include:file`](#includefile):
+#### `trigger:strategy`
-```yaml
-child-pipeline:
- trigger:
- include:
- - project: 'my-group/my-pipeline-library'
- ref: 'main'
- file: '/path/to/child-pipeline.yml'
-```
-
-#### Linking pipelines with `trigger:strategy`
+Use `trigger:strategy` to force the `trigger` job to wait for the downstream pipeline to complete
+before it is marked as **success**.
-By default, the `trigger` job completes with the `success` status
-as soon as the downstream pipeline is created.
+This behavior is different than the default, which is for the `trigger` job to be marked as
+**success** as soon as the downstream pipeline is created.
-To force the `trigger` job to wait for the downstream (multi-project or child) pipeline to complete, use
-`strategy: depend`. This setting makes the trigger job wait with a "running" status until the triggered
-pipeline completes. At that point, the `trigger` job completes and displays the same status as
-the downstream job.
+This setting makes your pipeline execution linear rather than parallel.
-This setting can help keep your pipeline execution linear. In the following example, jobs from
-subsequent stages wait for the triggered pipeline to successfully complete before
-starting, which reduces parallelization.
+**Example of `trigger:strategy`**:
```yaml
trigger_job:
@@ -3959,14 +3872,8 @@ trigger_job:
strategy: depend
```
-#### Trigger a pipeline by API call
-
-To force a rebuild of a specific branch, tag, or commit, you can use an API call
-with a trigger token.
-
-The trigger token is different than the [`trigger`](#trigger) keyword.
-
-[Read more in the triggers documentation.](../triggers/index.md)
+In this example, jobs from subsequent stages wait for the triggered pipeline to
+successfully complete before starting.
### `interruptible`
@@ -4109,7 +4016,7 @@ deployment:
script: echo "Deploying..."
```
-You must define [`strategy: depend`](#linking-pipelines-with-triggerstrategy)
+You must define [`strategy: depend`](#triggerstrategy)
with the `trigger` keyword. This ensures that the lock isn't released until the downstream pipeline
finishes.
diff --git a/doc/development/testing_guide/testing_migrations_guide.md b/doc/development/testing_guide/testing_migrations_guide.md
index 1254ed89d56..88b2eb730c1 100644
--- a/doc/development/testing_guide/testing_migrations_guide.md
+++ b/doc/development/testing_guide/testing_migrations_guide.md
@@ -234,54 +234,65 @@ Migration tests depend on what the migration does exactly, the most common types
#### Example of a data migration test
This spec tests the
-[`db/post_migrate/20170526185842_migrate_pipeline_stages.rb`](https://gitlab.com/gitlab-org/gitlab-foss/blob/v11.6.5/db/post_migrate/20170526185842_migrate_pipeline_stages.rb)
+[`db/post_migrate/20200723040950_migrate_incident_issues_to_incident_type.rb`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/db/post_migrate/20200723040950_migrate_incident_issues_to_incident_type.rb)
migration. You can find the complete spec in
-[`spec/migrations/migrate_pipeline_stages_spec.rb`](https://gitlab.com/gitlab-org/gitlab-foss/blob/v11.6.5/spec/migrations/migrate_pipeline_stages_spec.rb).
+[`spec/migrations/migrate_incident_issues_to_incident_type_spec.rb`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/spec/migrations/migrate_incident_issues_to_incident_type_spec.rb).
```ruby
-require 'spec_helper'
+# frozen_string_literal: true
+require 'spec_helper'
require_migration!
-RSpec.describe MigratePipelineStages do
- # Create test data - pipeline and CI/CD jobs.
- let(:jobs) { table(:ci_builds) }
- let(:stages) { table(:ci_stages) }
- let(:pipelines) { table(:ci_pipelines) }
+RSpec.describe MigrateIncidentIssuesToIncidentType do
+ let(:migration) { described_class.new }
+
let(:projects) { table(:projects) }
+ let(:namespaces) { table(:namespaces) }
+ let(:labels) { table(:labels) }
+ let(:issues) { table(:issues) }
+ let(:label_links) { table(:label_links) }
+ let(:label_props) { IncidentManagement::CreateIncidentLabelService::LABEL_PROPERTIES }
+
+ let(:namespace) { namespaces.create!(name: 'foo', path: 'foo') }
+ let!(:project) { projects.create!(namespace_id: namespace.id) }
+ let(:label) { labels.create!(project_id: project.id, **label_props) }
+ let!(:incident_issue) { issues.create!(project_id: project.id) }
+ let!(:other_issue) { issues.create!(project_id: project.id) }
+
+ # Issue issue_type enum
+ let(:issue_type) { 0 }
+ let(:incident_type) { 1 }
before do
- projects.create!(id: 123, name: 'gitlab1', path: 'gitlab1')
- pipelines.create!(id: 1, project_id: 123, ref: 'master', sha: 'adf43c3a')
- jobs.create!(id: 1, commit_id: 1, project_id: 123, stage_idx: 2, stage: 'build')
- jobs.create!(id: 2, commit_id: 1, project_id: 123, stage_idx: 1, stage: 'test')
+ label_links.create!(target_id: incident_issue.id, label_id: label.id, target_type: 'Issue')
end
- # Test just the up migration.
- it 'correctly migrates pipeline stages' do
- expect(stages.count).to be_zero
-
- migrate!
+ describe '#up' do
+ it 'updates the incident issue type' do
+ expect { migrate! }
+ .to change { incident_issue.reload.issue_type }
+ .from(issue_type)
+ .to(incident_type)
- expect(stages.count).to eq 2
- expect(stages.all.pluck(:name)).to match_array %w[test build]
+ expect(other_issue.reload.issue_type).to eql(issue_type)
+ end
end
- # Test a reversible migration.
- it 'correctly migrates up and down pipeline stages' do
- reversible_migration do |migration|
- # Expectations will run before the up migration,
- # and then again after the down migration
- migration.before -> {
- expect(stages.count).to be_zero
- }
-
- # Expectations will run after the up migration.
- migration.after -> {
- expect(stages.count).to eq 2
- expect(stages.all.pluck(:name)).to match_array %w[test build]
- }
+ describe '#down' do
+ let!(:incident_issue) { issues.create!(project_id: project.id, issue_type: issue_type) }
+
+ it 'updates the incident issue type' do
+ migration.up
+
+ expect { migration.down }
+ .to change { incident_issue.reload.issue_type }
+ .from(incident_type)
+ .to(issue_type)
+
+ expect(other_issue.reload.issue_type).to eql(issue_type)
end
+ end
end
```
@@ -357,41 +368,62 @@ end
### Example background migration test
This spec tests the
-[`lib/gitlab/background_migration/archive_legacy_traces.rb`](https://gitlab.com/gitlab-org/gitlab-foss/blob/v11.6.5/lib/gitlab/background_migration/archive_legacy_traces.rb)
+[`lib/gitlab/background_migration/backfill_draft_status_on_merge_requests.rb`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/background_migration/backfill_draft_status_on_merge_requests.rb)
background migration. You can find the complete spec on
-[`spec/lib/gitlab/background_migration/archive_legacy_traces_spec.rb`](https://gitlab.com/gitlab-org/gitlab-foss/blob/v11.6.5/spec/lib/gitlab/background_migration/archive_legacy_traces_spec.rb)
+[`spec/lib/gitlab/background_migration/backfill_draft_status_on_merge_requests_spec.rb`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/spec/lib/gitlab/background_migration/backfill_draft_status_on_merge_requests_spec.rb)
```ruby
+# frozen_string_literal: true
+
require 'spec_helper'
-describe Gitlab::BackgroundMigration::ArchiveLegacyTraces, schema: 20180529152628 do
- include TraceHelpers
+RSpec.describe Gitlab::BackgroundMigration::BackfillDraftStatusOnMergeRequests do
+ let(:namespaces) { table(:namespaces) }
+ let(:projects) { table(:projects) }
+ let(:merge_requests) { table(:merge_requests) }
- let(:namespaces) { table(:namespaces) }
- let(:projects) { table(:projects) }
- let(:builds) { table(:ci_builds) }
- let(:job_artifacts) { table(:ci_job_artifacts) }
+ let(:group) { namespaces.create!(name: 'gitlab', path: 'gitlab') }
+ let(:project) { projects.create!(namespace_id: group.id) }
- before do
- namespaces.create!(id: 123, name: 'gitlab1', path: 'gitlab1')
- projects.create!(id: 123, name: 'gitlab1', path: 'gitlab1', namespace_id: 123)
- @build = builds.create!(id: 1, project_id: 123, status: 'success', type: 'Ci::Build')
+ let(:draft_prefixes) { ["[Draft]", "(Draft)", "Draft:", "Draft", "[WIP]", "WIP:", "WIP"] }
+
+ def create_merge_request(params)
+ common_params = {
+ target_project_id: project.id,
+ target_branch: 'feature1',
+ source_branch: 'master'
+ }
+
+ merge_requests.create!(common_params.merge(params))
end
- context 'when trace file exists at the right place' do
+ context "for MRs with #draft? == true titles but draft attribute false" do
+ let(:mr_ids) { merge_requests.all.collect(&:id) }
+
before do
- create_legacy_trace(@build, 'trace in file')
+ draft_prefixes.each do |prefix|
+ (1..4).each do |n|
+ create_merge_request(
+ title: "#{prefix} This is a title",
+ draft: false,
+ state_id: n
+ )
+ end
+ end
end
- it 'correctly archive legacy traces' do
- expect(job_artifacts.count).to eq(0)
- expect(File.exist?(legacy_trace_path(@build))).to be_truthy
+ it "updates all open draft merge request's draft field to true" do
+ mr_count = merge_requests.all.count
+
+ expect { subject.perform(mr_ids.first, mr_ids.last) }
+ .to change { MergeRequest.where(draft: false).count }
+ .from(mr_count).to(mr_count - draft_prefixes.length)
+ end
- described_class.new.perform(1, 1)
+ it "marks successful slices as completed" do
+ expect(subject).to receive(:mark_job_as_succeeded).with(mr_ids.first, mr_ids.last)
- expect(job_artifacts.count).to eq(1)
- expect(File.exist?(legacy_trace_path(@build))).to be_falsy
- expect(File.read(archived_trace_path(job_artifacts.first))).to eq('trace in file')
+ subject.perform(mr_ids.first, mr_ids.last)
end
end
end
diff --git a/doc/install/installation.md b/doc/install/installation.md
index 73b7d0d8837..2d2d2d63be1 100644
--- a/doc/install/installation.md
+++ b/doc/install/installation.md
@@ -423,6 +423,49 @@ echo 'unixsocket /var/run/redis/redis.sock' | sudo tee -a /etc/redis/redis.conf
# Grant permission to the socket to all members of the redis group
echo 'unixsocketperm 770' | sudo tee -a /etc/redis/redis.conf
+# Add git to the redis group
+sudo usermod -aG redis git
+```
+
+### Supervise Redis with systemd
+
+If your distribution uses systemd init and the output of the following command is `notify`,
+you do not need to make any changes:
+
+```shell
+systemctl show --value --property=Type redis-server.service
+```
+
+If the output is **not** `notify`, run:
+
+```shell
+# Configure Redis to not daemonize, but be supervised by systemd instead and disable the pidfile
+sudo sed -i \
+ -e 's/^daemonize yes$/daemonize no/' \
+ -e 's/^supervised no$/supervised systemd/' \
+ -e 's/^pidfile/# pidfile/' /etc/redis/redis.conf
+sudo chown redis:redis /etc/redis/redis.conf
+
+# Make the same changes to the systemd unit file
+sudo mkdir -p /etc/systemd/system/redis-server.service.d
+sudo tee /etc/systemd/system/redis-server.service.d/10fix_type.conf <<EOF
+[Service]
+Type=notify
+PIDFile=
+EOF
+
+# Reload the redis service
+sudo systemctl daemon-reload
+
+# Activate the changes to redis.conf
+sudo systemctl restart redis-server.service
+```
+
+### Leave Redis unsupervised
+
+If your system uses SysV init, run these commands:
+
+```shell
# Create the directory which contains the socket
sudo mkdir -p /var/run/redis
sudo chown redis:redis /var/run/redis
@@ -435,9 +478,6 @@ fi
# Activate the changes to redis.conf
sudo service redis-server restart
-
-# Add git to the redis group
-sudo usermod -aG redis git
```
## 8. GitLab
@@ -687,48 +727,79 @@ sudo -u git -H editor config.toml
For more information about configuring Gitaly see
[the Gitaly documentation](../administration/gitaly/index.md).
-### Start Gitaly
+### Install the service
-Gitaly must be running for the next section.
+GitLab has always supported SysV init scripts, which are widely supported and portable, but now systemd is the standard for service supervision and is used by all major Linux distributions. You should use native systemd services if you can to benefit from automatic restarts, better sandboxing and resource control.
-```shell
-gitlab_path=/home/git/gitlab
-gitaly_path=/home/git/gitaly
+#### Install systemd units
-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 &"
-```
+Use these steps if you use systemd as init. Otherwise, follow the [SysV init script steps](#install-sysv-init-script).
-### Initialize Database and Activate Advanced Features
+Copy the services and run `systemctl daemon-reload` so that systemd picks them up:
```shell
cd /home/git/gitlab
-sudo -u git -H bundle exec rake gitlab:setup RAILS_ENV=production
-# Type 'yes' to create the database tables.
+sudo mkdir -p /usr/local/lib/systemd/system
+sudo cp lib/support/systemd/* /usr/local/lib/systemd/system/
+sudo systemctl daemon-reload
+```
-# or you can skip the question by adding force=yes
-sudo -u git -H bundle exec rake gitlab:setup RAILS_ENV=production force=yes
+The units provided by GitLab make very little assumptions about where you are running Redis and PostgreSQL.
-# When done, you see 'Administrator account created:'
-```
+If you installed GitLab in another directory or as a user other than the default, you need to change these values in the units as well.
-You can set the Administrator/root password and email by supplying them in environmental variables, `GITLAB_ROOT_PASSWORD` and `GITLAB_ROOT_EMAIL` respectively, as seen below. If you don't set the password (and it is set to the default one), wait to expose GitLab to the public internet until the installation is done and you've logged into the server the first time. During the first login, you'll be forced to change the default password. An Enterprise Edition license may also be installed at this time by supplying a full path in the `GITLAB_LICENSE_FILE` environment variable.
+For example, if you're running Redis and PostgreSQL on the same machine as GitLab, you should:
+
+- Edit the Puma service:
+
+ ```shell
+ sudo systemctl edit gitlab-puma.service
+ ```
+
+ In the editor that opens, add the following and save the file:
+
+ ```plaintext
+ [Unit]
+ Wants=redis-server.service postgresql.service
+ After=redis-server.service postgresql.service
+ ```
+
+- Edit the Sidekiq service:
+
+ ```shell
+ sudo systemctl edit gitlab-sidekiq.service
+ ```
+
+ Add the following and save the file:
+
+ ```plaintext
+ [Unit]
+ Wants=redis-server.service postgresql.service
+ After=redis-server.service postgresql.service
+ ```
+
+`systemctl edit` installs drop-in configuration files at `/etc/systemd/system/<name of the unit>.d/override.conf`, so your local configuration is not overwritten when updating the unit files later. To split up your drop-in configuration files, you can add the above snippets to `.conf` files under `/etc/systemd/system/<name of the unit>.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 -u git -H bundle exec rake gitlab:setup RAILS_ENV=production GITLAB_ROOT_PASSWORD=yourpassword GITLAB_ROOT_EMAIL=youremail GITLAB_LICENSE_FILE="/path/to/license"
+sudo systemctl daemon-reload
```
-### Secure secrets.yml
+Make GitLab start on boot:
-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.
+```shell
+sudo systemctl enable gitlab.target
+```
+
+#### Install SysV init script
-### Install 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
```
@@ -744,6 +815,9 @@ 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
@@ -752,6 +826,51 @@ sudo update-rc.d gitlab defaults 21
sudo cp lib/support/logrotate/gitlab /etc/logrotate.d/gitlab
```
+### Start Gitaly
+
+Gitaly must be running for the next section.
+
+- To start Gitaly using systemd:
+
+ ```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
+
+```shell
+cd /home/git/gitlab
+sudo -u git -H bundle exec rake gitlab:setup RAILS_ENV=production
+# Type 'yes' to create the database tables.
+
+# or you can skip the question by adding force=yes
+sudo -u git -H bundle exec rake gitlab:setup RAILS_ENV=production force=yes
+
+# When done, you see 'Administrator account created:'
+```
+
+You can set the Administrator/root password and email by supplying them in environmental variables, `GITLAB_ROOT_PASSWORD` and `GITLAB_ROOT_EMAIL` respectively, as seen below. If you don't set the password (and it is set to the default one), wait to expose GitLab to the public internet until the installation is done and you've logged into the server the first time. During the first login, you'll be forced to change the default password. An Enterprise Edition license may also be installed at this time by supplying a full path in the `GITLAB_LICENSE_FILE` environment variable.
+
+```shell
+sudo -u git -H bundle exec rake gitlab:setup RAILS_ENV=production GITLAB_ROOT_PASSWORD=yourpassword GITLAB_ROOT_EMAIL=youremail GITLAB_LICENSE_FILE="/path/to/license"
+```
+
+### Secure secrets.yml
+
+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.
+
### 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 <img src="https://gitlab.com/gitlab-org/gitlab-foss/raw/ma
You can use it to point out a<img src="https://gitlab.com/gitlab-org/gitlab-foss/raw/master/public/-/emojis/2/bug.png" width="20px" height="20px" style="display:inline;margin:0;border: 0"> or warn about <img src="https://gitlab.com/gitlab-org/gitlab-foss/raw/master/public/-/emojis/2/speak_no_evil.png" width="20px" height="20px" style="display:inline;margin:0;border: 0"> patches. If someone improves your really <img src="https://gitlab.com/gitlab-org/gitlab-foss/raw/master/public/-/emojis/2/snail.png" width="20px" height="20px" style="display:inline;margin:0;border: 0"> code, send them some <img src="https://gitlab.com/gitlab-org/gitlab-foss/raw/master/public/-/emojis/2/birthday.png" width="20px" height="20px" style="display:inline;margin:0;border: 0">. People <img src="https://gitlab.com/gitlab-org/gitlab-foss/raw/master/public/-/emojis/2/heart.png" width="20px" height="20px" style="display:inline;margin:0;border: 0"> you for that.
-If you're new to this, don't be <img src="https://gitlab.com/gitlab-org/gitlab-foss/raw/master/public/-/emojis/2/fearful.png" width="20px" height="20px" style="display:inline;margin:0;border: 0">. You can join the emoji <img src="https://gitlab.com/gitlab-org/gitlab-foss/raw/master/public/-/emojis/2/family.png" width="20px" height="20px" style="display:inline;margin:0;border: 0">. All you need to do is to look up one of the supported codes.
+If you're new to this, don't be <img src="https://gitlab.com/gitlab-org/gitlab-foss/raw/master/public/-/emojis/2/fearful.png" width="20px" height="20px" style="display:inline;margin:0;border: 0">. You can join the emoji <img src="https://gitlab.com/gitlab-org/gitlab-foss/raw/master/public/-/emojis/2/family.png" width="20px" height="20px" style="display:inline;margin:0;border: 0">. 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. <img src="https://gitlab.com/gitlab-org/gitlab-foss/raw/master/public/-/emojis/2/thumbsup.png" width="20px" height="20px" style="display:inline;margin:0;border: 0">
@@ -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 <b>tag</b>.
```
````
@@ -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 <b>tag</b>.
```
### 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]
-&#91;^1]: This is the text inside a footnote.
+&#91;^1]: This text is inside a footnote.
-&#91;^footnote-42]: This is another footnote.
+&#91;^footnote-42]: This text is another footnote.
</code></pre>
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):
</code></pre>
<!--
-DO NOT change the name of markdown_logo.png. This is used for a test in
+DO NOT change the name of markdown_logo.png. This file is used for a test in
spec/controllers/help_controller_spec.rb.
-->
@@ -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 <em>remain</em> <b>hidden</b> 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 <kbd>Enter</kbd> twice in a row. If you only
-use one newline (hit <kbd>Enter</kbd> once), the next sentence remains part of the
+ended with two newlines, like when you press <kbd>Enter</kbd> twice in a row. If you only
+use one newline (select <kbd>Enter</kbd> 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:
<!--
Do not edit the following codeblock. It uses HTML to skip the Vale ReferenceLinks test.
-->
-<pre class="highlight"><code>- 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!")
+<pre class="highlight"><code>- 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.
&#91;link text itself]: https://www.reddit.com
</code></pre>
-- 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:
<!-- vale gitlab.Spelling = YES -->
### 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 `<br>` 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:<br>- Multiple items<br>- That we want listed separately |
```
| Name | Details |
| --- | --- |
-| Item1 | This is on one line |
+| Item1 | This text is on one line |
| Item2 | This item has:<br>- Multiple items<br>- 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
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
])