Skip to content

Commit d244882

Browse files
Sven DowideitDowideit, Sven (O&A, St. Lucia)
Sven Dowideit
authored and
Dowideit, Sven (O&A, St. Lucia)
committed
Add Docker Swarm config file, and Swar&compose config file support
Signed-off-by: Sven Dowideit <sven.dowideit@csiro.au>
1 parent 7e35505 commit d244882

File tree

3 files changed

+60
-2
lines changed

3 files changed

+60
-2
lines changed

README.md

+39-1
Original file line numberDiff line numberDiff line change
@@ -803,7 +803,8 @@ These options should contain something like:
803803

804804
### Available Configuration Parameters
805805

806-
*Please refer the docker run command options for the `--env-file` flag where you can specify all required environment variables in a single file. This will save you from writing a potentially long docker run command. Alternatively you can use docker-compose.*
806+
*Please refer the docker run command options for the `--env-file` flag where you can specify all required environment variables in a single file. This will save you from writing a potentially long docker run command. Alternatively you can use docker-compose. docker-compose users and Docker Swarm mode users can also use the [secrets and config file options](#docker-secrets-and-configs)*
807+
807808

808809
Below is the complete list of available options that can be used to customize your gitlab installation.
809810

@@ -1044,6 +1045,43 @@ Below is the complete list of available options that can be used to customize yo
10441045
| `RACK_ATTACK_BANTIME` | Number of seconds an IP should be banned after too many auth attempts. Defaults to `3600`. |
10451046
| `GITLAB_WORKHORSE_TIMEOUT` | Timeout for gitlab workhorse http proxy. Defaults to `5m0s`. |
10461047

1048+
### Docker secrets and configs
1049+
1050+
All the above environment variables can be put into a [secrets](https://docs.docker.com/compose/compose-file/#secrets) or [config](https://docs.docker.com/compose/compose-file/#configs) file
1051+
and then both docker-compose and Docker Swarm can import them into your gitlab container.
1052+
1053+
On startup, the gitlab container will source env vars from a config file named `gitlab-config`, and then a secrets file named `gitlab-secrets` (both mounted in the default locations).
1054+
1055+
To modify your existing `docker-compose.yml` file, add the following to your gitlab service:
1056+
1057+
> Note: you also need to change the docker-compose file version `version: "3.4"`.
1058+
1059+
```
1060+
services:
1061+
gitlab:
1062+
1063+
...
1064+
1065+
configs:
1066+
- gitlab-configs
1067+
secrets:
1068+
- gitlab-secrets
1069+
```
1070+
1071+
And then define those secrets and configs:
1072+
1073+
```
1074+
configs:
1075+
gitlab-configs:
1076+
file: ./gitlab.configs
1077+
1078+
secrets:
1079+
gitlab-secrets:
1080+
file: ./gitlab.secrets
1081+
```
1082+
1083+
If you're not using one of these files, then don't include its entry in the docker-compose file.
1084+
10471085
# Maintenance
10481086

10491087
## Creating backups

assets/runtime/functions

+8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
#!/bin/bash
22
set -e
3+
4+
for file in /gitlab-configs /run/secrets/gitlab-secrets; do
5+
if [[ -e "$file" ]]; then
6+
echo "Loading $file"
7+
source "$file"
8+
fi
9+
done
10+
echo "Loading ${GITLAB_RUNTIME_DIR}/env-defaults"
311
source ${GITLAB_RUNTIME_DIR}/env-defaults
412

513
SYSCONF_TEMPLATES_DIR="${GITLAB_RUNTIME_DIR}/config"

docker-compose.yml

+13-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: '2'
1+
version: '3.4'
22

33
services:
44
redis:
@@ -31,6 +31,10 @@ services:
3131
- "10022:22"
3232
volumes:
3333
- /srv/docker/gitlab/gitlab:/home/git/data:Z
34+
#configs:
35+
# - gitlab-configs
36+
#secrets:
37+
# - gitlab-secrets
3438
environment:
3539
- DEBUG=false
3640

@@ -148,3 +152,11 @@ services:
148152
- OAUTH_AZURE_API_KEY=
149153
- OAUTH_AZURE_API_SECRET=
150154
- OAUTH_AZURE_TENANT_ID=
155+
156+
#configs:
157+
# gitlab-configs:
158+
# file: ./gitlab.configs
159+
#
160+
#secrets:
161+
# gitlab-secrets:
162+
# file: ./gitlab.secrets

0 commit comments

Comments
 (0)