Move Traefik to its own folder and run it instead

This commit is contained in:
Kris Lamoureux 2023-11-02 21:47:55 -04:00
parent c79e0b4e8e
commit 10e2933e9c
Signed by: kris
GPG Key ID: 3EDA9C3441EDA925
3 changed files with 54 additions and 61 deletions

2
Vagrantfile vendored
View File

@ -6,7 +6,7 @@ Vagrant.configure("2") do |config|
apt-get install -y curl apt-get install -y curl
curl -fsSL https://get.docker.com | sh curl -fsSL https://get.docker.com | sh
docker swarm init docker swarm init
cd /vagrant || exit 1 cd /vagrant/traefik || exit 1
docker compose up -d docker compose up -d
SHELL SHELL
end end

View File

@ -49,63 +49,3 @@ networks:
traefik: traefik:
name: traefik_proxy_net name: traefik_proxy_net
external: true external: true
############################################################################
Traefik config
############################################################################
version: "3.3"
services:
traefik:
image: "traefik:v2.10"
networks:
- proxy_net
command:
- "--log.level=TRACE"
- "--certificatesresolvers.myresolver.acme.caserver=https://acme-staging-v02.api.letsencrypt.org/directory"
#- "--log.level=DEBUG"
- "--api.insecure=true"
- "--api.dashboard=true"
- "--providers.docker=true"
# - "--providers.docker.swarmMode=true"
- "--providers.docker.exposedbydefault=false"
- "--entrypoints.web.address=:80"
- "--entrypoints.websecure.address=:443"
- "--certificatesresolvers.myresolver.acme.httpchallenge=true"
- "--certificatesresolvers.myresolver.acme.httpchallenge.entrypoint=web"
#- "--certificatesresolvers.myresolver.acme.caserver=https://acme-staging-v02.api.letsencrypt.org/directory"
- "--certificatesresolvers.myresolver.acme.email=noreply@example.com"
- "--certificatesresolvers.myresolver.acme.storage=/letsencrypt/acme.json"
ports:
- "80:80"
- "443:443"
volumes:
- "./letsencrypt:/letsencrypt"
- "/var/run/docker.sock:/var/run/docker.sock:ro"
labels:
- "traefik.enable=true"
- "traefik.http.routers.traefik.rule=Host(`traefik.local.coulter.info`)"
- "traefik.http.routers.traefik.entrypoints=websecure"
- "traefik.http.routers.traefik.middlewares=localonly"
- "traefik.http.routers.traefik.service=api@internal"
- "traefik.http.routers.traefik.tls=true"
- "traefik.http.middlewares.localonly.ipwhitelist.sourcerange=10.0.0.0/8"
whoami:
image: "traefik/whoami"
networks:
- proxy_net
labels:
- "traefik.enable=true"
- "traefik.http.routers.whoami.rule=Host(`whoami.local.coulter.info`)"
- "traefik.http.routers.whoami.entrypoints=websecure"
- "traefik.http.routers.whoami.tls.certresolver=myresolver"
- "traefik.http.routers.whoami.tls=true"
- "traefik.http.services.whoami.loadbalancer.server.port=80"
- "traefik.docker.network=proxy_net"
networks:
proxy_net:

View File

@ -0,0 +1,53 @@
version: "3.3"
services:
traefik:
image: "traefik:v2.10"
networks:
- proxy_net
command:
- "--log.level=TRACE"
- "--certificatesresolvers.myresolver.acme.caserver=https://acme-staging-v02.api.letsencrypt.org/directory"
#- "--log.level=DEBUG"
- "--api.insecure=true"
- "--api.dashboard=true"
- "--providers.docker=true"
# - "--providers.docker.swarmMode=true"
- "--providers.docker.exposedbydefault=false"
- "--entrypoints.web.address=:80"
- "--entrypoints.websecure.address=:443"
- "--certificatesresolvers.myresolver.acme.httpchallenge=true"
- "--certificatesresolvers.myresolver.acme.httpchallenge.entrypoint=web"
#- "--certificatesresolvers.myresolver.acme.caserver=https://acme-staging-v02.api.letsencrypt.org/directory"
- "--certificatesresolvers.myresolver.acme.email=noreply@example.com"
- "--certificatesresolvers.myresolver.acme.storage=/letsencrypt/acme.json"
ports:
- "80:80"
- "443:443"
volumes:
- "./letsencrypt:/letsencrypt"
- "/var/run/docker.sock:/var/run/docker.sock:ro"
labels:
- "traefik.enable=true"
- "traefik.http.routers.traefik.rule=Host(`traefik.local.coulter.info`)"
- "traefik.http.routers.traefik.entrypoints=websecure"
- "traefik.http.routers.traefik.middlewares=localonly"
- "traefik.http.routers.traefik.service=api@internal"
- "traefik.http.routers.traefik.tls=true"
- "traefik.http.middlewares.localonly.ipwhitelist.sourcerange=10.0.0.0/8"
whoami:
image: "traefik/whoami"
networks:
- proxy_net
labels:
- "traefik.enable=true"
- "traefik.http.routers.whoami.rule=Host(`whoami.local.coulter.info`)"
- "traefik.http.routers.whoami.entrypoints=websecure"
- "traefik.http.routers.whoami.tls.certresolver=myresolver"
- "traefik.http.routers.whoami.tls=true"
- "traefik.http.services.whoami.loadbalancer.server.port=80"
- "traefik.docker.network=proxy_net"
networks:
proxy_net: