2021-05-12 12:22:48 +02:00
|
|
|
job "ingress" {
|
2022-03-23 10:36:25 +01:00
|
|
|
datacenters = [ "do-1", "homelab-1" ]
|
2021-05-12 12:22:48 +02:00
|
|
|
type = "service"
|
|
|
|
|
2022-03-23 10:36:25 +01:00
|
|
|
group "ingress-toothpick" {
|
2021-05-12 12:22:48 +02:00
|
|
|
count = 1
|
|
|
|
|
2022-03-23 10:36:25 +01:00
|
|
|
constraint {
|
|
|
|
attribute = "${attr.unique.hostname}"
|
|
|
|
value = "toothpick"
|
|
|
|
}
|
|
|
|
|
2021-05-14 00:04:14 +02:00
|
|
|
volume "ingress-letsencrypt" {
|
|
|
|
type = "csi"
|
|
|
|
source = "ingress-letsencrypt"
|
|
|
|
read_only = false
|
2021-06-23 11:41:06 +02:00
|
|
|
|
|
|
|
attachment_mode = "file-system"
|
|
|
|
access_mode = "single-node-writer"
|
2021-05-14 00:04:14 +02:00
|
|
|
}
|
|
|
|
|
2021-05-12 12:22:48 +02:00
|
|
|
network {
|
2021-06-23 11:41:06 +02:00
|
|
|
mode = "bridge"
|
2021-05-12 12:22:48 +02:00
|
|
|
port "http" {
|
2021-08-13 16:42:39 +02:00
|
|
|
static = 80
|
|
|
|
to = 80
|
2021-06-23 11:41:06 +02:00
|
|
|
host_network = "public"
|
2021-05-12 12:22:48 +02:00
|
|
|
}
|
2021-05-14 00:04:14 +02:00
|
|
|
|
|
|
|
port "https" {
|
2021-08-13 16:42:39 +02:00
|
|
|
static = 443
|
|
|
|
to = 443
|
2021-06-23 11:41:06 +02:00
|
|
|
host_network = "public"
|
2021-05-14 00:04:14 +02:00
|
|
|
}
|
2021-12-12 22:31:33 +01:00
|
|
|
|
|
|
|
port "minecraft" {
|
|
|
|
static = 25565
|
|
|
|
to = 25565
|
|
|
|
host_network = "public"
|
|
|
|
}
|
2021-05-12 12:22:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
service {
|
2022-03-23 10:36:25 +01:00
|
|
|
name = "ingress-toothpick"
|
2021-05-12 12:22:48 +02:00
|
|
|
port = "http"
|
2021-06-23 11:41:06 +02:00
|
|
|
|
|
|
|
connect {
|
|
|
|
sidecar_service {
|
|
|
|
proxy {
|
|
|
|
upstreams {
|
|
|
|
destination_name = "gitea"
|
|
|
|
local_bind_port = 3000
|
|
|
|
datacenter = "homelab-1"
|
|
|
|
|
|
|
|
mesh_gateway {
|
|
|
|
mode = "local"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
upstreams {
|
|
|
|
destination_name = "hydra"
|
|
|
|
local_bind_port = 8666
|
|
|
|
datacenter = "homelab-1"
|
|
|
|
|
|
|
|
mesh_gateway {
|
|
|
|
mode = "local"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
upstreams {
|
|
|
|
destination_name = "nextcloud"
|
|
|
|
local_bind_port = 8777
|
|
|
|
datacenter = "homelab-1"
|
|
|
|
|
|
|
|
mesh_gateway {
|
|
|
|
mode = "local"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
upstreams {
|
|
|
|
destination_name = "website"
|
|
|
|
local_bind_port = 8080
|
|
|
|
datacenter = "homelab-1"
|
|
|
|
|
|
|
|
mesh_gateway {
|
|
|
|
mode = "local"
|
|
|
|
}
|
|
|
|
}
|
2021-12-12 22:31:33 +01:00
|
|
|
|
|
|
|
upstreams {
|
|
|
|
destination_name = "minecraft"
|
|
|
|
local_bind_port = 2666
|
|
|
|
datacenter = "homelab-1"
|
|
|
|
|
|
|
|
mesh_gateway {
|
|
|
|
mode = "local"
|
|
|
|
}
|
|
|
|
}
|
2022-04-26 09:45:52 +02:00
|
|
|
|
|
|
|
upstreams {
|
|
|
|
destination_name = "reicio"
|
|
|
|
local_bind_port = 8000
|
|
|
|
datacenter = "homelab-1"
|
|
|
|
|
|
|
|
mesh_gateway {
|
|
|
|
mode = "local"
|
|
|
|
}
|
|
|
|
}
|
2021-06-23 11:41:06 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-05-12 12:22:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
task "nginx" {
|
|
|
|
driver = "docker"
|
|
|
|
|
2021-05-14 00:04:14 +02:00
|
|
|
volume_mount {
|
|
|
|
volume = "ingress-letsencrypt"
|
|
|
|
destination = "/etc/letsencrypt"
|
|
|
|
read_only = false
|
|
|
|
}
|
|
|
|
|
2021-10-18 00:12:19 +02:00
|
|
|
# artifact {
|
|
|
|
# source = "http://hydra/build/99/download/1/image.tar.gz"
|
|
|
|
# }
|
|
|
|
|
2021-05-12 12:22:48 +02:00
|
|
|
config {
|
2021-10-18 00:12:19 +02:00
|
|
|
# load = "nixng-ingress.tar.gz"
|
2021-05-12 12:22:48 +02:00
|
|
|
image = "nixng-ingress:local"
|
2021-10-18 00:12:19 +02:00
|
|
|
|
2021-12-12 22:31:33 +01:00
|
|
|
ports = ["http", "https", "minecraft"]
|
|
|
|
memory_hard_limit = 128
|
2021-05-14 00:04:14 +02:00
|
|
|
}
|
|
|
|
|
2021-06-23 11:41:06 +02:00
|
|
|
resources {
|
|
|
|
cpu = 200
|
|
|
|
memory = 32
|
|
|
|
}
|
|
|
|
|
2021-05-14 00:04:14 +02:00
|
|
|
template {
|
|
|
|
data = <<EOF
|
|
|
|
ssl_certificate_key /etc/letsencrypt/live/redalder.org/privkey.pem;
|
|
|
|
ssl_certificate /etc/letsencrypt/live/redalder.org/fullchain.pem;
|
|
|
|
|
|
|
|
ssl_session_cache shared:le_nginx_SSL:10m;
|
|
|
|
ssl_session_timeout 1440m;
|
|
|
|
ssl_session_tickets off;
|
|
|
|
|
|
|
|
ssl_protocols TLSv1.2 TLSv1.3;
|
|
|
|
ssl_prefer_server_ciphers off;
|
|
|
|
|
|
|
|
ssl_ciphers "ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384";
|
|
|
|
EOF
|
|
|
|
destination = "local/ssl.conf"
|
|
|
|
change_mode = "signal"
|
|
|
|
change_signal = "SIGHUP"
|
|
|
|
}
|
|
|
|
|
|
|
|
template {
|
|
|
|
data = <<EOF
|
|
|
|
proxy_set_header Host $host;
|
|
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
|
|
EOF
|
|
|
|
destination = "local/headers.conf"
|
|
|
|
change_mode = "signal"
|
|
|
|
change_signal = "SIGHUP"
|
|
|
|
}
|
|
|
|
|
|
|
|
template {
|
|
|
|
data = <<EOF
|
|
|
|
add_header X-Frame-Options "SAMEORIGIN";
|
|
|
|
add_header Content-Security-Policy "default-src 'self' http: https: data: blob: 'unsafe-inline'" always;
|
|
|
|
EOF
|
|
|
|
destination = "local/security.conf"
|
|
|
|
change_mode = "signal"
|
|
|
|
change_signal = "SIGHUP"
|
2021-05-12 12:22:48 +02:00
|
|
|
}
|
|
|
|
|
2021-12-12 22:31:33 +01:00
|
|
|
template {
|
|
|
|
data = <<EOF
|
|
|
|
upstream minecraft {
|
|
|
|
server {{ env "NOMAD_UPSTREAM_ADDR_minecraft" }};
|
|
|
|
}
|
|
|
|
|
|
|
|
server {
|
|
|
|
listen 25565;
|
|
|
|
|
|
|
|
proxy_pass minecraft;
|
|
|
|
}
|
|
|
|
EOF
|
|
|
|
destination = "local/streams.conf"
|
|
|
|
change_mode = "signal"
|
|
|
|
change_signal = "SIGHUP"
|
|
|
|
}
|
|
|
|
|
2021-05-12 12:22:48 +02:00
|
|
|
template {
|
|
|
|
data = <<EOF
|
|
|
|
upstream gitea {
|
2021-06-23 11:41:06 +02:00
|
|
|
server {{ env "NOMAD_UPSTREAM_ADDR_gitea" }};
|
2021-05-12 12:22:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
upstream hydra {
|
2021-06-23 11:41:06 +02:00
|
|
|
server {{ env "NOMAD_UPSTREAM_ADDR_hydra" }};
|
2021-05-12 12:22:48 +02:00
|
|
|
}
|
|
|
|
|
2021-05-12 17:31:15 +02:00
|
|
|
upstream nextcloud {
|
2021-06-23 11:41:06 +02:00
|
|
|
server {{ env "NOMAD_UPSTREAM_ADDR_nextcloud" }};
|
2021-05-12 17:31:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
upstream website {
|
2021-06-23 11:41:06 +02:00
|
|
|
server {{ env "NOMAD_UPSTREAM_ADDR_website" }};
|
2021-05-12 17:31:15 +02:00
|
|
|
}
|
|
|
|
|
2022-04-26 09:45:52 +02:00
|
|
|
upstream reicio {
|
|
|
|
server {{ env "NOMAD_UPSTREAM_ADDR_reicio" }};
|
|
|
|
}
|
|
|
|
|
2021-05-12 12:22:48 +02:00
|
|
|
server {
|
2021-05-14 00:04:14 +02:00
|
|
|
listen 443 ssl;
|
2021-05-12 12:22:48 +02:00
|
|
|
|
|
|
|
server_name _;
|
|
|
|
|
2021-05-14 00:04:14 +02:00
|
|
|
include /local/ssl.conf;
|
|
|
|
|
2021-05-12 12:22:48 +02:00
|
|
|
return 404;
|
|
|
|
}
|
|
|
|
|
|
|
|
server {
|
2021-05-14 00:04:14 +02:00
|
|
|
listen 443 ssl;
|
2021-05-12 12:22:48 +02:00
|
|
|
|
|
|
|
server_name gitea.redalder.org;
|
|
|
|
|
2021-05-14 00:04:14 +02:00
|
|
|
include /local/security.conf;
|
|
|
|
include /local/ssl.conf;
|
2021-05-12 12:22:48 +02:00
|
|
|
|
2021-06-23 11:41:06 +02:00
|
|
|
client_max_body_size 100M;
|
|
|
|
|
2021-05-12 12:22:48 +02:00
|
|
|
location / {
|
2021-05-14 00:04:14 +02:00
|
|
|
include /local/headers.conf;
|
2021-05-12 12:22:48 +02:00
|
|
|
proxy_pass http://gitea;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
server {
|
2021-05-14 00:04:14 +02:00
|
|
|
listen 443 ssl;
|
2021-05-12 12:22:48 +02:00
|
|
|
|
|
|
|
server_name hydra.redalder.org;
|
|
|
|
|
2021-05-14 00:04:14 +02:00
|
|
|
include /local/security.conf;
|
|
|
|
include /local/ssl.conf;
|
2021-05-12 12:22:48 +02:00
|
|
|
|
|
|
|
location / {
|
2021-05-14 00:04:14 +02:00
|
|
|
include /local/headers.conf;
|
2021-05-12 12:22:48 +02:00
|
|
|
proxy_pass http://hydra;
|
|
|
|
}
|
|
|
|
}
|
2021-05-12 17:31:15 +02:00
|
|
|
|
|
|
|
server {
|
2021-05-14 00:04:14 +02:00
|
|
|
listen 443 ssl;
|
2021-05-12 17:31:15 +02:00
|
|
|
|
2021-05-14 00:04:14 +02:00
|
|
|
server_name redalder.org nixng.org;
|
2021-05-12 17:31:15 +02:00
|
|
|
|
2021-05-14 00:04:14 +02:00
|
|
|
include /local/security.conf;
|
|
|
|
include /local/ssl.conf;
|
2021-05-12 17:31:15 +02:00
|
|
|
|
|
|
|
location /nextcloud/ {
|
2021-05-14 00:04:14 +02:00
|
|
|
include /local/headers.conf;
|
2021-05-12 17:31:15 +02:00
|
|
|
proxy_pass http://nextcloud/;
|
|
|
|
}
|
|
|
|
|
2022-04-26 09:45:52 +02:00
|
|
|
location /reicio/ {
|
|
|
|
include /local/headers.conf;
|
|
|
|
proxy_pass http://reicio/;
|
|
|
|
}
|
|
|
|
|
2021-05-12 17:31:15 +02:00
|
|
|
location / {
|
2021-05-14 00:04:14 +02:00
|
|
|
include /local/headers.conf;
|
2021-05-12 17:31:15 +02:00
|
|
|
proxy_pass http://website;
|
|
|
|
}
|
|
|
|
}
|
2021-05-12 12:22:48 +02:00
|
|
|
EOF
|
|
|
|
destination = "local/upstreams.conf"
|
|
|
|
change_mode = "signal"
|
|
|
|
change_signal = "SIGHUP"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-03-23 10:36:25 +01:00
|
|
|
|
|
|
|
group "ingress-blowhole" {
|
|
|
|
count = 1
|
|
|
|
|
|
|
|
constraint {
|
|
|
|
attribute = "${attr.unique.hostname}"
|
|
|
|
value = "blowhole"
|
|
|
|
}
|
|
|
|
|
|
|
|
network {
|
|
|
|
mode = "bridge"
|
|
|
|
port "http" {
|
|
|
|
static = 8080
|
|
|
|
to = 80
|
|
|
|
}
|
|
|
|
|
|
|
|
port "https" {
|
|
|
|
static = 443
|
|
|
|
to = 443
|
|
|
|
}
|
|
|
|
|
|
|
|
port "jellyfin" {
|
|
|
|
static = 8096
|
|
|
|
to = 8096
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
service {
|
|
|
|
name = "ingress-blowhole"
|
|
|
|
port = "80"
|
|
|
|
|
|
|
|
connect {
|
|
|
|
sidecar_service {
|
|
|
|
proxy {
|
|
|
|
upstreams {
|
|
|
|
destination_name = "jellyfin"
|
|
|
|
local_bind_port = 8001
|
|
|
|
}
|
|
|
|
|
|
|
|
upstreams {
|
|
|
|
destination_name = "zigbee2mqtt"
|
|
|
|
local_bind_port = 8002
|
|
|
|
}
|
|
|
|
|
|
|
|
upstreams {
|
|
|
|
destination_name = "home-assistant"
|
|
|
|
local_bind_port = 8003
|
|
|
|
}
|
2022-04-26 09:48:03 +02:00
|
|
|
|
|
|
|
upstreams {
|
|
|
|
destination_name = "syncthing"
|
|
|
|
local_bind_port = 8004
|
|
|
|
}
|
|
|
|
|
2022-03-23 10:36:25 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
sidecar_task {
|
|
|
|
resources {
|
|
|
|
cpu = 75
|
|
|
|
memory = 48
|
|
|
|
}
|
|
|
|
|
|
|
|
config {
|
|
|
|
memory_hard_limit = 96
|
|
|
|
image = "envoyproxy/envoy:v1.20.2"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
task "nginx" {
|
|
|
|
driver = "docker"
|
|
|
|
|
|
|
|
config {
|
|
|
|
image = "ra-systems-ingress-blowhole:local"
|
|
|
|
|
|
|
|
ports = ["http", "https", "jellyfin"]
|
|
|
|
memory_hard_limit = 128
|
|
|
|
}
|
|
|
|
|
|
|
|
resources {
|
|
|
|
cpu = 200
|
|
|
|
memory = 32
|
|
|
|
}
|
|
|
|
|
|
|
|
template {
|
|
|
|
data = <<EOF
|
|
|
|
ssl_certificate_key /etc/letsencrypt/live/redalder.org/privkey.pem;
|
|
|
|
ssl_certificate /etc/letsencrypt/live/redalder.org/fullchain.pem;
|
|
|
|
|
|
|
|
ssl_session_cache shared:le_nginx_SSL:10m;
|
|
|
|
ssl_session_timeout 1440m;
|
|
|
|
ssl_session_tickets off;
|
|
|
|
|
|
|
|
ssl_protocols TLSv1.2 TLSv1.3;
|
|
|
|
ssl_prefer_server_ciphers off;
|
|
|
|
|
|
|
|
ssl_ciphers "ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384";
|
|
|
|
EOF
|
|
|
|
destination = "local/ssl.conf"
|
|
|
|
change_mode = "signal"
|
|
|
|
change_signal = "SIGHUP"
|
|
|
|
}
|
|
|
|
|
|
|
|
template {
|
|
|
|
data = <<EOF
|
|
|
|
proxy_set_header Host $host;
|
|
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
|
|
EOF
|
|
|
|
destination = "local/headers.conf"
|
|
|
|
change_mode = "signal"
|
|
|
|
change_signal = "SIGHUP"
|
|
|
|
}
|
|
|
|
|
|
|
|
template {
|
|
|
|
data = <<EOF
|
|
|
|
add_header X-Frame-Options "SAMEORIGIN";
|
|
|
|
add_header Content-Security-Policy "default-src 'self' http: https: data: blob: 'unsafe-inline'" always;
|
|
|
|
EOF
|
|
|
|
destination = "local/security.conf"
|
|
|
|
change_mode = "signal"
|
|
|
|
change_signal = "SIGHUP"
|
|
|
|
}
|
|
|
|
|
|
|
|
template {
|
|
|
|
data = <<EOF
|
|
|
|
upstream jellyfin {
|
|
|
|
server {{ env "NOMAD_UPSTREAM_ADDR_jellyfin" }};
|
|
|
|
}
|
|
|
|
|
|
|
|
upstream zigbee2mqtt {
|
|
|
|
server {{ env "NOMAD_UPSTREAM_ADDR_zigbee2mqtt" }};
|
|
|
|
}
|
|
|
|
|
|
|
|
upstream home-assistant {
|
|
|
|
server {{ env "NOMAD_UPSTREAM_ADDR_home-assistant" }};
|
|
|
|
}
|
|
|
|
|
2022-04-26 09:48:03 +02:00
|
|
|
upstream syncthing {
|
|
|
|
server {{ env "NOMAD_UPSTREAM_ADDR_syncthing" }};
|
|
|
|
}
|
|
|
|
|
2022-03-23 10:36:25 +01:00
|
|
|
server {
|
|
|
|
listen 8096;
|
|
|
|
|
|
|
|
server_name _;
|
|
|
|
|
|
|
|
include /local/security.conf;
|
|
|
|
|
|
|
|
client_max_body_size 100M;
|
|
|
|
|
|
|
|
location /jellyfin {
|
2022-04-26 09:48:03 +02:00
|
|
|
location /syncthing/ {
|
2022-03-23 10:36:25 +01:00
|
|
|
include /local/headers.conf;
|
2022-04-26 09:48:03 +02:00
|
|
|
|
|
|
|
proxy_pass http://syncthing/;
|
2022-03-23 10:36:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
location ~ "^/(static/icons/|static/fonts/|static/translations/|static/images/|static/panels/|static/polyfills|api/|auth/|frontend_latest/|frontend_es5/|local/|lovelace|map|config|developer-tools|history|logbook|profile|states|hassio|onboarding.html|service_worker.js|authorize.html|manifest.json)" {
|
|
|
|
include /local/headers.conf;
|
|
|
|
|
|
|
|
proxy_http_version 1.1;
|
|
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
|
|
proxy_set_header Connection "upgrade";
|
|
|
|
|
|
|
|
proxy_pass http://home-assistant;
|
|
|
|
}
|
|
|
|
|
|
|
|
location /home-assistant {
|
|
|
|
include /local/headers.conf;
|
|
|
|
|
|
|
|
rewrite /home-assistant/(.*) /$1 break;
|
|
|
|
|
|
|
|
proxy_http_version 1.1;
|
|
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
|
|
proxy_set_header Connection "upgrade";
|
|
|
|
|
|
|
|
proxy_pass http://home-assistant;
|
|
|
|
}
|
|
|
|
|
|
|
|
location /zigbee2mqtt {
|
|
|
|
include /local/headers.conf;
|
|
|
|
|
|
|
|
rewrite /zigbee2mqtt/(.*) /$1 break;
|
|
|
|
|
|
|
|
proxy_http_version 1.1;
|
|
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
|
|
proxy_set_header Connection "upgrade";
|
|
|
|
|
|
|
|
proxy_pass http://zigbee2mqtt;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
server {
|
|
|
|
listen 80;
|
|
|
|
|
|
|
|
server_name _;
|
|
|
|
|
|
|
|
include /local/security.conf;
|
|
|
|
|
|
|
|
client_max_body_size 100M;
|
|
|
|
|
|
|
|
location /jellyfin {
|
|
|
|
include /local/headers.conf;
|
|
|
|
proxy_pass http://jellyfin;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
EOF
|
|
|
|
destination = "local/upstreams.conf"
|
|
|
|
change_mode = "signal"
|
|
|
|
change_signal = "SIGHUP"
|
|
|
|
}
|
|
|
|
|
|
|
|
template {
|
|
|
|
data = <<EOF
|
|
|
|
|
|
|
|
EOF
|
|
|
|
destination = "local/streams.conf"
|
|
|
|
change_mode = "signal"
|
|
|
|
change_signal = "SIGHUP"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-05-12 12:22:48 +02:00
|
|
|
}
|