mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-14 16:46:09 +00:00
151 lines
7.1 KiB
XML
151 lines
7.1 KiB
XML
<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 xml:id="module-services-gitlab-prerequisites">
|
|
<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>
|
|
|
|
<para>
|
|
For instance, the following configuration could be used to use nginx as
|
|
frontend proxy:
|
|
<programlisting>
|
|
<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";
|
|
};
|
|
};
|
|
</programlisting>
|
|
</para>
|
|
</section>
|
|
<section xml:id="module-services-gitlab-configuring">
|
|
<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>
|
|
|
|
<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>
|
|
|
|
<para>
|
|
A basic configuration with some custom settings could look like this:
|
|
<programlisting>
|
|
services.gitlab = {
|
|
<link linkend="opt-services.gitlab.enable">enable</link> = true;
|
|
<link linkend="opt-services.gitlab.databasePassword">databasePassword</link> = "eXaMpl3";
|
|
<link linkend="opt-services.gitlab.initialRootPassword">initialRootPassword</link> = "UseNixOS!";
|
|
<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";
|
|
smtp = {
|
|
<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;
|
|
};
|
|
secrets = {
|
|
<link linkend="opt-services.gitlab.secrets.db">db</link> = "uPgq1gtwwHiatiuE0YHqbGa5lEIXH7fMsvuTNgdzJi8P0Dg12gibTzBQbq5LT7PNzcc3BP9P1snHVnduqtGF43PgrQtU7XL93ts6gqe9CBNhjtaqUwutQUDkygP5NrV6";
|
|
<link linkend="opt-services.gitlab.secrets.secret">secret</link> = "devzJ0Tz0POiDBlrpWmcsjjrLaltyiAdS8TtgT9YNBOoUcDsfppiY3IXZjMVtKgXrFImIennFGOpPN8IkP8ATXpRgDD5rxVnKuTTwYQaci2NtaV1XxOQGjdIE50VGsR3";
|
|
<link linkend="opt-services.gitlab.secrets.otp">otp</link> = "e1GATJVuS2sUh7jxiPzZPre4qtzGGaS22FR50Xs1TerRVdgI3CBVUi5XYtQ38W4xFeS4mDq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1lk7zH8ezr9BMCgYEA0gfk
|
|
EhgcmPH8Z5cU3YYwOdt6HSJOM0OyN4k/5gnkv+HYVoJTj02gkrJmLr+mi1ugKj46
|
|
7huYO9TVnrKP21tmbaSv1dp5hS3letVRIxSloEtVGXmmdvJvBRzDWos+G+KcvADi
|
|
fFCz6w8v9NmO40CB7y/3SxTmSiSxDQeoi9LhDBkCgYEAsPgMWm25sfOnkY2NNUIv
|
|
wT8bAlHlHQT2d8zx5H9NttBpR3P0ShJhuF8N0sNthSQ7ULrIN5YGHYcUH+DyLAWU
|
|
TuomP3/kfa+xL7vUYb269tdJEYs4AkoppxBySoz8qenqpz422D0G8M6TpIS5Y5Qi
|
|
GMrQ6uLl21YnlpiCaFOfSQMCgYEAmZxj1kgEQmhZrnn1LL/D7czz1vMMNrpAUhXz
|
|
wg9iWmSXkU3oR1sDIceQrIhHCo2M6thwyU0tXjUft93pEQocM/zLDaGoVxtmRxxV
|
|
J08mg8IVD3jFoyFUyWxsBIDqgAKRl38eJsXvkO+ep3mm49Z+Ma3nM+apN3j2dQ0w
|
|
3HLzXaECgYBFLMEAboVFwi5+MZjGvqtpg2PVTisfuJy2eYnPwHs+AXUgi/xRNFjI
|
|
YHEa7UBPb5TEPSzWImQpETi2P5ywcUYL1EbN/nqPWmjFnat8wVmJtV4sUpJhubF4
|
|
Vqm9LxIWc1uQ1q1HDCejRIxIN3aSH+wgRS3Kcj8kCTIoXd1aERb04g==
|
|
-----END RSA PRIVATE KEY-----
|
|
'';
|
|
};
|
|
<link linkend="opt-services.gitlab.extraConfig">extraConfig</link> = {
|
|
gitlab = {
|
|
email_from = "gitlab-no-reply@example.com";
|
|
email_display_name = "Example GitLab";
|
|
email_reply_to = "gitlab-no-reply@example.com";
|
|
default_projects_features = { builds = false; };
|
|
};
|
|
};
|
|
};
|
|
</programlisting>
|
|
</para>
|
|
|
|
<para>
|
|
If you're setting up a new Gitlab instance, generate new secrets. You for
|
|
instance use <literal>tr -dc A-Za-z0-9 < /dev/urandom | head -c
|
|
128</literal> to generate a new secret. Gitlab encrypts sensitive data
|
|
stored in the database. If you're restoring an existing Gitlab instance, you
|
|
must specify the secrets secret from <literal>config/secrets.yml</literal>
|
|
located in your Gitlab state folder.
|
|
</para>
|
|
|
|
<para>
|
|
Refer to <xref linkend="ch-options" /> for all available configuration
|
|
options for the
|
|
<link linkend="opt-services.gitlab.enable">services.gitlab</link> module.
|
|
</para>
|
|
</section>
|
|
<section xml:id="module-services-gitlab-maintenance">
|
|
<title>Maintenance</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>
|
|
For example, to backup a Gitlab instance:
|
|
<screen>
|
|
<prompt>$ </prompt>sudo -u git -H gitlab-rake gitlab:backup:create
|
|
</screen>
|
|
A list of all availabe rake tasks can be obtained by running:
|
|
<screen>
|
|
<prompt>$ </prompt>sudo -u git -H gitlab-rake -T
|
|
</screen>
|
|
</para>
|
|
</section>
|
|
</chapter>
|