homelab/nomad-job/www.nomad

87 lines
2.2 KiB
Plaintext
Raw Normal View History

2022-05-12 09:36:51 +00:00
job "www" {
datacenters = ["hetzner"]
2022-12-10 16:10:32 +00:00
priority = 90
2022-10-29 08:40:01 +00:00
type = "service"
2022-05-12 09:36:51 +00:00
group "www" {
network {
mode = "host"
port "http" {
2022-10-29 08:40:01 +00:00
to = 80
2022-05-12 09:36:51 +00:00
host_network = "private"
}
}
service {
2022-10-29 08:40:01 +00:00
name = "www"
tags = [
"homer.enable=true",
"homer.name=Website",
"homer.service=Application",
"homer.icon=fas fa-blog",
"homer.target=_blank",
"homer.url=https://www.ducamps.win",
2022-05-23 19:44:34 +00:00
2022-10-29 08:40:01 +00:00
"traefik.enable=true",
"traefik.http.routers.${NOMAD_JOB_NAME}.rule=Host(`${NOMAD_JOB_NAME}.ducamps.win`)",
"traefik.http.routers.${NOMAD_JOB_NAME}.tls.domains[0].sans=${NOMAD_JOB_NAME}.ducamps.win",
"traefik.http.routers.${NOMAD_JOB_NAME}.tls.certresolver=myresolver",
2023-10-14 07:14:26 +00:00
"traefik.http.routers.${NOMAD_JOB_NAME}.entrypoints=web,websecure",
2022-10-10 19:22:57 +00:00
2022-10-29 08:40:01 +00:00
"traefik.http.routers.default.rule=Host(`ducamps.win`)",
2023-10-14 07:14:26 +00:00
"traefik.http.routers.default.entrypoints=web,websecure",
2022-10-29 08:40:01 +00:00
"traefik.http.routers.default.tls.domains[0].sans=ducamps.win",
"traefik.http.routers.default.tls.certresolver=myresolver",
]
port = "http"
2022-05-12 09:36:51 +00:00
}
task "server" {
driver = "docker"
config {
image = "nginx"
ports = [
"http"
]
2022-10-29 08:40:01 +00:00
volumes = [
2022-05-12 09:36:51 +00:00
"local/nginx.conf:/etc/nginx/nginx.conf",
"/srv/http:/usr/share/nginx/html"
]
}
2022-10-29 08:40:01 +00:00
template {
data = <<EOH
2022-05-12 09:36:51 +00:00
worker_processes auto;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
access_log /dev/stdout;
error_log /dev/stderr warn;
server {
listen 80;
root /usr/share/nginx/html;
error_page 404 /404/404.html;
error_page 500 502 503 504 /50x.html;
location / {
rewrite ^/.well-known/carddav /radicale/$remote_user/carddav/ redirect;
rewrite ^/.well-known/caldav /radicale/$remote_user/caldav/ redirect;
index index.html index.htm ;
default_type text/html;
}
location =/ {
rewrite ^ /welcome;
}
}
}
EOH
2022-10-29 08:40:01 +00:00
destination = "local/nginx.conf"
2022-05-12 09:36:51 +00:00
}
resources {
memory = 50
}
}
}
}