-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yaml
163 lines (158 loc) · 5.57 KB
/
docker-compose.yaml
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
services:
# Reverse Proxy as HTTP/HTTPS Ingress:
proxy:
image: traefik:3.1
restart: unless-stopped
networks:
- proxy
ports:
- 80:80/tcp # HTTP
- 443:443/tcp # HTTPS
environment:
# Access credentials for DNS Challenge with INWX
INWX_USERNAME_FILE: /run/secrets/inwx_username
INWX_PASSWORD_FILE: /run/secrets/inwx_password
INWX_SHARED_SECRET_FILE: /run/secrets/inwx_totpcode
command:
# Enable access log:
- --accesslog=true
# Set clobal configuration:
- --global.checknewversion=false
- --global.sendanonymoususage=false
# Configure HTTP entrypoint:
- --entrypoints.web=true
- --entrypoints.web.address=:80/tcp
- --entrypoints.web.http=true
- --entrypoints.web.http.tls=false
# Configure HTTPS entrypoint:
- --entrypoints.websecure=true
- --entrypoints.websecure.address=:443/tcp
- --entrypoints.websecure.http=true
- --entrypoints.websecure.http.tls=true
- --entrypoints.websecure.http.tls.certresolver=letsencrypt
# Configure Let's Encrypt with DNS challenge:
- --certificatesresolvers.letsencrypt.acme.email=${LETS_ENCRYPT_EMAIL}
- --certificatesresolvers.letsencrypt.acme.storage=/etc/traefik/acme/acme.json
- --certificatesresolvers.letsencrypt.acme.dnschallenge.provider=inwx
- --certificatesresolvers.letsencrypt.acme.dnschallenge.resolvers=1.1.1.1:53,8.8.8.8:53
# Enable Docker provider:
- --providers.docker=true
- --providers.docker.endpoint=unix:///var/run/docker.sock
- --providers.docker.exposedbydefault=false
- --providers.docker.network=proxy
- --providers.docker.watch=true
# Enable JWT middleware plugin:
- --experimental.plugins.jwt.modulename=github.com/Brainnwave/jwt-middleware
- --experimental.plugins.jwt.version=v1.2.1
secrets:
# Access credentials for DNS Challenge with INWX:
- inwx_username
- inwx_password
- inwx_totpcode
volumes:
# Mount Docker socket to use it as provider:
- /var/run/docker.sock:/var/run/docker.sock:ro
# Mount certificates for persistency:
- .secrets/acme:/etc/traefik/acme:rw
# eMSP Authorization Server:
as:
image: nginx:1.27-alpine
restart: unless-stopped
depends_on:
- proxy
- as-php
networks:
- proxy
labels:
# Enable reverse proxying on HTTP and HTTPS:
- traefik.enable=true
- traefik.http.routers.emsp-as.entrypoints=web,websecure
- traefik.http.routers.emsp-as.rule=Host(`${AUTHORIZATION_SERVER_DOMAIN}`)
- traefik.http.routers.emsp-as.service=emsp-as
- traefik.http.services.emsp-as.loadbalancer.server.port=80
volumes:
# Web files:
- ./emsp-as/src:/var/www:ro
# Nginx configuration:
- ./emsp-as/nginx.conf:/etc/nginx/conf.d/default.conf:ro
as-php:
image: php:8.3-fpm-alpine
restart: unless-stopped
networks:
- proxy
environment:
# Configuration
API_KEY: ${AUTHLETE_API_KEY}
API_SECRET: ${AUTHLETE_API_SECRET}
CLIENT_ID: ${AUTHLETE_CLIENT_ID}
CLIENT_SECRET: ${AUTHLETE_CLIENT_SECRET}
volumes:
# Web files:
- ./emsp-as/src:/var/www:ro
- ../benchmark/as/:/logs/:rw
# eMSP Backend to request X.509 certificates
emsp-backend:
build:
context: ./emsp-backend
dockerfile: Dockerfile
restart: unless-stopped
depends_on:
- proxy
networks:
- proxy
environment:
# Configuration:
PORT: 8080
CSR_DIR: /app/csr
CRT_DIR: /app/crt
SIGNING_CMD: /app/scripts/sign-cert.sh
SIGNING_ARGS: "$${CSR_FILE} $${CRT_FILE}"
labels:
# Reverse proxy on HTTP and HTTPS:
- traefik.enable=true
- traefik.http.routers.emsp-backend.entrypoints=web,websecure
- traefik.http.routers.emsp-backend.rule=Host(`${EMSP_BACKEND_DOMAIN}`)
- traefik.http.routers.emsp-backend.service=emsp-backend
- traefik.http.services.emsp-backend.loadbalancer.server.port=8080
# JWT Bearer Authorization:
- traefik.http.routers.emsp-backend.middlewares=emsp-backend@docker
- traefik.http.middlewares.emsp-backend.plugin.jwt.issuers=https://${AUTHORIZATION_SERVER_DOMAIN}
# - traefik.http.middlewares.emsp-backend.plugin.jwt.require.aud=${TRUSTED_AUDIENCE}
- traefik.http.middlewares.emsp-backend.plugin.jwt.require.client_id=${AUTHLETE_CLIENT_ID}
- traefik.http.middlewares.emsp-backend.plugin.jwt.require.iss=https://${AUTHORIZATION_SERVER_DOMAIN}
- traefik.http.middlewares.emsp-backend.plugin.jwt.require.scope=ccsr
volumes:
# Location of root CA config files:
- .secrets/ca:/app/ca:rw
# Location of received certificate signing request files:
- .secrets/csr:/app/csr:rw
# Location of issued contract certificate files:
- .secrets/crt:/app/crt:rw
- ../benchmark/emsp_backend/:/logs/:rw
# User Agent for certificate provisioning
user-agent:
build:
context: ./user-agent
dockerfile: Dockerfile
restart: unless-stopped
depends_on:
- proxy
networks:
- proxy
labels:
- traefik.enable=true
- traefik.http.routers.user-agent.entrypoints=web,websecure
- traefik.http.routers.user-agent.rule=Host(`${USER_AGENT_DOMAIN}`)
secrets:
# INWX Credentials for DNS Challenge
inwx_username:
file: .secrets/inwx_username.txt
inwx_password:
file: .secrets/inwx_password.txt
inwx_totpcode:
file: .secrets/inwx_totpcode.txt
networks:
# Network between Reverse Proxy and services
proxy:
driver: bridge
name: emsp_proxy