Skip to content

Commit

Permalink
feat: add letsencrypt cert resolver
Browse files Browse the repository at this point in the history
- adjust the readme
- remove the second traefik compose file
  • Loading branch information
erkenes committed Sep 15, 2024
1 parent 4bfb508 commit e61a204
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 34 deletions.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ CA_PATH=/docker/traefik/certs
ROOT_DOMAIN_NAME=YOURDOMAIN.com

TRAEFIK_DASHBOARD_HOST=traefik.$ROOT_DOMAIN_NAME
TRAEFIK_DASHBOARD_CERT_RESOLVER=letsencrypt

TRAEFIK_UID=2000
DOCKER_GID=999
Expand Down
9 changes: 3 additions & 6 deletions ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,13 +160,10 @@ certificatesResolvers:
email: '[email protected]'
```

Use the traefik-compose file by editing the [compose.yml](compose.yml) file.
Change the cert resolver for the dashboard in the `.env` file.

```yaml
include:
- ./lib/compose.dockerproxy.yml
# - ./lib/compose.traefik.yml
- ./lib/compose.traefik.cloudflare.yml
```text
TRAEFIK_DASHBOARD_CERT_RESOLVER=dns-cloudflare
```

## Optional Features / Integrations
Expand Down
28 changes: 0 additions & 28 deletions lib/compose.traefik.cloudflare.yml

This file was deleted.

12 changes: 12 additions & 0 deletions lib/compose.traefik.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ services:
ROOT_DOMAIN_NAME: '${ROOT_DOMAIN_NAME}'
TRAEFIK_DASHBOARD_HOST: '${TRAEFIK_DASHBOARD_HOST}'
TZ: '${TIMEZONE}'
CF_API_EMAIL_FILE: '/run/secrets/cf_email'
CF_API_KEY_FILE: '/run/secrets/cf_api_key'
secrets:
- cf_email
- cf_api_key
ports:
- '0.0.0.0:80:10080'
- '0.0.0.0:443:10443'
Expand All @@ -41,6 +46,7 @@ services:
- 'traefik.http.routers.traefik-dashboard.tls=true'
- 'traefik.http.routers.traefik-dashboard.entrypoints=https'
- 'traefik.http.routers.traefik-dashboard.rule=Host(`${TRAEFIK_DASHBOARD_HOST}`)'
- 'traefik.http.routers.traefik-dashboard.tls.certresolver=${TRAEFIK_DASHBOARD_CERT_RESOLVER}'
- 'traefik.http.routers.traefik-dashboard.service=api@internal'

# Ping
Expand All @@ -55,6 +61,12 @@ services:
user: "${TRAEFIK_UID}:${TRAEFIK_UID}" # user traefik has to be created on the host system
# sudo useradd -u 2000 -M -s /usr/sbin/nologin traefik

secrets:
cf_email:
file: '${ROOT_PATH}/secrets/cf_email'
cf_api_key:
file: '${ROOT_PATH}/secrets/cf_api_key'

networks:
traefik:
name: traefik
Expand Down
7 changes: 7 additions & 0 deletions lib/traefik/traefik.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,10 @@ certificatesResolvers:
storage: /etc/traefik/acme/cloudflare.json
dnsChallenge:
provider: cloudflare
letsencrypt:
acme:
# ToDo: Change this value with your email address
email: hostmaster@YOUR_DOMAIN.com
storage: /etc/traefik/acme/letsencrypt.json
caServer: https://acme-staging-v02.api.letsencrypt.org/directory # do not use in production
tlsChallenge: {}

0 comments on commit e61a204

Please sign in to comment.