site/template.nomad

54 lines
1.3 KiB
Plaintext
Raw Normal View History

job "site" {
2023-02-12 08:44:44 +00:00
region = "global"
datacenters = ["dc1"]
type = "service"
group "site" {
count = 2
network {
port "nginx" {
to = 80
}
}
task "nginx" {
driver = "docker"
env {
// Hack to force Nomad to re-deploy the service
// instead of ignoring it
COMMIT_SHA = "${DRONE_COMMIT_SHA}"
}
config {
image = "nginx:latest"
ports = ["nginx"]
volumes = ["local/site/public:/usr/share/nginx/html:ro"]
}
artifact {
2023-05-04 00:01:53 +00:00
source = "https://api.minio.elara.ws/site/site.tar.gz"
2023-02-12 08:44:44 +00:00
destination = "local/site"
}
service {
name = "site"
port = "nginx"
tags = [
"traefik.enable=true",
2023-05-04 00:01:53 +00:00
"traefik.http.middlewares.site-redir.redirectRegex.regex=^https://elara\\.ws",
"traefik.http.middlewares.site-redir.redirectRegex.replacement=https://www.elara.ws",
2023-02-12 08:44:44 +00:00
"traefik.http.middlewares.site-redir.redirectRegex.permanent=true",
2023-05-04 00:01:53 +00:00
"traefik.http.routers.site.rule=Host(`elara.ws`) || Host(`www.elara.ws`)",
2023-02-12 08:44:44 +00:00
"traefik.http.routers.site.middlewares=site-redir",
"traefik.http.routers.site.tls.certResolver=letsencrypt",
]
}
}
}
}