switch supysonic to fcgi

This commit is contained in:
vincent 2022-05-11 18:06:50 +02:00
parent e5ea720753
commit af02cacb12

View File

@ -13,38 +13,84 @@ job "supysonic" {
group "supysonic"{ group "supysonic"{
network { network {
mode = "host" mode = "host"
port "http" { port "fcgi" {
to = 5000 to = 5000
} }
port "http" {
to=80
}
} }
vault{ vault{
policies= ["access-tables"] policies= ["access-tables"]
} }
task "server" { service {
name = "supysonic"
port = "http"
tags = [
"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",
]
}
task "frontend" {
driver = "docker" driver = "docker"
service { config {
name = "supysonic" image= "nginx:alpine"
port = "http" ports= [
tags = [ "http"
"traefik.enable=true", ]
"traefik.http.routers.${NOMAD_JOB_NAME}.rule=Host(`${NOMAD_JOB_NAME}.ducamps.win`)", volumes = [
"traefik.http.routers.${NOMAD_JOB_NAME}.tls.domains[0].sans=${NOMAD_JOB_NAME}.ducamps.win", "etc/nginx/nginx.conf:/etc/nginx/nginx.conf",
"traefik.http.routers.${NOMAD_JOB_NAME}.tls.certresolver=myresolver",
] ]
} }
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"
}
}
task "server" {
driver = "docker"
config { config {
image = "ogarcia/supysonic:full-sql" image = "ogarcia/supysonic:full-sql"
ports = ["http"] ports = ["fcgi"]
force_pull= true
volumes = [ volumes = [
"/mnt/diskstation/music:/mnt/diskstation/music" "/mnt/diskstation/music:/mnt/diskstation/music"
] ]
} }
env { env {
SUPYSONIC_RUN_MODE= "standalone" SUPYSONIC_RUN_MODE= "fcgi-port"
SUPYSONIC_DAEMON_ENABLED = "true" SUPYSONIC_DAEMON_ENABLED = "true"
SUPYSONIC_WEBAPP_LOG_LEVEL = "WARNING" SUPYSONIC_WEBAPP_LOG_LEVEL = "WARNING"
SUPYSONIC_DAEMON_LOG_LEVEL = "INFO" SUPYSONIC_DAEMON_LOG_LEVEL = "INFO"