Skip to content

Commit c84b878

Browse files
committed
Add traefik to compose
This prevents cors problems when using another url than localhost
1 parent f03d0f9 commit c84b878

File tree

4 files changed

+22
-9
lines changed

4 files changed

+22
-9
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ Setting the compose profiles spins up the matching services. To create all of th
3737
docker compose --profile '*' up -d
3838
```
3939

40-
You can then go to `http://localhost` to access the UI and `http://localhost:3000/explorer` to access the backend Swagger UI (including the openAPI specs). To login use:
40+
You can then go to `http://localhost` to access the UI and `http://localhost/api/v1/explorer` to access the backend Swagger UI (including the openAPI specs). To login use:
4141

4242
| Username | Password |
4343
| ---------------- | ------------- |

config/docker-compose.yaml

+17-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
1-
version: "3.9"
21
services:
2+
reverse-proxy:
3+
image: traefik:3.2
4+
command: --api.insecure=true --providers.docker=true --entrypoints.web.address=:80
5+
ports:
6+
- 80:80
7+
volumes:
8+
- /var/run/docker.sock:/var/run/docker.sock
9+
310
mongodb:
411
image: mongo:4.2
512
volumes:
@@ -45,20 +52,23 @@ services:
4552
JWT_SECRET: jwt_secret
4653
CHROME_BIN: /usr/bin/chromium
4754
CHROME_PATH: /usr/lib/chromium/
55+
BASE_PATH: /api/v1
4856
profiles:
4957
- be
50-
ports:
51-
- 3000:3000
58+
labels:
59+
- traefik.http.routers.backend.rule=PathPrefix(`/api/v1`)
5260

5361
frontend:
5462
image: ghcr.io/paulscherrerinstitute/scilog/fe
55-
# volumes:
56-
# uncomment to enable the oidc form
63+
volumes:
64+
# replace simple_config.json volume mount
65+
# with the one below to enable the oidc form
5766
# - ./fe/config.json:/usr/share/nginx/html/assets/config.json
67+
- ./fe/simple_config.json:/usr/share/nginx/html/assets/config.json
5868
profiles:
5969
- fe
60-
ports:
61-
- 80:80
70+
labels:
71+
- traefik.http.routers.frontend.rule=PathPrefix(`/`)
6272

6373
volumes:
6474
mongodb_data:

config/fe/config.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"lbBaseURL": "http://localhost:3000/",
2+
"lbBaseURL": "http://localhost/api/v1/",
33
"oAuth2Endpoint": {
44
"authURL": "auth/keycloak",
55
"displayText": "keycloak"

config/fe/simple_config.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"lbBaseURL": "http://localhost/api/v1/"
3+
}

0 commit comments

Comments
 (0)