Skip to content

Commit ccf2857

Browse files
Merge pull request #25 from cerberauth/update-docker-compose
chore: move some env variables to docker compose file
2 parents 3ec8032 + 6cffb80 commit ccf2857

File tree

4 files changed

+90
-99
lines changed

4 files changed

+90
-99
lines changed

.docker/hydra/hydra.yml

+1-43
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,9 @@
11
serve:
22
cookies:
33
same_site_mode: Lax
4-
5-
admin:
6-
cors:
7-
enabled: true
8-
allowed_origins:
9-
- https://taco.cerberauth.com
10-
- http://localhost:3000
11-
allowed_methods:
12-
- POST
13-
- GET
14-
- PUT
15-
- PATCH
16-
- DELETE
17-
allowed_headers:
18-
- Authorization
19-
exposed_headers:
20-
- Content-Type
21-
224
public:
235
cors:
246
enabled: true
25-
allowed_origins:
26-
- "*"
27-
allowed_methods:
28-
- POST
29-
- GET
30-
allowed_headers:
31-
- Authorization
32-
exposed_headers:
33-
- Content-Type
34-
35-
urls:
36-
self:
37-
issuer: https://testid.cerberauth.com
38-
admin: http://localhost:4445/
39-
consent: https://testid.cerberauth.com/consent
40-
login: https://testid.cerberauth.com/login
41-
# registration: https://testid.cerberauth.com/login
42-
logout: https://testid.cerberauth.com/logout
43-
error: https://testid.cerberauth.com/error
44-
45-
secrets:
46-
system:
47-
- youReallyNeedToChangeThis
487

498
oauth2:
509
allowed_top_level_claims:
@@ -59,7 +18,6 @@ oauth2:
5918
grant:
6019
jwt:
6120
iat_optional: true
62-
6321
pkce:
6422
enforced_for_public_clients: false
6523
enforced: false
@@ -73,9 +31,9 @@ oidc:
7331
- offline
7432
- offline_access
7533
enabled: true
76-
7734
subject_identifiers:
7835
supported_types:
36+
- pairwise
7937
- public
8038

8139
strategies:

.env.production

-19
This file was deleted.

docker-compose.dev.yml

+7-5
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,10 @@ services:
2626
- 80:4455
2727

2828
hydra-login-consent:
29-
env_file:
30-
- .env.local
31-
- .env
32-
ports:
33-
- 8080:8080
29+
build:
30+
context: ./hydra-login-consent
31+
env_file:
32+
- .env.local
33+
- .env
34+
ports:
35+
- 8080:8080

docker-compose.yml

+82-32
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,23 @@ services:
22
hydra:
33
image: oryd/hydra:v2.2
44
command: serve public --dev -c /etc/config/hydra/hydra.yml
5-
volumes:
6-
- .docker/hydra:/etc/config/hydra:ro
5+
configs:
6+
- source: hydra_config
7+
target: /etc/config/hydra/hydra.yml
78
environment:
8-
- DSN=postgres://hydra:secret@hydra-postgresd:5432/hydra?sslmode=disable&max_conns=20&max_idle_conns=4
9-
env_file:
10-
- .env.production
11-
- .env
9+
- LOG_LEVEL=${HYDRA_LOG_LEVEL:-warn}
10+
- LOG_FORMAT=${HYDRA_LOG_FORMAT:-json}
11+
- DSN=postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@hydra-postgresd:5432/${POSTGRES_DB}?sslmode=disable&max_conns=20&max_idle_conns=4
12+
- URLS_SELF_ISSUER=${URLS_SELF_ISSUER:-http://localhost:4444/}
13+
- URLS_SELF_PUBLIC=${URLS_SELF_PUBLIC:-http://localhost:4444/}
14+
- URLS_LOGIN=${URLS_LOGIN}
15+
- URLS_REGISTRATION=${URLS_REGISTRATION}
16+
- URLS_CONSENT=${URLS_CONSENT}
17+
- URLS_LOGOUT=${URLS_LOGOUT}
18+
- URLS_ERROR=${URLS_ERROR}
19+
- OIDC_SUBJECT_IDENTIFIERS_PAIRWISE_SALT=${OIDC_SUBJECT_IDENTIFIERS_PAIRWISE_SALT}
20+
- SECRETS_COOKIE=${SECRETS_COOKIE}
21+
- SECRETS_SYSTEM=${SECRETS_SYSTEM}
1222
restart: unless-stopped
1323
depends_on:
1424
- hydra-migrate
@@ -17,43 +27,61 @@ services:
1727
hydra-admin:
1828
image: oryd/hydra:v2.2
1929
command: serve admin -c /etc/config/hydra/hydra.yml
20-
ports:
21-
- 4445:4445
22-
volumes:
23-
- .docker/hydra:/etc/config/hydra:ro
30+
configs:
31+
- source: hydra_config
32+
target: /etc/config/hydra/hydra.yml
2433
environment:
25-
- DSN=postgres://hydra:secret@hydra-postgresd:5432/hydra?sslmode=disable&max_conns=20&max_idle_conns=4
26-
env_file:
27-
- .env.production
28-
- .env
34+
- LOG_LEVEL=${HYDRA_LOG_LEVEL:-warn}
35+
- LOG_FORMAT=${HYDRA_LOG_FORMAT:-json}
36+
- DSN=postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@hydra-postgresd:5432/${POSTGRES_DB}?sslmode=disable&max_conns=20&max_idle_conns=4
37+
- URLS_SELF_ISSUER=${URLS_SELF_ISSUER:-http://localhost:4444/}
38+
- URLS_SELF_PUBLIC=${URLS_SELF_PUBLIC:-http://localhost:4444/}
39+
- URLS_LOGIN=${URLS_LOGIN}
40+
- URLS_REGISTRATION=${URLS_REGISTRATION}
41+
- URLS_CONSENT=${URLS_CONSENT}
42+
- URLS_LOGOUT=${URLS_LOGOUT}
43+
- URLS_ERROR=${URLS_ERROR}
44+
- OIDC_SUBJECT_IDENTIFIERS_PAIRWISE_SALT=${OIDC_SUBJECT_IDENTIFIERS_PAIRWISE_SALT}
45+
- SECRETS_COOKIE=${SECRETS_COOKIE}
46+
- SECRETS_SYSTEM=${SECRETS_SYSTEM}
2947
restart: unless-stopped
3048
depends_on:
3149
- hydra-migrate
3250
- hydra-postgresd
3351

3452
hydra-migrate:
3553
image: oryd/hydra:v2.2
54+
command: migrate -c /etc/config/hydra/hydra.yml sql -e --yes
55+
configs:
56+
- source: hydra_config
57+
target: /etc/config/hydra/hydra.yml
3658
depends_on:
3759
- hydra-postgresd
3860
environment:
39-
- DSN=postgres://hydra:secret@hydra-postgresd:5432/hydra?sslmode=disable&max_conns=20&max_idle_conns=4
40-
env_file:
41-
- .env.production
42-
- .env
43-
command: migrate -c /etc/config/hydra/hydra.yml sql -e --yes
44-
volumes:
45-
- .docker/hydra:/etc/config/hydra:ro
61+
- LOG_LEVEL=${HYDRA_LOG_LEVEL:-warn}
62+
- LOG_FORMAT=${HYDRA_LOG_FORMAT:-json}
63+
- DSN=postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@hydra-postgresd:5432/${POSTGRES_DB}?sslmode=disable&max_conns=20&max_idle_conns=4
64+
- URLS_SELF_ISSUER=${URLS_SELF_ISSUER:-http://localhost:4444/}
65+
- URLS_SELF_PUBLIC=${URLS_SELF_PUBLIC:-http://localhost:4444/}
66+
- URLS_LOGIN=${URLS_LOGIN}
67+
- URLS_REGISTRATION=${URLS_REGISTRATION}
68+
- URLS_CONSENT=${URLS_CONSENT}
69+
- URLS_LOGOUT=${URLS_LOGOUT}
70+
- URLS_ERROR=${URLS_ERROR}
71+
- OIDC_SUBJECT_IDENTIFIERS_PAIRWISE_SALT=${OIDC_SUBJECT_IDENTIFIERS_PAIRWISE_SALT}
72+
- SECRETS_COOKIE=${SECRETS_COOKIE}
73+
- SECRETS_SYSTEM=${SECRETS_SYSTEM}
4674
restart: on-failure
4775

4876
hydra-postgresd:
4977
image: postgres:16
5078
restart: always
5179
volumes:
52-
- hdyra_db_data:/var/lib/postgresql/data
80+
- hydra_db_data:/var/lib/postgresql/data
5381
environment:
54-
- POSTGRES_USER=hydra
55-
- POSTGRES_PASSWORD=secret
56-
- POSTGRES_DB=hydra
82+
- POSTGRES_USER=${POSTGRES_USER}
83+
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
84+
- POSTGRES_DB=${POSTGRES_DB}
5785
healthcheck:
5886
test: ["CMD-SHELL", "pg_isready"]
5987
interval: 10s
@@ -64,13 +92,18 @@ services:
6492
image: oryd/oathkeeper:v0.40
6593
depends_on:
6694
- hydra
67-
ports:
68-
- 4455:4455
69-
command:
70-
serve proxy -c "/etc/config/oathkeeper/oathkeeper.yml"
95+
- hydra-login-consent
96+
command: serve proxy -c "/etc/config/oathkeeper/oathkeeper.yml"
97+
configs:
98+
- source: oathkeeper_config
99+
target: /etc/config/oathkeeper/oathkeeper.yml
100+
- source: oathkeeper_rules
101+
target: /etc/config/oathkeeper/access-rules.yml
102+
environment:
103+
- LOG_LEVEL=${OATHKEEPER_LOG_LEVEL:-warn}
104+
- LOG_FORMAT=${OATHKEEPER_LOG_FORMAT:-json}
105+
- SERVE_PROXY_PORT=${SERVE_PROXY_PORT:-4455}
71106
restart: on-failure
72-
volumes:
73-
- .docker/oathkeeper:/etc/config/oathkeeper:ro
74107

75108
hydra-login-consent:
76109
build:
@@ -82,5 +115,22 @@ services:
82115
depends_on:
83116
- hydra-admin
84117

118+
hydra-cleanup:
119+
build:
120+
context: ./hydra-cleanup
121+
environment:
122+
- HYDRA_ADMIN_URL=http://hydra-admin:4445
123+
restart: on-failure
124+
depends_on:
125+
- hydra-admin
126+
127+
configs:
128+
hydra_config:
129+
file: .docker/hydra/hydra.yml
130+
oathkeeper_config:
131+
file: .docker/oathkeeper/oathkeeper.yml
132+
oathkeeper_rules:
133+
file: .docker/oathkeeper/access-rules.yml
134+
85135
volumes:
86-
hdyra_db_data:
136+
hydra_db_data:

0 commit comments

Comments
 (0)