Setup GitLab

Startup

Run in a docker container behind, Traefik:

docker run --rm -it
  --name gitlab
  --label 'traefik.enable=true'
  --label 'traefik.port=80'
  --label 'traefik.frontend.rule=Host: gitlab.example.com'
  --network traefik
  gitlab/gitlab-ce:12.1.4-ce.0
    gitlab.example.com:
        restart: always

        image: gitlab/gitlab-ce:12.1.4-ce.0

        environment:
            GITLAB_OMNIBUS_CONFIG: |
                letsencrypt['enable'] = false

                external_url 'https://gitlab.example.com/'
                nginx['enable'] = true
                nginx['listen_port'] = 80
                nginx['listen_https'] = false
                nginx['real_ip_trusted_addresses'] = [ '172.0.0.0/8' ]
                nginx['real_ip_header'] = 'X-Forwarded-For'

                grafana['enable'] = false
                gitlab_rails['lfs_enabled'] = true
                gitlab_rails['gitlab_shell_ssh_port'] = 2022;

        ports:
            - 2022:22/tcp

        labels:
            traefik.enable: 'true'
            traefik.port: '80'
            traefik.frontend.rule: 'Host: gitlab.example.com'

        networks:
            - traefik

Warning

It takes quite a while to startup, watch with docker logs -f gitlab.

Warning

If you haven't already, you will probably want to configure Docker's log rotation.

Setup User Accounts

  1. Visit gitlab.example.com, and provide a root password.
  2. Login as root.
  3. Disable account sign-up:
    • Click the spanner icon (top, middle) to access the "Admin Area"
    • Navigate to "Settings" → "General" → "Sign-up rescrictions"
    • Disable sign-up
    • Save
  4. Alter the root account for you.

Important Notes

Some file locations, you'll probably want to mounte these as volumes:

  • /var/opt/gitlab/git-data/repositories/
    • Git repositories are stored here, probably under ./@hashed/...
    • The repository's name / path can be found in ./@hashed/*/*/*.git/config
  • /var/opt/gitlab/gitlab-rails/uploads/
    • Uploaded files are stored here, probably under ./@hashed/...
    • The file's original name is available at the bottom of the tree.
  • /etc/gitlab/
    • Configuration, SSH host keys, etc...
  • /var/log/gitlab/
    • Logs
  • /var/opt/gitlab/
    • Runtime data (databases, etc...)

See Also