1
+ #! /bin/bash -ex
2
+ docker run --name gitlab-postgresql -d \
3
+ --env ' DB_NAME=gitlabhq_production' \
4
+ --env ' DB_USER=gitlab' --env ' DB_PASS=password' \
5
+ --env ' DB_EXTENSION=pg_trgm,btree_gist' \
6
+ --volume /srv/docker/gitlab/postgresql:/var/lib/postgresql \
7
+ sameersbn/postgresql:14-20230628
8
+ docker run --name gitlab-redis -d \
9
+ --volume /srv/docker/gitlab/redis:/data \
10
+ redis:6.2
11
+ docker run --name gitlab \
12
+ --link gitlab-postgresql:postgresql --link gitlab-redis:redisio \
13
+ --publish 10022:22 --publish 10080:80 \
14
+ --env ' GITLAB_PORT=10080' --env ' GITLAB_SSH_PORT=10022' \
15
+ --env ' GITLAB_SECRETS_DB_KEY_BASE=long-and-random-alpha-numeric-string' \
16
+ --env ' GITLAB_SECRETS_SECRET_KEY_BASE=long-and-random-alpha-numeric-string' \
17
+ --env ' GITLAB_SECRETS_OTP_KEY_BASE=long-and-random-alpha-numeric-string' \
18
+ --env OAUTH2_GENERIC_USTC_APP_ID=1234 \
19
+ --env OAUTH2_GENERIC_USTC_APP_SECRET=example \
20
+ --env ' OAUTH2_GENERIC_USTC_LABEL=example oauth' \
21
+ --env OAUTH2_GENERIC_USTC_CLIENT_SITE=https://example.com \
22
+ --env OAUTH2_GENERIC_USTC_CLIENT_USER_INFO_URL=/userinfo \
23
+ --env OAUTH2_GENERIC_USTC_CLIENT_AUTHORIZE_URL=/authorize \
24
+ --env OAUTH2_GENERIC_USTC_CLIENT_TOKEN_URL=/token \
25
+ --env OAUTH2_GENERIC_USTC_ID_PATH=gid \
26
+ --volume /srv/docker/gitlab/gitlab:/home/git/data \
27
+ " $IMAGE_NAME " :" $TAG " &
28
+ echo " Please wait 4 minutes..."
29
+ sleep 4m
30
+ url=" http://localhost:10080"
31
+ status_code=$( curl --write-out ' %{http_code}' --silent --output /dev/null " $url " )
32
+ # Check if the status code is not in the success range (200-299)
33
+ if [[ $status_code -lt 200 || $status_code -gt 299 ]]; then
34
+ echo " Error: Failed to access $url (status code: $status_code )"
35
+ exit 1
36
+ fi
37
+ ret=$( docker exec -it gitlab cat /home/git/gitlab/config/gitlab.yml | grep -c ' example oauth' )
38
+ if [[ $ret -ne 1 ]]; then
39
+ echo " Error: Failed to find 'example oauth' in gitlab.yml"
40
+ exit 1
41
+ fi
0 commit comments