Files
notes/tiddlywiki/gitlab with Docker (second edition).md
2026-03-12 22:01:38 +01:00

2.1 KiB
Executable File

In this example gitlab will be accessible through the public URL: http://code.databasepro.fr

As prerequisits:

  • A valid SSL certificate for the subdomain code.databasepro.fr was generated (using LetsEncrypt certbot)
  • a reverse-proxy was defined.

Examlple of nginx reverse-proxy configuration:

  server {
    listen 80;
    server_name code.databasepro.fr;
    access_log /wwwlogs/code.databasepro.fr.access.log combined;
    error_log /wwwlogs/code.databasepro.fr.error.log info;
    location / {
      root   /www/code.databasepro.fr;
      index  index.html index.htm;
      autoindex on;
    }
    rewrite ^ https://code.databasepro.fr$request_uri? permanent;
  }
 server {
    listen 443 ssl http2;
    ssl_certificate /etc/letsencrypt/live/code.databasepro.fr/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/code.databasepro.fr/privkey.pem;
    ssl_stapling on;
    server_name code.databasepro.fr;
    access_log /wwwlogs/code.databasepro.fr.access.log combined;
    error_log /wwwlogs/code.databasepro.fr.error.log info;
    location / {
      proxy_pass https://192.168.0.91:7004/;
    }
  }

Create persistent directories:

mkdir /app/persistent_docker/gitlab
cd /app/persistent_docker/gitlab
mkdir config data logs

Pull the Comunity Edition of gitlab:

docker pull gitlab/gitlab-ce 

Create docker-compose.yaml file in /app/persistent_docker/gitlab:

services:
  gitlab:
    image: 'gitlab/gitlab-ce:latest'
    restart: always
    hostname: 'code.databasepro.fr'
    environment:
      GITLAB_OMNIBUS_CONFIG: |
        external_url 'https://code.databasepro.fr'
        # add any other gitlab.rb configuration here, each on its own line
    ports:
      - 7004:443
    volumes:
      - /app/persistent_docker/gitlab/config:/etc/gitlab
      - /app/persistent_docker/gitlab/logs:/var/log/gitlab
      - /app/persistent_docker/gitlab/data:/var/opt/gitlab

Start container:

docker-compose up -d

Initial root password can be found in /app/persistent_docker/gitlab/config/initial_root_password