2026-03-12 21:01:38
This commit is contained in:
156
tiddlywiki/gitlab with Docker.md
Executable file
156
tiddlywiki/gitlab with Docker.md
Executable file
@@ -0,0 +1,156 @@
|
||||
Get Docker image
|
||||
----------------
|
||||
```
|
||||
docker pull gitlab/gitlab-ee
|
||||
```
|
||||
|
||||
Prepare persistent directories
|
||||
------------------------------
|
||||
```
|
||||
mkdir /app/appsdocker/gitlab
|
||||
cd /app/appsdocker/gitlab
|
||||
mkdir config data logs
|
||||
```
|
||||
|
||||
Run the container
|
||||
-----------------
|
||||
Let's run Gitlab in `gitlab.databasepro.eu` in HTTP mode:
|
||||
```
|
||||
export GITLAB_HOME=/app/appsdocker/gitlab
|
||||
docker run --detach \
|
||||
--hostname gitlab.databasepro.eu \
|
||||
--publish 7001:80 \
|
||||
--name gitlab \
|
||||
--restart always \
|
||||
--volume $GITLAB_HOME/config:/etc/gitlab \
|
||||
--volume $GITLAB_HOME/logs:/var/log/gitlab \
|
||||
--volume $GITLAB_HOME/data:/var/opt/gitlab \
|
||||
gitlab/gitlab-ee:latest
|
||||
```
|
||||
|
||||
Supposing that `ossus` is the Docker host name, and in the router NAT we have mapped external port `80` to internal `ossus:7001`, on reverse proxy we will have:
|
||||
```
|
||||
<VirtualHost *:80>
|
||||
ServerName gitlab.databasepro.eu
|
||||
|
||||
ServerAdmin admin@gitlab.databasepro.eu
|
||||
DocumentRoot /usr/local/apache2/wwwroot/gitlab
|
||||
|
||||
<Directory "/usr/local/apache2/wwwroot/gitlab">
|
||||
Order allow,deny
|
||||
AllowOverride All
|
||||
Allow from all
|
||||
Require all granted
|
||||
</Directory>
|
||||
|
||||
ErrorLog logs/gitlab-error.log
|
||||
CustomLog logs/gitlab-access.log combined
|
||||
|
||||
ProxyPass / http://ossus:7001/
|
||||
ProxyPassReverse / http://ossus:7001/
|
||||
</VirtualHost>
|
||||
```
|
||||
|
||||
Run Gitlab in HTTPS
|
||||
-------------------
|
||||
|
||||
Configure `external_url "https://gitlab.databasepro.eu"` in `/app/appsdocker/gitlab/config/gitlab.rb`:
|
||||
```
|
||||
external_url 'https://gitlab.databasepro.eu'
|
||||
```
|
||||
|
||||
> Using external created letsencrypt certificate caused loop reboot of the container after host restart.
|
||||
The sollution was to set also:
|
||||
```
|
||||
letsencrypt['enable'] = false
|
||||
```
|
||||
>
|
||||
|
||||
Stop, remove and restart the container:
|
||||
```
|
||||
export GITLAB_HOME=/app/appsdocker/gitlab
|
||||
docker run --detach \
|
||||
--hostname gitlab.databasepro.eu \
|
||||
--publish 7004:443 \
|
||||
--name gitlab \
|
||||
--restart always \
|
||||
--volume $GITLAB_HOME/config:/etc/gitlab \
|
||||
--volume $GITLAB_HOME/logs:/var/log/gitlab \
|
||||
--volume $GITLAB_HOME/data:/var/opt/gitlab \
|
||||
gitlab/gitlab-ee:latest
|
||||
```
|
||||
Map in NAT external port `443` to internal `ossus` HTTPD port and update `gitlab.conf`:
|
||||
```
|
||||
<VirtualHost *:80>
|
||||
ServerName gitlab.databasepro.eu
|
||||
|
||||
ServerAdmin admin@gitlab.databasepro.eu
|
||||
DocumentRoot /usr/local/apache2/wwwroot/gitlab
|
||||
|
||||
<Directory "/usr/local/apache2/wwwroot/gitlab">
|
||||
Order allow,deny
|
||||
AllowOverride All
|
||||
Allow from all
|
||||
Require all granted
|
||||
</Directory>
|
||||
|
||||
ErrorLog logs/gitlab-error.log
|
||||
CustomLog logs/gitlab-access.log combined
|
||||
|
||||
ProxyPass / http://ossus:7001/
|
||||
ProxyPassReverse / http://ossus:7001/
|
||||
</VirtualHost>
|
||||
|
||||
<VirtualHost *:443>
|
||||
ServerName gitlab.databasepro.eu
|
||||
|
||||
ServerAdmin admin@gitlab.databasepro.eu
|
||||
DocumentRoot /usr/local/apache2/wwwroot/gitlab
|
||||
|
||||
<Directory "/usr/local/apache2/wwwroot/gitlab">
|
||||
Order allow,deny
|
||||
AllowOverride All
|
||||
Allow from all
|
||||
Require all granted
|
||||
</Directory>
|
||||
|
||||
SSLEngine On
|
||||
SSLProxyEngine On
|
||||
|
||||
# Disable SSLProxyCheck
|
||||
SSLProxyCheckPeerCN Off
|
||||
SSLProxyCheckPeerName Off
|
||||
SSLProxyVerify none
|
||||
|
||||
ErrorLog logs/gitlab-error.log
|
||||
CustomLog logs/gitlab-access.log combined
|
||||
|
||||
SSLCertificateFile "/etc/letsencrypt/live/gitlab.databasepro.eu/fullchain.pem"
|
||||
SSLCertificateKeyFile "/etc/letsencrypt/live/gitlab.databasepro.eu/privkey.pem"
|
||||
|
||||
ProxyPass / https://ossus:7004/
|
||||
ProxyPassReverse / https://ossus:7004/
|
||||
</VirtualHost>
|
||||
```
|
||||
Optionally using docker-compose
|
||||
-------------------------------
|
||||
`docker-compose.yaml` file:
|
||||
```
|
||||
gitlab:
|
||||
image: 'gitlab/gitlab-ee:latest'
|
||||
restart: always
|
||||
hostname: 'code.databasepro.eu'
|
||||
environment:
|
||||
GITLAB_OMNIBUS_CONFIG: |
|
||||
external_url 'https://code.databasepro.eu'
|
||||
# Add any other gitlab.rb configuration here, each on its own line
|
||||
ports:
|
||||
- 7004:443
|
||||
volumes:
|
||||
- /app/appsdocker/gitlab/config:/etc/gitlab
|
||||
- /app/appsdocker/gitlab/logs:/var/log/gitlab
|
||||
- /app/appsdocker/gitlab/data:/var/opt/gitlab
|
||||
```
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user