2016-02-26 08:31:58 +01: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">
|
|
|
|
|
|
|
|
<title>Gitlab</title>
|
|
|
|
|
|
|
|
<para>Gitlab is a feature-rich git hosting service.</para>
|
|
|
|
|
|
|
|
<section><title>Prerequisites</title>
|
|
|
|
|
|
|
|
<para>The gitlab service exposes only an Unix socket at
|
|
|
|
<literal>/run/gitlab/gitlab-workhorse.socket</literal>. You need to configure a
|
|
|
|
webserver to proxy HTTP requests to the socket.</para>
|
|
|
|
|
2016-08-04 02:23:08 +02:00
|
|
|
<para>For instance, the following configuration could be used to use nginx as
|
|
|
|
frontend proxy:
|
2016-02-26 08:31:58 +01:00
|
|
|
|
|
|
|
<programlisting>
|
2016-08-04 02:23:08 +02:00
|
|
|
services.nginx = {
|
|
|
|
enable = true;
|
|
|
|
recommendedGzipSettings = true;
|
|
|
|
recommendedOptimisation = true;
|
|
|
|
recommendedProxySettings = true;
|
|
|
|
recommendedTlsSettings = true;
|
|
|
|
virtualHosts."git.example.com" = {
|
|
|
|
enableACME = true;
|
|
|
|
forceSSL = true;
|
|
|
|
locations."/".proxyPass = "http://unix:/run/gitlab/gitlab-workhorse.socket";
|
|
|
|
};
|
|
|
|
};
|
2016-02-26 08:31:58 +01:00
|
|
|
'';
|
|
|
|
</programlisting>
|
|
|
|
</para>
|
|
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
<section><title>Configuring</title>
|
|
|
|
|
|
|
|
<para>Gitlab depends on both PostgreSQL and Redis and will automatically enable
|
|
|
|
both services. In the case of PostgreSQL, a database and a role will be created.
|
|
|
|
</para>
|
|
|
|
|
2016-08-04 02:23:08 +02:00
|
|
|
<para>The default state dir is <literal>/var/gitlab/state</literal>. This is where
|
|
|
|
all data like the repositories and uploads will be stored.</para>
|
2016-02-26 08:31:58 +01:00
|
|
|
|
2016-08-04 02:23:08 +02:00
|
|
|
<para>A basic configuration with some custom settings could look like this:
|
2016-02-26 08:31:58 +01:00
|
|
|
|
|
|
|
<programlisting>
|
|
|
|
services.gitlab = {
|
|
|
|
enable = true;
|
|
|
|
databasePassword = "eXaMpl3";
|
|
|
|
initialRootPassword = "UseNixOS!";
|
|
|
|
https = true;
|
|
|
|
host = "git.example.com";
|
|
|
|
port = 443;
|
|
|
|
user = "git";
|
|
|
|
group = "git";
|
2016-08-04 02:23:08 +02:00
|
|
|
smtp = {
|
|
|
|
enable = true;
|
|
|
|
address = "localhost";
|
|
|
|
port = 25;
|
|
|
|
};
|
2016-02-26 08:31:58 +01:00
|
|
|
extraConfig = {
|
|
|
|
gitlab = {
|
2016-08-04 02:23:08 +02:00
|
|
|
email_from = "gitlab-no-reply@example.com";
|
|
|
|
email_display_name = "Example GitLab";
|
|
|
|
email_reply_to = "gitlab-no-reply@example.com";
|
2016-02-26 08:31:58 +01:00
|
|
|
default_projects_features = { builds = false; };
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
</programlisting>
|
|
|
|
</para>
|
|
|
|
|
|
|
|
<para>Refer to <xref linkend="ch-options" /> for all available configuration
|
|
|
|
options for the <literal>services.gitlab</literal> module.</para>
|
|
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
<section><title>Maintenance</title>
|
|
|
|
|
2016-08-04 02:08:26 +02:00
|
|
|
<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>
|
2016-02-26 08:31:58 +01:00
|
|
|
|
2016-08-04 02:08:26 +02:00
|
|
|
<para>For example, to backup a Gitlab instance:
|
2016-02-26 08:31:58 +01:00
|
|
|
|
|
|
|
<programlisting>
|
2016-08-04 02:08:26 +02:00
|
|
|
$ sudo -u git -H gitlab-rake gitlab:backup:create
|
2016-02-26 08:31:58 +01:00
|
|
|
</programlisting>
|
|
|
|
|
|
|
|
A list of all availabe rake tasks can be obtained by running:
|
|
|
|
|
|
|
|
<programlisting>
|
2016-08-04 02:08:26 +02:00
|
|
|
$ sudo -u git -H gitlab-rake -T
|
2016-02-26 08:31:58 +01:00
|
|
|
</programlisting>
|
|
|
|
</para>
|
|
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
</chapter>
|