My configuration is all screwed up. It was a Frankenstein monster of this and that from an owncloud tutorial. I would finally like to fully understand the config. I use a .toml file for the traefik. Then docker containers in a number of docker-compose .yml files to run an Owncloud server, Traefik and a linux dash. The twist is that while the config I had was okay, the server hangs about every 48 hours and I have yet to get Linux Dash Dashboard to work so that it helps me monitor the system while I am away from home.
So, I see this as an opportunity to finally figure traefik out and I need some help please.
I had the following features running in my configuration:
- Let's encrypt Certs
- Owncloud listening on HTTP and redirecting to HTTPS
I want to:
- Support a new service on say port 8200
- Have it certified and encrypted.
I want to learn and I don't know what to provide. My config files are in a bad state and weren't very good to begin with. Here they are as is, with errors:
docker-compose.yml (owncloud)
ports:
- "9090:8080" # Traefik automatically chooses exposed port
environment:
- OWNCLOUD_DOMAIN=${OWNCLOUD_DOMAIN}
- OWNCLOUD_DB_TYPE=mysql
- OWNCLOUD_DB_NAME=owncloud
- OWNCLOUD_DB_USERNAME=owncloud
- OWNCLOUD_DB_PASSWORD=${MARIADB_USER}
- OWNCLOUD_DB_HOST=db
- OWNCLOUD_ADMIN_USERNAME=${ADMIN_USERNAME}
- OWNCLOUD_ADMIN_PASSWORD=${ADMIN_PASSWORD}
- OWNCLOUD_UTF8MB4_ENABLED=true
- OWNCLOUD_REDIS_ENABLED=true
- OWNCLOUD_REDIS_HOST=redis
labels:
- "traefik.docker.network=web"
- "traefik.http.routers.owncloud.entrypoints=websecure"
- "traefik.http.routers.owncloud.rule=(Host('host.com') && Path('/owncloud'>
- "traefik.http.routers.owncloud.tls=true"
- "traefik.http.routers.owncloud.tls.certresolver=acme"
- "traefik.enable=true"
networks:
- web
- internal
healthcheck:
test: ["CMD", "/usr/bin/healthcheck"]
interval: 30s
timeout: 10s
retries: 5
volumes:
- files:/mnt/data
docker-compose.yml (traefik)
version: '3.3'
services:
reverse-proxy:
# The official v2 Traefik docker image
image: traefik:v2.2 # Use the latest version
# Enables the web UI and tells Traefik to listen to docker
ports:
# The HTTP port
- "80:80"
# The HTTPS port
- "443:443"
# Dash port
- "8200:8200"
# The Web UI (enabled by --api.insecure=true)
- "8080:8080"
volumes:
# So that Traefik can listen to the Docker events
- /var/run/docker.sock:/var/run/docker.sock
- /etc/docker-compose/traefik/traefik.toml:/traefik.toml:ro
- /etc/docker-compose/traefik/acme.json:/acme.json
networks:
- web
networks:
web:
external: True
traefik.toml
[api]
insecure=true
[providers.docker]
[entryPoints]
[entryPoints.web]
address = ":80"
[entryPoints.web.redirect]
entryPoint = "websecure"
[entryPoints.websecure]
address = ":443"
[entryPoints.websecure.tls]
[acme]
email = "email"
storageFile = "acme.json"
tlschallenge=true
caServer = "https://acme-staging.api.letsencrypt.org/directory"
[entryPoints.dash]
address = ":8200"
# entryPoint = "https"
[[acme.domains]]
main = "host.com"
sans = ["owncloud.host.com"]
Remember goal is:
- two services owncloud and linux dash.
- Let's encrypt