Skip to content

Instantly share code, notes, and snippets.

@atomicwrites
Last active May 31, 2020 13:04
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save atomicwrites/79b32e0688702f2df58d54faa8481482 to your computer and use it in GitHub Desktop.
Save atomicwrites/79b32e0688702f2df58d54faa8481482 to your computer and use it in GitHub Desktop.
Traefic setup
traefik_proxy
- dversion: "2" # should probably be 3
volumes:
gitea:
services:
server:
image: gitea/gitea:latest
restart: always
networks:
- traefik_proxy
- default
volumes:
- gitea:/data
ports:
# - "3000:3000" # Serves on port 3000 by default, but dont expose it cause we're using traefic.
- "22:22" # Change if you're already running ssh on port 22 (or change your regular ssh port).
labels:
- "traefik.enable=true"
- "traefik.port=3000" # Which port the container serves on, usually 80 but not for gitea.
- "traefik.frontend.rule=Host:git.your.domain" # Subdomain to use, change for each service.
networks:
traefik_proxy:
external: true # IMPORTANT
version: '3'
services:
reverse-proxy:
#image: traefik:alpine # The official Traefik docker image
build: ./traefik-library-image/alpine # This is for some lets encrypt dns cert shenanigans, you can probably just pull the image.
command:
- "--debug" # I dont think i need that, might want to remove it
ports:
- "80:80"
- "443:443"
- "8080:8080" # The Web UI (enabled by `api`)
volumes:
- /var/run/docker.sock:/var/run/docker.sock # So that Traefik can listen to the Docker events
- ./traefik.toml:/etc/traefik/traefik.toml
- ./acme:/acme # Cert generation stuf
- ./namesilo-dns.sh:/namesilo-dns.sh # <-- this too
environment:
- EXEC_PATH=/namesilo-dns.sh # <-- and this
networks:
- proxy
networks:
proxy:
driver: bridge # Isn't that the default?46
dashboard = trueversion: "2"
volumes:
gitea:
services:
server:
image: gitea/gitea:latest
restart: always
networks:
- traefik_proxy
- default
volumes:
- gitea:/data
ports:
- "3000:3000"
- "10022:22"
labels:
- "traefik.enable=true"
- "traefik.port=3000"
- "traefik.frontend.rule=Host:git.atomicwrites.cc"
networks:
traefik_proxy:
external: true
defaultEntryPoints = ["http", "https"] # These are added to every route automatically
[entryPoints]
[entryPoints.http]
address = ":80"
[entryPoints.http.redirect] # Get rid of this and the https entry point if your not using https
entryPoint = "https"
[entryPoints.https]
address = ":443"
[entryPoints.https.tls]
#[entryPoints.traefik] not sure what this was, something about the webui i think but its comented in my working config
[docker]
domain = "your.domain"
watch = true # Auto aply new settings from lables
exposedbydefault = false # will expose every container automatically if true.
network = "traefik_proxy" # the network joining traefic and your containers
[acme]
# This is all cert generation stuf, and set up for dns wildcard verification on
# my weird registrar, so just use the docs if you want ssl.
#caServer = "https://acme-staging-v02.api.letsencrypt.org/directory" # Use this in testing to avoid hitting the rate limit.
email = "me@gmail.com"
entryPoint = "https"
storage = "acme/acme.json"
[[acme.domains]]
main = "*.your.domain"
sans = ["your.domain"]
[acme.dnsChallenge]
provider = "exec"
delayBeforeCheck = 930 # NameSilo updates dns every 15m.
[api]
# Name of the related entry point
#
# Optional
# Default: "traefik"
#
entryPoint = "traefik"
# Enable Dashboard
#
# Optional
# Default: true
#
dashboard = true
# Enable debug mode.
# This will install HTTP handlers to expose Go expvars under /debug/vars and
# pprof profiling data under /debug/pprof/.
# Additionally, the log level will be set to DEBUG.
#
# Optional
# Default: false
#
debug = false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment