diff options
Diffstat (limited to 'bundles/syncthing')
| -rw-r--r-- | bundles/syncthing/files/traefik.yaml | 22 | ||||
| -rw-r--r-- | bundles/syncthing/items.py | 44 | ||||
| -rw-r--r-- | bundles/syncthing/metadata.py | 8 |
3 files changed, 74 insertions, 0 deletions
diff --git a/bundles/syncthing/files/traefik.yaml b/bundles/syncthing/files/traefik.yaml new file mode 100644 index 0000000..884f77f --- /dev/null +++ b/bundles/syncthing/files/traefik.yaml @@ -0,0 +1,22 @@ +http: + services: + syncthing-gui: + loadBalancer: + servers: + - url: http://${node.metadata.get("container_gateway", "10.89.0.1")}:8384 + + routers: + syncthing-gui: +% if node.name == "inazuma": + rule: Host(`syncthing.iz.ts.gzr.im`) +% elif node.name == "shimakaze": + rule: Host(`syncthing.sk.ts.gzr.im`) +% endif + entryPoints: + - http + # - https + service: syncthing-gui + # middlewares: + # - tls-redirect@file + # tls: + # certResolver: le diff --git a/bundles/syncthing/items.py b/bundles/syncthing/items.py new file mode 100644 index 0000000..75b713c --- /dev/null +++ b/bundles/syncthing/items.py @@ -0,0 +1,44 @@ +if node.os != "alpine": + raise BundleError(f"{node.name}: OS {node.os} is not supported.") + +svc_openrc = { + "syncthing": { + "enabled": True, + "running": True, + "needs": [ + "pkg_apk:syncthing-openrc", + ], + }, +} + +files = { + "/etc/traefik/syncthing-gui.yaml": { + "content_type": "mako", + "source": "traefik.yaml", + "needs": {"bundle:traefik"}, + }, +} + +actions = { + "syncthing_generate_config": { + "command": "test -d /var/lib/syncthing/.local/state/syncthing || syncthing generate --no-default-folder", + }, + "syncthing_patch_config": { + "command": "patch -sfN -d /var/lib/syncthing -p1", + "data_stdin": """ +--- a/.local/state/syncthing/config.xml ++++ b/.local/state/syncthing/config.xml +@@ -52,7 +52,7 @@ + <numConnections>0</numConnections> + </device> + <gui enabled="true" tls="false" debugging="false" sendBasicAuthPrompt="false"> +- <address>127.0.0.1:8384</address> ++ <address>0.0.0.0:8384</address> + <apikey>bdNpzhDXbZEdcTSAcNtczLGgdV7RpsfF</apikey> + <theme>default</theme> + </gui> +""", + "needs": {"action:syncthing_generate_config"}, + "triggers": {"svc_openrc:syncthing:restart"}, + }, +} diff --git a/bundles/syncthing/metadata.py b/bundles/syncthing/metadata.py new file mode 100644 index 0000000..c2a3cc6 --- /dev/null +++ b/bundles/syncthing/metadata.py @@ -0,0 +1,8 @@ +defaults = { + "apk": { + "packages": { + "syncthing": {}, + "syncthing-openrc": {}, + }, + }, +} |