From b49546005e4ac90946a094fe866f24ace5f47639 Mon Sep 17 00:00:00 2001 From: Kienan Stewart Date: Sat, 10 Sep 2022 16:23:15 -0400 Subject: [PATCH] Initial commit --- README.md | 21 +++++++++++++++++++++ conf.d/.gitkeep | 0 conf.d/whoami.toml | 10 ++++++++++ container-compose.prod.yml | 27 +++++++++++++++++++++++++++ container-compose.yml | 26 ++++++++++++++++++++++++++ 5 files changed, 84 insertions(+) create mode 100644 README.md create mode 100644 conf.d/.gitkeep create mode 100644 conf.d/whoami.toml create mode 100644 container-compose.prod.yml create mode 100644 container-compose.yml diff --git a/README.md b/README.md new file mode 100644 index 0000000..dba11ab --- /dev/null +++ b/README.md @@ -0,0 +1,21 @@ +# Traefik Container + +## Running in development + +``` +podman network exists web || podman network create web +podman-compose up -d +``` + +## Running in production + +``` +# Create a place to store configuration snippets for the file provider, if one +# does not yet exist. A known external volume is used since podman-compose will prefix +# non-external volumes with the project slug, making it less predictable for +# production deployments. +sudo podman volume exists traefik_config || sudo podman volume create traefik_config +sudo podman-compose up -d +``` + +It is possible to run this with a systemd service. diff --git a/conf.d/.gitkeep b/conf.d/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/conf.d/whoami.toml b/conf.d/whoami.toml new file mode 100644 index 0000000..42c8dce --- /dev/null +++ b/conf.d/whoami.toml @@ -0,0 +1,10 @@ +[http] + [http.routers] + [http.routers.whoami] + entryPoints = ["http"] + rule = "Host(`whoami.localhost`)" + service = "whoami" + [http.services] + [http.services.whoami.loadBalancer] + [[http.services.whoami.loadBalancer.servers]] + url = "http://whoami/" diff --git a/container-compose.prod.yml b/container-compose.prod.yml new file mode 100644 index 0000000..1347ce2 --- /dev/null +++ b/container-compose.prod.yml @@ -0,0 +1,27 @@ +--- +version: '3' + +networks: + web: + external: false + +volumes: + certs: + # This is defined as external since configuration management + # software will place necessary configuration snippets there. + traefik_config: + external: true + +services: + reverse-proxy: + environment: + - TRAEFIK_API_INSECURE=false + ports: + # The HTTP port + - "80:80" + # TLS + - "443:443" + volumes: + - ./traefik.toml:/traefik.toml:ro + - traefik_config:/traefik.conf.d:ro + - certs:/certs diff --git a/container-compose.yml b/container-compose.yml new file mode 100644 index 0000000..11dac7b --- /dev/null +++ b/container-compose.yml @@ -0,0 +1,26 @@ +--- +version: '3' + +networks: + web: + external: true + +services: + reverse-proxy: + image: docker.io/traefik:latest + command: + - "--configFile=/traefik.toml" + environment: + - TRAEFIK_API_INSECURE=true + ports: + # The HTTP port + - "8080:80" + # The Web UI (enabled by --api.insecure=true) + - "8081:8080" + # TLS + - "8443:443" + networks: + - web + volumes: + - ./traefik.toml:/traefik.toml:ro + - ./conf.d:/traefik.conf.d:ro