homelab/nomad-job/supysonic.nomad

134 lines
3.3 KiB
Plaintext
Raw Normal View History

2022-04-30 19:09:21 +00:00
job "supysonic" {
2022-10-14 11:08:10 +00:00
datacenters = ["homelab"]
2022-12-10 16:10:32 +00:00
priority = 90
2022-10-29 08:40:01 +00:00
type = "service"
2022-04-30 19:09:21 +00:00
meta {
2023-04-16 17:27:05 +00:00
forcedeploy = "1"
2022-04-30 19:09:21 +00:00
}
constraint {
attribute = "${attr.cpu.arch}"
2022-10-29 08:40:01 +00:00
value = "amd64"
2022-04-30 19:09:21 +00:00
}
2022-10-29 08:40:01 +00:00
group "supysonic" {
2022-04-30 19:09:21 +00:00
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" {
2022-10-29 08:40:01 +00:00
to = 80
2022-05-11 16:06:50 +00:00
}
2022-04-30 19:09:21 +00:00
}
2022-10-29 08:40:01 +00:00
vault {
2022-10-30 08:33:39 +00:00
policies = ["supysonic"]
2022-04-30 19:09:21 +00:00
}
2022-05-11 16:06:50 +00:00
service {
name = "supysonic"
port = "http"
tags = [
2022-10-29 08:40:01 +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-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-07 16:40:40 +00:00
"traefik.http.routers.${NOMAD_JOB_NAME}.entrypoints=web,websecure",
2022-05-11 16:06:50 +00:00
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 {
2022-10-29 08:40:01 +00:00
image = "nginx:alpine"
ports = [
2022-05-11 16:06:50 +00:00
"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 {
2022-10-29 08:40:01 +00:00
data = <<EOH
2022-05-11 16:06:50 +00:00
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-10-29 08:40:01 +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 {
2023-04-16 17:27:05 +00:00
image = "ducampsv/supysonic:latest"
2022-10-29 08:40:01 +00:00
ports = ["fcgi"]
force_pull = true
2022-04-30 19:09:21 +00:00
volumes = [
"/mnt/diskstation/music:/mnt/diskstation/music"
]
}
env {
2022-10-29 08:40:01 +00:00
SUPYSONIC_RUN_MODE = "fcgi-port"
SUPYSONIC_DAEMON_ENABLED = "true"
2023-01-28 10:10:33 +00:00
SUPYSONIC_WEBAPP_LOG_LEVEL = "DEBUG"
2022-10-29 08:40:01 +00:00
SUPYSONIC_DAEMON_LOG_LEVEL = "INFO"
2023-04-16 17:27:05 +00:00
SUPYSONIC_LDAP_SERVER = "LDAP://ldap.ducamps.win"
SUPYSONIC_LDAP_BASE_DN = "dc=ducamps,dc=win"
SUPYSONIC_LDAP_USER_FILTER = "(&(memberOf=CN=SupysonicUsers,cn=groups,dc=ducamps,dc=win))"
SUPYSONIC_LDAP_ADMIN_FILTER= "(&(memberOf=CN=SupysonicAdmins,cn=groups,dc=ducamps,dc=win))"
2022-04-30 19:09:21 +00:00
}
template {
2022-10-29 08:40:01 +00:00
data = <<EOH
2022-10-30 08:33:39 +00:00
{{ with secret "secrets/data/database/supysonic"}}
2023-11-01 07:42:04 +00:00
SUPYSONIC_DB_URI = "postgres://supysonic:{{ .Data.data.password}}@active.db.service.consul/supysonic"
2022-04-30 19:09:21 +00:00
{{end}}
2023-04-16 17:27:05 +00:00
{{ with secret "secrets/data/nomad/supysonic"}}
SUPYSONIC_LDAP_BIND_DN = "{{ .Data.data.serviceAccountName }}"
SUPYSONIC_LDAP_BIND_PASSWORD = "{{ .Data.data.serviceAccountPassword }}"
{{ end }}
2022-04-30 19:09:21 +00:00
EOH
destination = "secrets/supysonic.env"
2022-10-29 08:40:01 +00:00
env = true
2022-04-30 19:09:21 +00:00
}
2022-05-12 09:36:04 +00:00
resources {
memory = 256
}
2022-04-30 19:09:21 +00:00
}
}
}