Setup HTTPS

This commit is contained in:
2025-04-30 02:02:17 +10:00
parent 8bb9fb18df
commit 557b187c30
6 changed files with 88 additions and 21 deletions

View File

@@ -5,6 +5,10 @@ job "traefik" {
static = 80
}
port "https" {
static = 443
}
port "api" {
static = 8081
}
@@ -29,6 +33,12 @@ job "traefik" {
}
}
volume "traefik" {
type = "host"
read_only = false
source = "traefik"
}
task "traefik" {
driver = "docker"
@@ -38,18 +48,33 @@ job "traefik" {
volumes = [
"local/traefik.yml:/etc/traefik/traefik.yml",
"local/configs/:/etc/traefik/configs/",
"local/configs/:/etc/traefik/configs/"
]
}
volume_mount {
volume = "traefik"
destination = "/opt/traefik"
read_only = false
}
template {
data = <<EOF
entryPoints:
http:
web:
address: ":80"
http:
redirections:
entryPoint:
to: websecure
scheme: https
websecure:
address: ":443"
http:
middlewares:
- auth
- auth@file
tls:
certResolver: letsencrypt
traefik:
address: ":8081"
@@ -68,6 +93,14 @@ providers:
endpoint:
address: "127.0.0.1:8500"
scheme: "http"
certificatesResolvers:
letsencrypt:
acme:
email: "othrayte@gmail.com"
storage: "/opt/traefik/acme.json"
httpChallenge:
entryPoint: web
EOF
destination = "local/traefik.yml"