Skip to content

Commit

Permalink
Add manual configuration closer to trafik
Browse files Browse the repository at this point in the history
  • Loading branch information
minottic committed Apr 23, 2024
1 parent b27b3f5 commit 41e8d76
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 4 deletions.
22 changes: 22 additions & 0 deletions services/proxy/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Proxy

The proxy acts as a reverse proxy to the SciCat Live containers.

## [config.yaml file](./config/config.yaml)

It sets proxy options. Most of them are rarely changed, but the user who wants to enable TLS, provided that the service URLs exposed by traefik are reachable from the public web, should change the [resolver settings](./config/config.yaml#L17-L18) accordingly.

## Enable TLS

The proxy sets a default certificate resolver, using letsencrypt. To use it, the user should:
1. change the [resolver settings](./config/config.yaml#L17-L18)
2. restart the proxy service
3. add dedicated labels to each service the user wants to expose, making sure that the URLs are reachable by letsencrypt. The user should set: the service public URL, the certificate resolver annotation and set the entrypoint to `websecure` to use port 443. For example, for the [frontend service](../frontend/docker-compose.yaml):

```diff
labels:
- - traefik.http.routers.frontend.rule=Host(`localhost`)
+ - traefik.http.routers.frontend.rule=Host(`<YOUR_PUBLIC_HOST>`)
+ - traefik.http.routers.frontend.entrypoints=websecure
+ - traefik.http.routers.frontend.tls.certresolver=leresolver
```
18 changes: 18 additions & 0 deletions services/proxy/config/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
api:
insecure: true

providers:
docker: true

entryPoints:
web:
address: :80
websecure:
address: :443

certificatesResolvers:
leresolver:
acme:
storage: /letsencrypt/acme.json
email: mail@example.com
caServer: https://acme-staging-v02.api.letsencrypt.org/directory
11 changes: 7 additions & 4 deletions services/proxy/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
services:
proxy:
image: traefik:2.11
command:
- --api.insecure=true
- --providers.docker=true
- --entrypoints.web.address=:80
ports:
- 80:80
- 443:443
- 8080:8080
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./config/config.yaml:/etc/traefik/traefik.yaml:ro
- letsencrypt_proxy_data:/letsencrypt

volumes:
letsencrypt_proxy_data:
driver: local

0 comments on commit 41e8d76

Please sign in to comment.