homelab/nomad-job/supysonic.nomad

124 lines
2.6 KiB
Plaintext
Raw Normal View History

2022-04-30 19:09:21 +00:00
job "supysonic" {
2022-09-09 15:19:07 +00:00
datacenters = ["hetzner"]
2022-04-30 19:09:21 +00:00
type = "service"
meta {
forcedeploy = "0"
}
constraint {
attribute = "${attr.cpu.arch}"
value = "amd64"
}
group "supysonic"{
network {
mode = "host"
2022-05-11 16:06:50 +00:00
port "fcgi" {
2022-04-30 19:09:21 +00:00
to = 5000
}
2022-05-11 16:06:50 +00:00
port "http" {
to=80
}
2022-04-30 19:09:21 +00:00
}
vault{
policies= ["access-tables"]
}
2022-05-11 16:06:50 +00:00
service {
name = "supysonic"
port = "http"
tags = [
2022-05-23 19:44:34 +00:00
"homer.enable=true",
"homer.name=Supysonic",
"homer.service=Application",
"homer.icon=fas fa-headphones",
"homer.target=_blank",
"homer.url=http://${NOMAD_JOB_NAME}.ducamps.win",
2022-05-11 16:06:50 +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",
2022-04-30 19:09:21 +00:00
2022-05-11 16:06:50 +00:00
]
}
2022-04-30 19:09:21 +00:00
2022-05-12 09:36:04 +00:00
task "supysonic-frontend" {
2022-05-11 16:06:50 +00:00
driver = "docker"
config {
image= "nginx:alpine"
ports= [
"http"
]
volumes = [
"etc/nginx/nginx.conf:/etc/nginx/nginx.conf",
2022-04-30 19:09:21 +00:00
]
}
2022-05-11 16:06:50 +00:00
template {
data = <<EOH
worker_processes auto;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
server {
listen 80;
server_name localhost;
location / {
try_files $uri @flaskr;
}
location @flaskr {
include fastcgi_params;
fastcgi_param SCRIPT_NAME "";
fastcgi_param PATH_INFO $fastcgi_script_name;
fastcgi_pass {{env "NOMAD_ADDR_fcgi"}};
}
}
}
EOH
destination = "etc/nginx/nginx.conf"
}
2022-05-12 09:36:04 +00:00
resources {
memory = 75
}
2022-05-11 16:06:50 +00:00
}
2022-05-12 09:36:04 +00:00
task "supysonic-server" {
2022-05-11 16:06:50 +00:00
driver = "docker"
2022-04-30 19:09:21 +00:00
config {
2022-05-02 19:35:38 +00:00
image = "ogarcia/supysonic:full-sql"
2022-05-11 16:06:50 +00:00
ports = ["fcgi"]
force_pull= true
2022-04-30 19:09:21 +00:00
volumes = [
"/mnt/diskstation/music:/mnt/diskstation/music"
]
}
env {
2022-05-11 16:06:50 +00:00
SUPYSONIC_RUN_MODE= "fcgi-port"
2022-04-30 19:09:21 +00:00
SUPYSONIC_DAEMON_ENABLED = "true"
SUPYSONIC_WEBAPP_LOG_LEVEL = "WARNING"
SUPYSONIC_DAEMON_LOG_LEVEL = "INFO"
}
template {
data= <<EOH
{{ with secret "secrets/data/supysonic"}}
SUPYSONIC_DB_URI = "postgres://supysonic:{{ .Data.data.db_password}}@db1.ducamps.win/supysonic"
{{end}}
EOH
destination = "secrets/supysonic.env"
env = true
}
2022-05-12 09:36:04 +00:00
resources {
memory = 256
}
2022-04-30 19:09:21 +00:00
}
}
}