2016-02-26 07:31:58 +00:00
|
|
|
<chapter xmlns="http://docbook.org/ns/docbook"
|
|
|
|
xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
|
|
xmlns:xi="http://www.w3.org/2001/XInclude"
|
|
|
|
version="5.0"
|
|
|
|
xml:id="module-services-gitlab">
|
2021-02-25 11:02:55 +00:00
|
|
|
<title>GitLab</title>
|
2018-09-30 01:51:11 +01:00
|
|
|
<para>
|
2021-02-25 11:02:55 +00:00
|
|
|
GitLab is a feature-rich git hosting service.
|
2018-09-30 01:51:11 +01:00
|
|
|
</para>
|
|
|
|
<section xml:id="module-services-gitlab-prerequisites">
|
|
|
|
<title>Prerequisites</title>
|
|
|
|
|
|
|
|
<para>
|
2021-02-25 11:02:55 +00:00
|
|
|
The <literal>gitlab</literal> service exposes only an Unix socket at
|
2019-09-19 18:17:30 +01:00
|
|
|
<literal>/run/gitlab/gitlab-workhorse.socket</literal>. You need to
|
|
|
|
configure a webserver to proxy HTTP requests to the socket.
|
2018-09-30 01:51:11 +01:00
|
|
|
</para>
|
|
|
|
|
|
|
|
<para>
|
2019-09-19 18:17:30 +01:00
|
|
|
For instance, the following configuration could be used to use nginx as
|
|
|
|
frontend proxy:
|
2016-02-26 07:31:58 +00:00
|
|
|
<programlisting>
|
2018-04-05 09:43:56 +01:00
|
|
|
<link linkend="opt-services.nginx.enable">services.nginx</link> = {
|
|
|
|
<link linkend="opt-services.nginx.enable">enable</link> = true;
|
|
|
|
<link linkend="opt-services.nginx.recommendedGzipSettings">recommendedGzipSettings</link> = true;
|
|
|
|
<link linkend="opt-services.nginx.recommendedOptimisation">recommendedOptimisation</link> = true;
|
|
|
|
<link linkend="opt-services.nginx.recommendedProxySettings">recommendedProxySettings</link> = true;
|
|
|
|
<link linkend="opt-services.nginx.recommendedTlsSettings">recommendedTlsSettings</link> = true;
|
|
|
|
<link linkend="opt-services.nginx.virtualHosts">virtualHosts</link>."git.example.com" = {
|
|
|
|
<link linkend="opt-services.nginx.virtualHosts._name_.enableACME">enableACME</link> = true;
|
|
|
|
<link linkend="opt-services.nginx.virtualHosts._name_.forceSSL">forceSSL</link> = true;
|
|
|
|
<link linkend="opt-services.nginx.virtualHosts._name_.locations._name_.proxyPass">locations."/".proxyPass</link> = "http://unix:/run/gitlab/gitlab-workhorse.socket";
|
|
|
|
};
|
|
|
|
};
|
2016-02-26 07:31:58 +00:00
|
|
|
</programlisting>
|
2018-09-30 01:51:11 +01:00
|
|
|
</para>
|
|
|
|
</section>
|
|
|
|
<section xml:id="module-services-gitlab-configuring">
|
|
|
|
<title>Configuring</title>
|
|
|
|
|
|
|
|
<para>
|
2021-02-25 11:02:55 +00:00
|
|
|
GitLab depends on both PostgreSQL and Redis and will automatically enable
|
2019-09-19 18:17:30 +01:00
|
|
|
both services. In the case of PostgreSQL, a database and a role will be
|
|
|
|
created.
|
2018-09-30 01:51:11 +01:00
|
|
|
</para>
|
|
|
|
|
|
|
|
<para>
|
2019-09-19 18:17:30 +01:00
|
|
|
The default state dir is <literal>/var/gitlab/state</literal>. This is where
|
|
|
|
all data like the repositories and uploads will be stored.
|
2018-09-30 01:51:11 +01:00
|
|
|
</para>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
A basic configuration with some custom settings could look like this:
|
2016-02-26 07:31:58 +00:00
|
|
|
<programlisting>
|
|
|
|
services.gitlab = {
|
2018-04-05 09:43:56 +01:00
|
|
|
<link linkend="opt-services.gitlab.enable">enable</link> = true;
|
2019-07-31 17:09:27 +01:00
|
|
|
<link linkend="opt-services.gitlab.databasePasswordFile">databasePasswordFile</link> = "/var/keys/gitlab/db_password";
|
|
|
|
<link linkend="opt-services.gitlab.initialRootPasswordFile">initialRootPasswordFile</link> = "/var/keys/gitlab/root_password";
|
2018-04-05 09:43:56 +01:00
|
|
|
<link linkend="opt-services.gitlab.https">https</link> = true;
|
|
|
|
<link linkend="opt-services.gitlab.host">host</link> = "git.example.com";
|
|
|
|
<link linkend="opt-services.gitlab.port">port</link> = 443;
|
|
|
|
<link linkend="opt-services.gitlab.user">user</link> = "git";
|
|
|
|
<link linkend="opt-services.gitlab.group">group</link> = "git";
|
2016-08-04 01:23:08 +01:00
|
|
|
smtp = {
|
2018-04-05 09:43:56 +01:00
|
|
|
<link linkend="opt-services.gitlab.smtp.enable">enable</link> = true;
|
|
|
|
<link linkend="opt-services.gitlab.smtp.address">address</link> = "localhost";
|
|
|
|
<link linkend="opt-services.gitlab.smtp.port">port</link> = 25;
|
2016-08-04 01:23:08 +01:00
|
|
|
};
|
2016-08-26 13:08:53 +01:00
|
|
|
secrets = {
|
2019-07-31 17:09:27 +01:00
|
|
|
<link linkend="opt-services.gitlab.secrets.dbFile">dbFile</link> = "/var/keys/gitlab/db";
|
|
|
|
<link linkend="opt-services.gitlab.secrets.secretFile">secretFile</link> = "/var/keys/gitlab/secret";
|
|
|
|
<link linkend="opt-services.gitlab.secrets.otpFile">otpFile</link> = "/var/keys/gitlab/otp";
|
|
|
|
<link linkend="opt-services.gitlab.secrets.jwsFile">jwsFile</link> = "/var/keys/gitlab/jws";
|
2016-08-26 13:08:53 +01:00
|
|
|
};
|
2018-04-05 09:43:56 +01:00
|
|
|
<link linkend="opt-services.gitlab.extraConfig">extraConfig</link> = {
|
2016-02-26 07:31:58 +00:00
|
|
|
gitlab = {
|
2016-08-04 01:23:08 +01:00
|
|
|
email_from = "gitlab-no-reply@example.com";
|
|
|
|
email_display_name = "Example GitLab";
|
|
|
|
email_reply_to = "gitlab-no-reply@example.com";
|
2016-02-26 07:31:58 +00:00
|
|
|
default_projects_features = { builds = false; };
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
</programlisting>
|
2018-09-30 01:51:11 +01:00
|
|
|
</para>
|
|
|
|
|
|
|
|
<para>
|
2021-02-25 11:02:55 +00:00
|
|
|
If you're setting up a new GitLab instance, generate new
|
2019-09-19 18:17:30 +01:00
|
|
|
secrets. You for instance use <literal>tr -dc A-Za-z0-9 <
|
|
|
|
/dev/urandom | head -c 128 > /var/keys/gitlab/db</literal> to
|
|
|
|
generate a new db secret. Make sure the files can be read by, and
|
|
|
|
only by, the user specified by <link
|
2021-02-25 11:02:55 +00:00
|
|
|
linkend="opt-services.gitlab.user">services.gitlab.user</link>. GitLab
|
2019-09-19 18:17:30 +01:00
|
|
|
encrypts sensitive data stored in the database. If you're restoring
|
2021-02-25 11:02:55 +00:00
|
|
|
an existing GitLab instance, you must specify the secrets secret
|
|
|
|
from <literal>config/secrets.yml</literal> located in your GitLab
|
2019-09-19 18:17:30 +01:00
|
|
|
state folder.
|
2018-09-30 01:51:11 +01:00
|
|
|
</para>
|
|
|
|
|
2020-07-18 15:35:37 +01:00
|
|
|
<para>
|
2021-02-25 11:02:55 +00:00
|
|
|
When <literal>incoming_mail.enabled</literal> is set to <literal>true</literal>
|
2020-07-18 15:35:37 +01:00
|
|
|
in <link linkend="opt-services.gitlab.extraConfig">extraConfig</link> an additional
|
|
|
|
service called <literal>gitlab-mailroom</literal> is enabled for fetching incoming mail.
|
|
|
|
</para>
|
|
|
|
|
2018-09-30 01:51:11 +01:00
|
|
|
<para>
|
2019-09-19 18:17:30 +01:00
|
|
|
Refer to <xref linkend="ch-options" /> for all available configuration
|
|
|
|
options for the
|
|
|
|
<link linkend="opt-services.gitlab.enable">services.gitlab</link> module.
|
2018-09-30 01:51:11 +01:00
|
|
|
</para>
|
|
|
|
</section>
|
|
|
|
<section xml:id="module-services-gitlab-maintenance">
|
|
|
|
<title>Maintenance</title>
|
|
|
|
|
2021-02-25 12:48:33 +00:00
|
|
|
<section xml:id="module-services-gitlab-maintenance-backups">
|
|
|
|
<title>Backups</title>
|
|
|
|
<para>
|
|
|
|
Backups can be configured with the options in <link
|
|
|
|
linkend="opt-services.gitlab.backup.keepTime">services.gitlab.backup</link>. Use
|
|
|
|
the <link
|
|
|
|
linkend="opt-services.gitlab.backup.startAt">services.gitlab.backup.startAt</link>
|
|
|
|
option to configure regular backups.
|
|
|
|
</para>
|
2018-09-30 01:51:11 +01:00
|
|
|
|
2021-02-25 12:48:33 +00:00
|
|
|
<para>
|
|
|
|
To run a manual backup, start the <literal>gitlab-backup</literal> service:
|
2019-06-17 12:25:50 +01:00
|
|
|
<screen>
|
2021-02-25 12:48:33 +00:00
|
|
|
<prompt>$ </prompt>systemctl start gitlab-backup.service
|
2019-06-17 12:25:50 +01:00
|
|
|
</screen>
|
2021-02-25 12:48:33 +00:00
|
|
|
</para>
|
|
|
|
</section>
|
|
|
|
|
|
|
|
<section xml:id="module-services-gitlab-maintenance-rake">
|
|
|
|
<title>Rake tasks</title>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
You can run GitLab's rake tasks with <literal>gitlab-rake</literal>
|
|
|
|
which will be available on the system when GitLab is enabled. You
|
|
|
|
will have to run the command as the user that you configured to run
|
|
|
|
GitLab with.
|
|
|
|
</para>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
A list of all availabe rake tasks can be obtained by running:
|
2019-06-17 12:25:50 +01:00
|
|
|
<screen>
|
|
|
|
<prompt>$ </prompt>sudo -u git -H gitlab-rake -T
|
|
|
|
</screen>
|
2021-02-25 12:48:33 +00:00
|
|
|
</para>
|
|
|
|
</section>
|
2018-09-30 01:51:11 +01:00
|
|
|
</section>
|
2016-02-26 07:31:58 +00:00
|
|
|
</chapter>
|