gitlab module: split up gitlab-runner script

The name gitlab-runner clashes with a component of Gitlab CI with the
same name and only confuses people. It's now called gitlab-bundle and
a convenience-script gitlab-rake for easier invocation of rake tasks
was added. This was the primary use case of gitlab-runner.
This commit is contained in:
Franz Pletz 2016-08-04 02:08:26 +02:00
parent c39b6025d8
commit d8fd06641a
3 changed files with 23 additions and 16 deletions

View File

@ -42,10 +42,15 @@ following incompatible changes:</para>
</listitem> </listitem>
<listitem> <listitem>
<para>Redis now binds to 127.0.0.1 only instead of listening to all network interfaces. This is the default <para>Redis now binds to 127.0.0.1 only instead of listening to all network interfaces. This is the default
behavior of Redis 3.2</para> behavior of Redis 3.2</para>
</listitem> </listitem>
<listitem>
<para>Gitlab's maintainence script gitlab-runner was removed and split up into the more clearer
gitlab-run and gitlab-rake scripts because gitlab-runner is a component of Gitlab CI.</para>
</listitem>
</itemizedlist> </itemizedlist>

View File

@ -106,20 +106,22 @@ let
unicornConfig = builtins.readFile ./defaultUnicornConfig.rb; unicornConfig = builtins.readFile ./defaultUnicornConfig.rb;
gitlab-runner = pkgs.stdenv.mkDerivation rec { gitlab-rake = pkgs.stdenv.mkDerivation rec {
name = "gitlab-runner"; name = "gitlab-rake";
buildInputs = [ cfg.packages.gitlab cfg.packages.gitlab.env pkgs.makeWrapper ]; buildInputs = [ cfg.packages.gitlab cfg.packages.gitlab.env pkgs.makeWrapper ];
phases = "installPhase fixupPhase"; phases = "installPhase fixupPhase";
buildPhase = ""; buildPhase = "";
installPhase = '' installPhase = ''
mkdir -p $out/bin mkdir -p $out/bin
makeWrapper ${cfg.packages.gitlab.env}/bin/bundle $out/bin/gitlab-runner \ makeWrapper ${cfg.packages.gitlab.env}/bin/bundle $out/bin/gitlab-bundle \
${concatStrings (mapAttrsToList (name: value: "--set ${name} '${value}' ") gitlabEnv)} \ ${concatStrings (mapAttrsToList (name: value: "--set ${name} '${value}' ") gitlabEnv)} \
--set GITLAB_CONFIG_PATH '${cfg.statePath}/config' \ --set GITLAB_CONFIG_PATH '${cfg.statePath}/config' \
--set PATH '${pkgs.nodejs}/bin:${pkgs.gzip}/bin:${config.services.postgresql.package}/bin:$PATH' \ --set PATH '${pkgs.nodejs}/bin:${pkgs.gzip}/bin:${config.services.postgresql.package}/bin:$PATH' \
--set RAKEOPT '-f ${cfg.packages.gitlab}/share/gitlab/Rakefile' \ --set RAKEOPT '-f ${cfg.packages.gitlab}/share/gitlab/Rakefile' \
--run 'cd ${cfg.packages.gitlab}/share/gitlab' --run 'cd ${cfg.packages.gitlab}/share/gitlab'
''; makeWrapper $out/bin/gitlab-bundle $out/bin/gitlab-rake \
--add-flags "exec rake"
'';
}; };
smtpSettings = pkgs.writeText "gitlab-smtp-settings.rb" '' smtpSettings = pkgs.writeText "gitlab-smtp-settings.rb" ''
@ -331,7 +333,7 @@ in {
config = mkIf cfg.enable { config = mkIf cfg.enable {
environment.systemPackages = [ pkgs.git gitlab-runner cfg.packages.gitlab-shell ]; environment.systemPackages = [ pkgs.git gitlab-rake cfg.packages.gitlab-shell ];
assertions = [ assertions = [
{ assertion = cfg.databasePassword != ""; { assertion = cfg.databasePassword != "";
@ -480,14 +482,14 @@ in {
touch "${cfg.statePath}/db-created" touch "${cfg.statePath}/db-created"
# The gitlab:setup task is horribly broken somehow, these two tasks will do the same for setting up the initial database # The gitlab:setup task is horribly broken somehow, these two tasks will do the same for setting up the initial database
${gitlab-runner}/bin/gitlab-runner exec rake db:migrate RAILS_ENV=production ${gitlab-rake}/bin/gitlab-rake db:migrate RAILS_ENV=production
${gitlab-runner}/bin/gitlab-runner exec rake db:seed_fu RAILS_ENV=production \ ${gitlab-rake}/bin/gitlab-rake db:seed_fu RAILS_ENV=production \
GITLAB_ROOT_PASSWORD="${cfg.initialRootPassword}" GITLAB_ROOT_EMAIL="${cfg.initialRootEmail}"; GITLAB_ROOT_PASSWORD="${cfg.initialRootPassword}" GITLAB_ROOT_EMAIL="${cfg.initialRootEmail}";
fi fi
fi fi
# Always do the db migrations just to be sure the database is up-to-date # Always do the db migrations just to be sure the database is up-to-date
${gitlab-runner}/bin/gitlab-runner exec rake db:migrate RAILS_ENV=production ${gitlab-rake}/bin/gitlab-rake db:migrate RAILS_ENV=production
# Change permissions in the last step because some of the # Change permissions in the last step because some of the
# intermediary scripts like to create directories as root. # intermediary scripts like to create directories as root.

View File

@ -80,21 +80,21 @@ options for the <literal>services.gitlab</literal> module.</para>
<section><title>Maintenance</title> <section><title>Maintenance</title>
<para>You can run all Gitlab related commands like rake tasks with <para>You can run Gitlab's rake tasks with <literal>gitlab-rake</literal>
<literal>gitlab-runner</literal> which will be available on the system which will be available on the system when gitlab is enabled. You will
when gitlab is enabled. You will have to run the commands as the user that have to run the command as the user that you configured to run gitlab
you configured to run gitlab.</para> with.</para>
<para>For instance, to backup a Gitlab instance: <para>For example, to backup a Gitlab instance:
<programlisting> <programlisting>
$ sudo -u git -H gitlab-runner exec rake gitlab:backup:create $ sudo -u git -H gitlab-rake gitlab:backup:create
</programlisting> </programlisting>
A list of all availabe rake tasks can be obtained by running: A list of all availabe rake tasks can be obtained by running:
<programlisting> <programlisting>
$ sudo -u git -H gitlab-runner exec rake -T $ sudo -u git -H gitlab-rake -T
</programlisting> </programlisting>
</para> </para>