I have been banging my head on this for 1 MONTH... i have nothing left to give
I have no formal training computers and have never taken 1 computer course i am all self taught and enjoy it as a hobby so be gentle
i am comfortable setting up containers and port fowarding and using services both inside and outside my network, my next challenge is traefik and its winning
I am trying to set EVERYTHING up in a simple docker-compose file
Container whoami works PERFECT inside and outside of my network with the following setup
Container airsonic does not work AT ALL inside or outside my network > i change airsonic entrypoint from websecure to web and remove tls then it works but that kinda defeats the point
version: "3.3"
services:
traefik:
image: "traefik:v2.2"
container_name: "traefik"
command:
- "--log.level=DEBUG"
- "--api.insecure=true"
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
- "--entrypoints.web.address=:80"
- "--entrypoints.websecure.address=:443"
- "--certificatesresolvers.myresolver.acme.dnschallenge=true"
- "--certificatesresolvers.myresolver.acme.dnschallenge.provider=cloudflare"
#- "--certificatesresolvers.myresolver.acme.caserver=https://acme-staging-v02.api.letsencrypt.org/directory"
- "--certificatesresolvers.myresolver.acme.email=myperrsonalemail@gmail.com"
- "--certificatesresolvers.myresolver.acme.storage=/letsencrypt/acme.json" # set to permissions 600
ports:
- "80:80"
- "443:443"
- "8080:8080"
environment:
- "CF_API_EMAIL=mypersonalemail@gmail.com"
- "CF_API_KEY=mycfapikey
volumes:
- "/media/username/nfsset/containers/traefik/letsencrypt:/letsencrypt"
- "/var/run/docker.sock:/var/run/docker.sock:ro"
whoami:
image: "containous/whoami"
container_name: "whoami"
labels:
- "traefik.enable=true"
- "traefik.http.routers.whoami.rule=Host(`whoami.home.mydomain.com`)"
- "traefik.http.routers.whoami.entrypoints=websecure"
- "traefik.http.routers.whoami.tls.certresolver=myresolver"
airsonic:
image: "airsonic/airsonic"
container_name: "airsonic"
labels:
- "traefik.enable=true"
- "traefik.http.routers.airsonic.rule=Host(`airsonic.home.mydomain.com`)"
- "traefik.http.routers.airsonic.entrypoints=websecure"
- "traefik.http.routers.airsonic.tls.certresolver=myresolver"
- "traefik.http.services.airsonic.loadbalancer.server.port=4040"
environment:
- PUID=1000
- PGID=1000
- TZ=America/New_York
volumes:
- "/media/username/nfsset/containers/airsonic/data:/airsonic/data"
- "/media/username/nfsset/containers/airsonic/music:/airsonic/music"
- "/media/username/nfsset/containers/airsonic/playlists:/airsonic/playlists"
- "/media/username/nfsset/containers/airsonic/podcasts:/airsonic/podcasts"
- "/media/username/smbshare/Music/:/media/username/smbshare/Music"
#ports:
#- "4040:4040"
restart: unless-stopped
I read this post
and added this under the traefik container and now i cant access whoami OR airsonic both inside and outside of my container... what am i missing
labels:
# ...
# middleware redirect
- "traefik.http.middlewares.redirect-to-https.redirectscheme.scheme=https"
# global redirect to https
- "traefik.http.routers.redirs.rule=hostregexp(`{host:.+}`)"
- "traefik.http.routers.redirs.entrypoints=web"
- "traefik.http.routers.redirs.middlewares=redirect-to-https"
ldez
March 29, 2020, 9:53am
2
Hello,
version: "3.3"
services:
traefik:
image: traefik:v2.2.0
container_name: traefik
command:
- --log.level=INFO
- --api.insecure=true
- --providers.docker=true
- --providers.docker.exposedbydefault=false
- --entrypoints.web.address=:80
- --entrypoints.websecure.address=:443
- --certificatesresolvers.myresolver.acme.dnschallenge=true
- --certificatesresolvers.myresolver.acme.dnschallenge.provider=cloudflare
- --certificatesresolvers.myresolver.acme.caserver=https://acme-staging-v02.api.letsencrypt.org/directory
- --certificatesresolvers.myresolver.acme.email=myperrsonalemail@gmail.com
- --certificatesresolvers.myresolver.acme.storage=/letsencrypt/acme.json # set to permissions 600
ports:
- 80:80
- 443:443
- 8080:8080
environment:
- CF_API_EMAIL=mypersonalemail@gmail.com
- CF_API_KEY=mycfapikey
volumes:
- /media/username/nfsset/containers/traefik/letsencrypt:/letsencrypt
- /var/run/docker.sock:/var/run/docker.sock:ro
labels:
traefik.enable: true
# middleware redirect
traefik.http.middlewares.redirect-to-https.redirectscheme.scheme: https
# global redirect to https
traefik.http.routers.redirs.rule: hostregexp(`{host:.+}`)
traefik.http.routers.redirs.entrypoints: web
traefik.http.routers.redirs.middlewares: redirect-to-https
whoami:
image: containous/whoami
container_name: whoami
labels:
traefik.enable: true
traefik.http.routers.whoami.rule: Host(`whoami.home.mydomain.com`)
traefik.http.routers.whoami.entrypoints: websecure
traefik.http.routers.whoami.tls.certresolver: myresolver
airsonic:
image: airsonic/airsonic
container_name: airsonic
labels:
traefik.enable: true
traefik.http.routers.airsonic.rule: Host(`airsonic.home.mydomain.com`)
traefik.http.routers.airsonic.entrypoints: websecure
traefik.http.routers.airsonic.tls.certresolver: myresolver
traefik.http.services.airsonic.loadbalancer.server.port: 4040
environment:
- PUID=1000
- PGID=1000
- TZ=America/New_York
volumes:
- /media/username/nfsset/containers/airsonic/data:/airsonic/data
- /media/username/nfsset/containers/airsonic/music:/airsonic/music
- /media/username/nfsset/containers/airsonic/playlists:/airsonic/playlists
- /media/username/nfsset/containers/airsonic/podcasts:/airsonic/podcasts
- /media/username/smbshare/Music/:/media/username/smbshare/Music
restart: unless-stopped
or
version: "3.3"
services:
traefik:
image: traefik:v2.2.0
container_name: traefik
command:
- --log.level=INFO
- --api.insecure=true
- --providers.docker=true
- --providers.docker.exposedbydefault=false
- --entrypoints.web.address=:80
- --entrypoints.web.http.redirections.entrypoint.to=:443
- --entrypoints.web.http.redirections.entrypoint.scheme=https
- --entrypoints.websecure.address=:443
- --certificatesresolvers.myresolver.acme.dnschallenge=true
- --certificatesresolvers.myresolver.acme.dnschallenge.provider=cloudflare
- --certificatesresolvers.myresolver.acme.caserver=https://acme-staging-v02.api.letsencrypt.org/directory
- --certificatesresolvers.myresolver.acme.email=myperrsonalemail@gmail.com
- --certificatesresolvers.myresolver.acme.storage=/letsencrypt/acme.json # set to permissions 600
ports:
- 80:80
- 443:443
- 8080:8080
environment:
- CF_API_EMAIL=mypersonalemail@gmail.com
- CF_API_KEY=mycfapikey
volumes:
- /media/username/nfsset/containers/traefik/letsencrypt:/letsencrypt
- /var/run/docker.sock:/var/run/docker.sock:ro
whoami:
image: containous/whoami
container_name: whoami
labels:
traefik.enable: true
traefik.http.routers.whoami.rule: Host(`whoami.home.mydomain.com`)
traefik.http.routers.whoami.entrypoints: websecure
traefik.http.routers.whoami.tls.certresolver: myresolver
airsonic:
image: airsonic/airsonic
container_name: airsonic
labels:
traefik.enable: true
traefik.http.routers.airsonic.rule: Host(`airsonic.home.mydomain.com`)
traefik.http.routers.airsonic.entrypoints: websecure
traefik.http.routers.airsonic.tls.certresolver: myresolver
traefik.http.services.airsonic.loadbalancer.server.port: 4040
environment:
- PUID=1000
- PGID=1000
- TZ=America/New_York
volumes:
- /media/username/nfsset/containers/airsonic/data:/airsonic/data
- /media/username/nfsset/containers/airsonic/music:/airsonic/music
- /media/username/nfsset/containers/airsonic/playlists:/airsonic/playlists
- /media/username/nfsset/containers/airsonic/podcasts:/airsonic/podcasts
- /media/username/smbshare/Music/:/media/username/smbshare/Music
restart: unless-stopped
I also had trying to add this labels to my traefik:
# middleware redirect
traefik.http.middlewares.redirect-to-https.redirectscheme.scheme: https
# global redirect to https
traefik.http.routers.redirs.rule: hostregexp(`{host:.+}`)
traefik.http.routers.redirs.entrypoints: web
traefik.http.routers.redirs.middlewares: redirect-to-https
But anytime when I type http://mydomain.com
I got 404 page not found
without any redirection to https.