-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
249 lines (231 loc) · 8.23 KB
/
docker-compose.yml
File metadata and controls
249 lines (231 loc) · 8.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
services:
tests:
build:
context: .
volumes:
- ./src:/usr/local/src/src
- ./tests:/usr/local/src/tests
- ./phpunit.xml:/usr/local/src/phpunit.xml
- gitea-data:/data:ro
- forgejo-data:/forgejo-data:ro
- gogs-data:/gogs-data:ro
- gitlab-data:/gitlab-data:ro
environment:
- TESTS_GITHUB_PRIVATE_KEY
- TESTS_GITHUB_APP_IDENTIFIER
- TESTS_GITHUB_INSTALLATION_ID
- TESTS_GITEA_URL=http://gitea:3000
- TESTS_GITEA_REQUEST_CATCHER_URL=http://request-catcher:5000
- TESTS_FORGEJO_URL=http://forgejo:3000
- TESTS_GOGS_URL=http://gogs:3000
- TESTS_GITLAB_URL=http://gitlab:80
depends_on:
gitea:
condition: service_healthy
gitea-bootstrap:
condition: service_completed_successfully
forgejo:
condition: service_healthy
forgejo-bootstrap:
condition: service_completed_successfully
gogs:
condition: service_healthy
gogs-bootstrap:
condition: service_completed_successfully
gitlab:
condition: service_healthy
gitlab-bootstrap:
condition: service_completed_successfully
request-catcher:
condition: service_started
gitea:
image: gitea/gitea:1.21.5
environment:
- USER_UID=1000
- USER_GID=1000
- GITEA__database__DB_TYPE=sqlite3
- GITEA__security__INSTALL_LOCK=true
- GITEA__webhook__ALLOWED_HOST_LIST=*
- GITEA__webhook__SKIP_TLS_VERIFY=true
- GITEA__webhook__DELIVER_TIMEOUT=10
- GITEA__server__LOCAL_ROOT_URL=http://gitea:3000/
ports:
- "3000:3000"
volumes:
- gitea-data:/data
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3000/api/healthz"]
interval: 10s
timeout: 5s
retries: 10
start_period: 10s
gitea-bootstrap:
image: gitea/gitea:1.21.5
volumes:
- gitea-data:/data
depends_on:
gitea:
condition: service_healthy
entrypoint: /bin/sh
environment:
- GITEA_ADMIN_USERNAME=${GITEA_ADMIN_USERNAME:-utopia}
- GITEA_ADMIN_PASSWORD=${GITEA_ADMIN_PASSWORD:-password}
- GITEA_ADMIN_EMAIL=${GITEA_ADMIN_EMAIL:-utopia@example.com}
command: >
-c "
su git -c \"gitea admin user create --username $$GITEA_ADMIN_USERNAME --password $$GITEA_ADMIN_PASSWORD --email $$GITEA_ADMIN_EMAIL --admin --must-change-password=false\" || true &&
if [ ! -f /data/gitea/token.txt ]; then
TOKEN=$$(su git -c \"gitea admin user generate-access-token --username $$GITEA_ADMIN_USERNAME --token-name $$GITEA_ADMIN_USERNAME-token --scopes all --raw\") &&
echo $$TOKEN > /data/gitea/token.txt;
fi
"
request-catcher:
image: appwrite/requestcatcher:1.1.0
ports:
- "5000:5000"
forgejo:
image: codeberg.org/forgejo/forgejo:9
environment:
- USER_UID=1000
- USER_GID=1000
- FORGEJO__database__DB_TYPE=sqlite3
- FORGEJO__security__INSTALL_LOCK=true
- FORGEJO__webhook__ALLOWED_HOST_LIST=*
- FORGEJO__webhook__SKIP_TLS_VERIFY=true
- FORGEJO__webhook__DELIVER_TIMEOUT=10
- FORGEJO__server__LOCAL_ROOT_URL=http://forgejo:3000/
volumes:
- forgejo-data:/data
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3000/api/healthz"]
interval: 10s
timeout: 5s
retries: 10
start_period: 10s
forgejo-bootstrap:
image: codeberg.org/forgejo/forgejo:9
volumes:
- forgejo-data:/data
depends_on:
forgejo:
condition: service_healthy
entrypoint: /bin/sh
environment:
- FORGEJO_ADMIN_USERNAME=${FORGEJO_ADMIN_USERNAME:-utopia}
- FORGEJO_ADMIN_PASSWORD=${FORGEJO_ADMIN_PASSWORD:-password}
- FORGEJO_ADMIN_EMAIL=${FORGEJO_ADMIN_EMAIL:-utopia@example.com}
command: >
-c "
su git -c \"forgejo admin user create --username $$FORGEJO_ADMIN_USERNAME --password $$FORGEJO_ADMIN_PASSWORD --email $$FORGEJO_ADMIN_EMAIL --admin --must-change-password=false\" || true &&
if [ ! -f /data/gitea/token.txt ]; then
TOKEN=$$(su git -c \"forgejo admin user generate-access-token --username $$FORGEJO_ADMIN_USERNAME --token-name $$FORGEJO_ADMIN_USERNAME-token --scopes all --raw\") &&
echo $$TOKEN > /data/gitea/token.txt;
fi
"
gogs:
image: gogs/gogs:0.14
volumes:
- gogs-data:/data
- ./resources/gogs/app.ini:/data/gogs/conf/app.ini
ports:
- "3002:3000"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3000/"]
interval: 10s
timeout: 5s
retries: 10
start_period: 15s
gogs-bootstrap:
image: gogs/gogs:0.14
volumes:
- gogs-data:/data
- ./resources/gogs/app.ini:/data/gogs/conf/app.ini
depends_on:
gogs:
condition: service_healthy
entrypoint: /bin/sh
environment:
- GOGS_ADMIN_USERNAME=${GOGS_ADMIN_USERNAME:-utopia}
- GOGS_ADMIN_PASSWORD=${GOGS_ADMIN_PASSWORD:-password}
- GOGS_ADMIN_EMAIL=${GOGS_ADMIN_EMAIL:-utopia@example.com}
command:
- -c
- |
USER=git /app/gogs/gogs admin create-user \
--admin \
--name $$GOGS_ADMIN_USERNAME \
--password $$GOGS_ADMIN_PASSWORD \
--email $$GOGS_ADMIN_EMAIL \
--config /data/gogs/conf/app.ini || true
if [ ! -f /data/gogs/token.txt ]; then
sleep 2
TOKEN=$$(curl -s \
-X POST \
-u $$GOGS_ADMIN_USERNAME:$$GOGS_ADMIN_PASSWORD \
-H "Content-Type: application/json" \
-d "{\"name\":\"bootstrap\"}" \
http://gogs:3000/api/v1/users/$$GOGS_ADMIN_USERNAME/tokens \
| grep -o '"sha1":"[^"]*"' | cut -d'"' -f4)
if [ -z "$$TOKEN" ]; then echo "Failed to get token"; exit 1; fi
mkdir -p /data/gogs
echo $$TOKEN > /data/gogs/token.txt
fi
gitlab:
image: gitlab/gitlab-ce:18.10.1-ce.0
environment:
- GITLAB_ROOT_PASSWORD=${GITLAB_ROOT_PASSWORD:-;asiweml@562}
- GITLAB_ROOT_EMAIL=${GITLAB_ROOT_EMAIL:-utopia@example.com}
- GITLAB_OMNIBUS_CONFIG=gitlab_rails['initial_root_password'] = ENV['GITLAB_ROOT_PASSWORD']; gitlab_rails['gitlab_signup_enabled'] = false;
volumes:
- gitlab-data:/var/opt/gitlab
ports:
- "3003:80"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost/-/health"]
interval: 30s
timeout: 10s
retries: 20
start_period: 300s
gitlab-bootstrap:
image: alpine/curl:8.12.1
volumes:
- gitlab-data:/gitlab-data
depends_on:
gitlab:
condition: service_healthy
environment:
- GITLAB_ROOT_PASSWORD=${GITLAB_ROOT_PASSWORD:-;asiweml@562}
entrypoint: /bin/sh
command:
- -c
- |
if [ -f /gitlab-data/token.txt ]; then exit 0; fi
apk add --no-cache perl
echo "Waiting for GitLab to be ready..."
sleep 10
# Use OAuth2 password grant to get access token
OAUTH_RESPONSE=$$(curl -s -X POST http://gitlab:80/oauth/token \
--data-urlencode "grant_type=password" \
--data-urlencode "username=root" \
--data-urlencode "password=$$GITLAB_ROOT_PASSWORD" \
--data-urlencode "scope=api")
echo "OAuth response: $$OAUTH_RESPONSE"
OAUTH_TOKEN=$$(echo "$$OAUTH_RESPONSE" | grep -o '"access_token":"[^"]*"' | cut -d'"' -f4)
echo "OAuth token: $$OAUTH_TOKEN"
if [ -z "$$OAUTH_TOKEN" ]; then echo "Failed to get OAuth token"; exit 1; fi
# Create PAT using OAuth token
PAT_RESPONSE=$$(curl -s -X POST http://gitlab:80/api/v4/users/1/personal_access_tokens \
-H "Authorization: Bearer $$OAUTH_TOKEN" \
-H "Content-Type: application/json" \
-d '{"name":"bootstrap","scopes":["api","read_user","read_repository","write_repository"]}')
echo "PAT response: $$PAT_RESPONSE"
TOKEN=$$(echo "$$PAT_RESPONSE" | grep -o '"token":"[^"]*"' | cut -d'"' -f4)
echo "Token: $$TOKEN"
if [ -z "$$TOKEN" ]; then echo "Failed to get token"; exit 1; fi
mkdir -p /gitlab-data
echo $$TOKEN > /gitlab-data/token.txt
volumes:
gitea-data:
forgejo-data:
gogs-data:
gitlab-data: