I am attempting to setup sentry behind traefik but I am running into an issue. My traefik setup is configured like so:
version: "3.3" services: traefik: image: traefik:v2.0 restart: always container_name: traefik ports: - "80:80" # <== http - "8080:8080" # <== :8080 is where the dashboard runs on command: - --api.dashboard=true # <== Enabling the dashboard to view services, middlewares, routers, etc... - --api.debug=true # <== Enabling additional endpoints for debugging and profiling - --log.level=DEBUG # <== Setting the level of the logs from traefik - --providers.docker=true # <== Enabling docker as the provider for traefik - --providers.docker.exposedbydefault=false # <== Don't expose every container to traefik, only expose enabled ones - --providers.docker.network=web # <== Operate on the docker network named web - --entrypoints.web.address=:80 # <== Defining an entrypoint for port :80 named web volumes: - /var/run/docker.sock:/var/run/docker.sock # <== Volume for docker admin networks: - web labels: - "traefik.enable=true" # <== Enable traefik on itself to view dashboard and assign subdomain to view it - "traefik.http.routers.api.rule=Host(`monitor.example.com`)" # <== Setting the domain for the dashboard - "traefik.http.routers.api.service=api@internal" # <== Enabling the api to be a service to access networks: web: external: true
I tested this with wordpress first here is that config:
version: "3.3" services: wordpress: # <== we aren't going to open :80 here because traefik is going to serve this on entrypoint 'web' image: wordpress restart: always container_name: wp environment: WORDPRESS_DB_HOST: db WORDPRESS_DB_USER: exampleuser WORDPRESS_DB_PASSWORD: examplepass WORDPRESS_DB_NAME: exampledb volumes: - wordpress:/var/www/html networks: - web - backend labels: - "traefik.enable=true" # <== Enable traefik to proxy this container - "traefik.http.routers.nginx-web.rule=Host(`wordpress.example.com`)" # <== Your Domain Name goes here for the http rule - "traefik.http.routers.nginx-web.entrypoints=web" # <== Defining the entrypoint for http, **ref: line 30 db: image: mysql:5.7 restart: always environment: MYSQL_DATABASE: exampledb MYSQL_USER: exampleuser MYSQL_PASSWORD: examplepass MYSQL_RANDOM_ROOT_PASSWORD: '1' volumes: - db:/var/lib/mysql networks: - backend networks: web: external: true backend: external: false volumes: wordpress: external: true db: external: true
and that works fine. I can visit the endpoint I configured and wordpress is served.
So I modified the docker-compose.yml file for sentry (after running
./install.sh) and commented out the ports for the nginx container and added the following
networks: - web labels: - "traefik.enable=true" - "traefik.http.routers.nginx-web.rule=Host(`sentry.example.com`)" - "traefik.http.routers.nginx-web.entrypoints=web"
and added this to the bottom of the file
networks: web: external: true
My issue is after running
docker-compose up -d everything starts fine but after maybe a minute or so the nginx containers drops from the traefik dashboard. When I run
docker-compose ps I see that the nginx container is restarting. It does not leave this state. Am I configuring something wrong here or am I missing something.