about summary refs log tree commit diff
path: root/bundles/syncthing/items.py
diff options
context:
space:
mode:
authorRobert Günzler <r@gnzler.io>2025-09-07 17:32:13 +0200
committerRobert Günzler <r@gnzler.io>2025-09-07 17:42:42 +0200
commit38be6c13f76e893cf47636257071b440dec0c5b2 (patch)
treef7ded3235a7e3362cbd1ed3d91523968fe0faf90 /bundles/syncthing/items.py
initial commit
Signed-off-by: Robert Günzler <r@gnzler.io>
Diffstat (limited to 'bundles/syncthing/items.py')
-rw-r--r--bundles/syncthing/items.py44
1 files changed, 44 insertions, 0 deletions
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"},
+    },
+}