mirror of
https://git.sr.ht/~magic_rb/cluster
synced 2024-11-25 17:46:14 +01:00
Add syncthing
Signed-off-by: main <magic_rb@redalder.org>
This commit is contained in:
parent
ca34d4229c
commit
fd57407030
21
containers/syncthing.nix
Normal file
21
containers/syncthing.nix
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
{ nglib, nixpkgs }:
|
||||||
|
nglib.makeSystem {
|
||||||
|
inherit nixpkgs;
|
||||||
|
system = "x86_64-linux";
|
||||||
|
name = "ra-systems-syncthing";
|
||||||
|
config = ({ pkgs, ... }:
|
||||||
|
{
|
||||||
|
dumb-init = {
|
||||||
|
enable = true;
|
||||||
|
type.services = { };
|
||||||
|
};
|
||||||
|
init.services.syncthing = {
|
||||||
|
shutdownOnExit = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
services.syncthing = {
|
||||||
|
enable = true;
|
||||||
|
guiAddress = "http://0.0.0.0:8384/";
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
|
@ -335,6 +335,12 @@ EOF
|
||||||
destination_name = "home-assistant"
|
destination_name = "home-assistant"
|
||||||
local_bind_port = 8003
|
local_bind_port = 8003
|
||||||
}
|
}
|
||||||
|
|
||||||
|
upstreams {
|
||||||
|
destination_name = "syncthing"
|
||||||
|
local_bind_port = 8004
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -422,6 +428,10 @@ upstream home-assistant {
|
||||||
server {{ env "NOMAD_UPSTREAM_ADDR_home-assistant" }};
|
server {{ env "NOMAD_UPSTREAM_ADDR_home-assistant" }};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
upstream syncthing {
|
||||||
|
server {{ env "NOMAD_UPSTREAM_ADDR_syncthing" }};
|
||||||
|
}
|
||||||
|
|
||||||
server {
|
server {
|
||||||
listen 8096;
|
listen 8096;
|
||||||
|
|
||||||
|
@ -432,8 +442,10 @@ server {
|
||||||
client_max_body_size 100M;
|
client_max_body_size 100M;
|
||||||
|
|
||||||
location /jellyfin {
|
location /jellyfin {
|
||||||
|
location /syncthing/ {
|
||||||
include /local/headers.conf;
|
include /local/headers.conf;
|
||||||
proxy_pass http://jellyfin;
|
|
||||||
|
proxy_pass http://syncthing/;
|
||||||
}
|
}
|
||||||
|
|
||||||
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)" {
|
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)" {
|
||||||
|
|
101
infrastructure/syncthing/nomad.hcl
Normal file
101
infrastructure/syncthing/nomad.hcl
Normal file
|
@ -0,0 +1,101 @@
|
||||||
|
job "syncthing" {
|
||||||
|
datacenters = [ "homelab-1" ]
|
||||||
|
type = "service"
|
||||||
|
|
||||||
|
group "syncthing" {
|
||||||
|
count = 1
|
||||||
|
|
||||||
|
volume "syncthing-data" {
|
||||||
|
type = "csi"
|
||||||
|
source = "syncthing-data"
|
||||||
|
read_only = false
|
||||||
|
|
||||||
|
attachment_mode = "file-system"
|
||||||
|
access_mode = "single-node-writer"
|
||||||
|
}
|
||||||
|
|
||||||
|
volume "syncthing-config" {
|
||||||
|
type = "csi"
|
||||||
|
source = "syncthing-config"
|
||||||
|
read_only = false
|
||||||
|
|
||||||
|
attachment_mode = "file-system"
|
||||||
|
access_mode = "single-node-writer"
|
||||||
|
}
|
||||||
|
|
||||||
|
volume "syncthing-storage" {
|
||||||
|
type = "csi"
|
||||||
|
source = "syncthing-storage"
|
||||||
|
read_only = false
|
||||||
|
|
||||||
|
attachment_mode = "file-system"
|
||||||
|
access_mode = "single-node-writer"
|
||||||
|
}
|
||||||
|
|
||||||
|
network {
|
||||||
|
mode = "bridge"
|
||||||
|
}
|
||||||
|
|
||||||
|
service {
|
||||||
|
name = "syncthing"
|
||||||
|
port = "8384"
|
||||||
|
|
||||||
|
## Syncthing with auth returns 402: Unauthorized and Nomad interprets it as
|
||||||
|
## service failure.
|
||||||
|
# check {
|
||||||
|
# type = "http"
|
||||||
|
# address_mode = "alloc"
|
||||||
|
# path = "/"
|
||||||
|
# port = "8384"
|
||||||
|
# interval = "10s"
|
||||||
|
# timeout = "10s"
|
||||||
|
# }
|
||||||
|
|
||||||
|
connect {
|
||||||
|
sidecar_service {}
|
||||||
|
|
||||||
|
sidecar_task {
|
||||||
|
resources {
|
||||||
|
cpu = 75
|
||||||
|
memory = 48
|
||||||
|
}
|
||||||
|
|
||||||
|
config {
|
||||||
|
memory_hard_limit = 96
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
task "syncthing" {
|
||||||
|
driver = "docker"
|
||||||
|
|
||||||
|
config {
|
||||||
|
image = "ra-systems-syncthing:local"
|
||||||
|
}
|
||||||
|
|
||||||
|
resources {
|
||||||
|
cpu = 128
|
||||||
|
memory = 128
|
||||||
|
}
|
||||||
|
|
||||||
|
volume_mount {
|
||||||
|
volume = "syncthing-data"
|
||||||
|
destination = "/var/syncthing/data"
|
||||||
|
read_only = false
|
||||||
|
}
|
||||||
|
|
||||||
|
volume_mount {
|
||||||
|
volume = "syncthing-config"
|
||||||
|
destination = "/var/syncthing/config"
|
||||||
|
read_only = false
|
||||||
|
}
|
||||||
|
|
||||||
|
volume_mount {
|
||||||
|
volume = "syncthing-storage"
|
||||||
|
destination = "/var/syncthing/storage"
|
||||||
|
read_only = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
19
infrastructure/syncthing/syncthing-config.hcl
Normal file
19
infrastructure/syncthing/syncthing-config.hcl
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
type = "csi"
|
||||||
|
id = "syncthing-config"
|
||||||
|
name = "syncthing-config"
|
||||||
|
plugin_id = "nfs"
|
||||||
|
|
||||||
|
capability {
|
||||||
|
access_mode = "single-node-writer"
|
||||||
|
attachment_mode = "file-system"
|
||||||
|
}
|
||||||
|
|
||||||
|
context {
|
||||||
|
server = "10.64.1.201"
|
||||||
|
share = "/var/nfs/syncthing/config"
|
||||||
|
}
|
||||||
|
|
||||||
|
mount_options {
|
||||||
|
fs_type = "nfs"
|
||||||
|
mount_flags = [ "nolock", "hard" ]
|
||||||
|
}
|
19
infrastructure/syncthing/syncthing-data.hcl
Normal file
19
infrastructure/syncthing/syncthing-data.hcl
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
type = "csi"
|
||||||
|
id = "syncthing-data"
|
||||||
|
name = "syncthing-data"
|
||||||
|
plugin_id = "nfs"
|
||||||
|
|
||||||
|
capability {
|
||||||
|
access_mode = "single-node-writer"
|
||||||
|
attachment_mode = "file-system"
|
||||||
|
}
|
||||||
|
|
||||||
|
context {
|
||||||
|
server = "10.64.1.201"
|
||||||
|
share = "/var/nfs/syncthing/data"
|
||||||
|
}
|
||||||
|
|
||||||
|
mount_options {
|
||||||
|
fs_type = "nfs"
|
||||||
|
mount_flags = [ "nolock", "hard" ]
|
||||||
|
}
|
19
infrastructure/syncthing/syncthing-storage.hcl
Normal file
19
infrastructure/syncthing/syncthing-storage.hcl
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
type = "csi"
|
||||||
|
id = "syncthing-storage"
|
||||||
|
name = "syncthing-storage"
|
||||||
|
plugin_id = "nfs"
|
||||||
|
|
||||||
|
capability {
|
||||||
|
access_mode = "single-node-writer"
|
||||||
|
attachment_mode = "file-system"
|
||||||
|
}
|
||||||
|
|
||||||
|
context {
|
||||||
|
server = "10.64.1.201"
|
||||||
|
share = "/var/nfs/syncthing/storage"
|
||||||
|
}
|
||||||
|
|
||||||
|
mount_options {
|
||||||
|
fs_type = "nfs"
|
||||||
|
mount_flags = [ "nolock", "hard" ]
|
||||||
|
}
|
Loading…
Reference in a new issue