hello, i have set my project up using traefik and docker compose, its a simple blog application it also have a mongodb image and mongo express frontend, the problem is that although i can deploy and expose my mongo client with no problem when i try my main blog application i simply get a Bad Gateway message in my browser, here is my docker-compose:
version: '3'
networks:
web:
external: true
internal:
external: false
services:
traefik:
image: "traefik:v2.5"
container_name: "traefik"
networks:
- web
- internal
ports:
- "80:80"
- "443:443"
- "8080:8080"
volumes:
- ./logs/traefik.log:/var/log/traefik.log
- "./traefik.toml:/traefik.toml"
- "./traefik_dynamic.toml:/traefik_dynamic.toml"
- "/var/run/docker.sock:/var/run/docker.sock:ro"
mongo:
container_name: mongo
image: mongo
volumes:
- ./mongo-init.js:/docker-entrypoint-initdb.d/mongo-init.js:ro
- ./volumes/mongo-data:/data/db
command: mongod --port 27019
labels:
- traefik.enable=false
ports:
- "0.0.0.0:27019:27019"
networks:
- internal
blog:
container_name: crypto_blog
build: ./
restart: always
env_file: ./.env
ports:
- "4300:4300"
links:
- mongo
depends_on:
# - jaeger
- mongo
labels:
- traefik.http.routers.blog.rule=Host(`mydomain.info`)
- traefik.http.routers.blog.tls=false
- traefik.port=80
networks:
- internal
- web
volumes:
- ./public/uploads:/usr/src/app/public/uploads
mongoexpress:
image: mongo-express
container_name: mongoexpress
labels:
- traefik.http.routers.mongo.rule=Host(`mongo.mydomain.info`)
- traefik.http.routers.mongo.tls=false
- traefik.port=80
ports:
- "8023:8081"
links:
- mongo
networks:
- internal
- web
environment:
ME_CONFIG_MONGODB_SERVER: mongo
ME_CONFIG_MONGODB_PORT: 27019
here is my traefik.toml :
[entryPoints]
[entryPoints.web]
address = ":80"
# [entryPoints.web.http.redirections.entryPoint]
# to = "websecure"
# scheme = "https"
[entryPoints.websecure]
address = ":443"
[api]
dashboard = true
[certificatesResolvers.lets-encrypt.acme]
email = "xxx@dmoain.com"
storage = "acme.json"
[certificatesResolvers.lets-encrypt.acme.tlsChallenge]
[providers.docker]
watch = true
network = "web"
[providers.file]
filename = "traefik_dynamic.toml"
and my traefik_dynamic.toml:
[http.middlewares.simpleAuth.basicAuth]
users = [
"admin:$apr1$EsFGGunJ$EokXWJhvqykI0h1oVK6PF."
]
[http.routers.api]
rule = "Host(`monitor.alphainvest.info`)"
entrypoints = ["web"]
middlewares = ["simpleAuth"]
service = "api@internal"
# [http.routers.api.tls]
# certResolver = "lets-encrypt"
also my traefik logs don't show any problems, i would appreciate it if you can help me, thanks.