meta data for this page
  •  

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
linux:debian:docker [2026/06/08 22:14] – removed - external edit (Unknown date) 127.0.0.1linux:debian:docker [2026/06/08 22:14] (current) – ↷ Page moved from os:linux:debian:docker to linux:debian:docker kilroy
Line 1: Line 1:
 +===== Gitlab =====
 +==== Configure gitlab docker container on apache2 subdomain with ssl ====
  
 +<code bash>
 +# Install everything:
 +apt-get install docker docker-compose python-certbot python-certbot-apache
 +</code>
 +
 +<file yml docker-compose.yml>
 +web:
 +  image: 'gitlab/gitlab-ce:latest'
 +  restart: always
 +  hostname: 'gitlab.hostname.de'
 +  environment:
 +    GITLAB_OMNIBUS_CONFIG: |
 +      external_url 'https://gitlab.hostname.de:8443'
 +      # Add any other gitlab.rb configuration here, each on its own line
 +  ports:
 +    - '8443:8443'
 +    - '22:22'
 +  volumes:
 +    - '/srv/gitlab/config:/etc/gitlab'
 +    - '/srv/gitlab/logs:/var/log/gitlab'
 +    - '/srv/gitlab/data:/var/opt/gitlab'
 +</file>
 +
 +<code bash>
 +# launch container:
 +docker-compose up
 +
 +# install certificate and add subdomain
 +certbot --apache
 +certbot certonly --apache --expand -d hostname.de -d gitlab.hostname.de
 +
 +# rework and copy certificate into gitlab data storage:
 +cd /etc/letsencrypt/live/hostname.de
 +cat cert.pem fullchain.crt > gitlab.hostname.de.crt  
 +cp privkey.pem gitlab.hostname.de.key  
 +mv gitlab.* /srv/gitlab/config/ssl
 +
 +
 +</code>
 +
 +<file bash apache-default.conf>
 +<VirtualHost _default_:80>
 +    ServerName unknown
 +    Redirect 200 /
 +    ErrorDocument 200 "No such site."
 +</VirtualHost>
 +
 +<IfModule mod_ssl.c>
 +<VirtualHost *:443>
 +        ServerName hostname.de
 +        ServerAdmin webmaster@hostname.de
 +
 +        # whatever you want apache to do 
 +
 +        #Include conf-available/serve-cgi-bin.conf
 +        SSLCertificateFile /etc/letsencrypt/live/lieblichknuffeltal.de/fullchain.pem
 +        SSLCertificateKeyFile /etc/letsencrypt/live/lieblichknuffeltal.de/privkey.pem
 +        Include /etc/letsencrypt/options-ssl-apache.conf
 +
 +</VirtualHost>
 +</IfModule>
 +
 +# force ssl
 +<VirtualHost *:80>
 +    ServerName hostname.de
 +    ServerAdmin webmaster@hostname.de
 +
 +    RewriteEngine on
 +    RewriteCond %{SERVER_NAME} =hostname.de
 +    RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,QSA,R=permanent]
 +
 +</VirtualHost>
 +
 +</file>
 +
 +<file bash gitlab.conf>
 +# this is probably redundant
 +<VirtualHost *:80>
 +  ServerName gitlab.hostname.de
 +
 +  RewriteEngine On
 +  RewriteCond %{HTTP_HOST} ^(.+)\.hostname\.de$
 +  RewriteRule ^(.*)$ https://%1.hostname.de/$1 [R=302,L]
 +</VirtualHost>
 +
 +<VirtualHost *:443>
 +    ServerName gitlab.hostname.de
 +    redirect / https://gitlab.hostname.de:8443/
 +
 +    SSLCertificateFile /etc/letsencrypt/live/hostname.de/fullchain.pem
 +    SSLCertificateKeyFile /etc/letsencrypt/live/hostname.de/privkey.pem
 +    Include /etc/letsencrypt/options-ssl-apache.conf
 +
 +</VirtualHost>
 +</conf>
 +</file>