Skip to content

Commit

Permalink
Add TLS on services (#129)
Browse files Browse the repository at this point in the history
* Add TLS on services

* Use https instead of http transport

* enable redirection to https
  • Loading branch information
darkweak authored Aug 4, 2021
1 parent c5e25d6 commit f9b7676
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ CODI_DB_USER=codimd
DOMAIN=smersh.lan
JWT_KEY=secret-key
SUBDOMAINS=(api|bitwarden|codimd)
TRANSPORT=http://
TRANSPORT=https://
12 changes: 12 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ services:
- ./api/public:/srv/api/public:ro
labels:
- traefik.http.routers.api.rule=Host(`api.${DOMAIN}`)
- traefik.http.routers.api.tls=true
- traefik.http.routers.api.tls.domains[0].main=${DOMAIN}
- traefik.http.routers.api.tls.domains[0].sans=*.${DOMAIN}
<<: *network

db:
Expand Down Expand Up @@ -109,6 +112,9 @@ services:
labels:
- traefik.http.routers.codimd.rule=Host(`codimd.${DOMAIN}`)
- traefik.http.services.codimd.loadbalancer.server.port=3000
- traefik.http.routers.codimd.tls=true
- traefik.http.routers.codimd.tls.domains[0].main=${DOMAIN}
- traefik.http.routers.codimd.tls.domains[0].sans=*.${DOMAIN}
volumes:
- upload-data:/home/hackmd/app/public/uploads
# restart: always
Expand All @@ -127,12 +133,18 @@ services:
- 80
labels:
- traefik.http.routers.client.rule=Host(`${DOMAIN}`)
- traefik.http.routers.client.tls=true
- traefik.http.routers.client.tls.domains[0].main=${DOMAIN}
- traefik.http.routers.client.tls.domains[0].sans=*.${DOMAIN}
<<: *network

bitwarden:
image: bitwardenrs/server:latest
labels:
- traefik.http.routers.bitwarden.rule=Host(`bitwarden.${DOMAIN}`)
- traefik.http.routers.bitwarden.tls=true
- traefik.http.routers.bitwarden.tls.domains[0].main=${DOMAIN}
- traefik.http.routers.bitwarden.tls.domains[0].sans=*.${DOMAIN}
volumes:
- ./data/bitwarden:/data
# restart: on-failure
Expand Down
14 changes: 10 additions & 4 deletions traefik.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@
dashboard = true
debug = true

[entryPoints.web]
address = ":80"
[entryPoints.web-secure]
address = ":443"
[entryPoints]
[entryPoints.web]
address = ":80"
[entryPoints.web.http]
[entryPoints.web.http.redirections]
[entryPoints.web.http.redirections.entryPoint]
to = "web-secure"
scheme = "https"
[entryPoints.web-secure]
address = ":443"

0 comments on commit f9b7676

Please sign in to comment.