Gitlab-ci

From Gentoo Wiki
Jump to: navigation, search
Warning
The documentation as it stands is written from the point of view of some one who has GitLab running and wanted to include a continuous integration server a swell. Thus it may appear particular to one use case and not cover all situations.

Installation

There is an overlay for GitLab-CI this is available under the same overlay providing GitLab, namely the CVUT overlay. It is installed as follows

   emerge -a www-apps/gitlab-ci

This produces the following installation message. This indicates the creation of a group and user called `gitlab_ci`

    * Adding group 'gitlab_ci' to your system ...
    *  - Groupid: next available
    * Adding user 'gitlab_ci' to your system ...
    *  - Userid: 104
    *  - Shell: /sbin/nologin
    *  - Home: /opt/gitlab-ci-7.8
    *  - Groups: gitlab_ci
    *  - GECOS: added by portage for gitlab-ci
    *  - Creating /opt/gitlab-ci-7.8 in /

Once portage has done it's thing one is presented with the following information

    * If this is a new installation, proceed with the following steps:
    *
    *   1. Copy /etc/gitlab-ci-7.8/application.yml.example to /etc/gitlab-ci-7.8/application.yml
    *      and edit this file in order to configure your GitLab CI settings.
    *
    *   2. Copy /etc/gitlab-ci-7.8/database.yml.* to /etc/gitlab-ci-7.8/database.yml
    *      and edit this file in order to configure your database settings
    *      for "production" environment.
    *
    *   3. Copy /etc/gitlab-ci-7.8/unicorn.rb.example to /etc/gitlab-ci-7.8/unicorn.rb
    *      and edit this file in order to configure your GitLab CI settings.
    *
    *   4. (Optional) If you want use SMTP:
    *      Copy /etc/gitlab-ci-7.8/initializers/smtp_settings.rb.sample to /etc/gitlab-ci-7.8/initializers/smtp_settings.rb
    *      and edit this file in order to configure your SMTP settings.
    *
    *   5. If this is a new installation, create a database for your GitLab CI instance.
    *     If you have local PostgreSQL running, just copy&run:
    *         su postgres
    *         psql -c "CREATE ROLE gitlab_ci PASSWORD 'gitlab_ci' \
    *             NOSUPERUSER CREATEDB NOCREATEROLE INHERIT LOGIN;"
    *         createdb -E UTF-8 -O gitlab_ci gitlab_ci_production
    *     Note: You should change your password to something more random...
    *
    *     GitLab CI uses polymorphic associations which are not SQL-standard friendly.
    *     To get it work you must use this ugly workaround:
    *         psql -U postgres -d gitlab_ci
    *         CREATE CAST (integer AS text) WITH INOUT AS IMPLICIT;
    *
    *   6. Execute the following command to finalize your setup:
    *          emerge --config "=www-apps/gitlab-ci-7.8.4"
    *      Note: Do not forget to start Redis server.
    *
    * To update an existing instance, run the following command and choose upgrading when prompted:
    *     emerge --config "=www-apps/gitlab-ci-7.8.4"
    *


(The above listings are to assist with future documentation efforts.)

Gotchas

Paths

The initial emerge may fail if the folder /var/lib/gitlab_ci does not exist. Specifically this fails when gitlab tries to establish an SSH key.