feat: add Syncthing service deployment and configuration
Some checks failed
Ansible Lint Check / check-ansible (push) Failing after 17s
Nix Format Check / check-format (push) Successful in 1m2s
Python Lint Check / check-python (push) Failing after 14s

This commit is contained in:
Menno van Leeuwen 2025-03-17 11:12:13 +01:00
parent 9c3f54e760
commit b5447dc0ec
Signed by: vleeuwenmenno
SSH Key Fingerprint: SHA256:OJFmjANpakwD3F2Rsws4GLtbdz1TJ5tkQF0RZmF0TRE
3 changed files with 58 additions and 0 deletions

View File

@ -33,3 +33,5 @@
enabled: true
- name: uptime-kuma
enabled: true
- name: syncthing
enabled: true

View File

@ -0,0 +1,28 @@
services:
syncthing:
image: syncthing/syncthing
environment:
- PUID=1000
- PGID=100
- TZ=Europe/Amsterdam
# Disable local discovery since server is not on local network
- STTRACE=
- STNODEFAULTFOLDER=true
- STNODEFAULTFOLDERROOT=true
- STNOUPGRADE=true
# Disable local discovery
- STGUIADDRESS=0.0.0.0:8384not on local network
- STLOCALANNOUNCEENABLED=false
- STGLOBALDISCOVERYENABLED=true
volumes:
- {{ syncthing_data_dir }}:/var/syncthing
ports:
- 8384:8384 # Web UI
- 22000:22000/tcp # TCP file transfers
- 22000:22000/udp # QUIC file transfers
restart: unless-stopped
healthcheck:
test: curl -fkLsS -m 2 127.0.0.1:8384/rest/noauth/health | grep -o --color=never OK || exit 1
interval: 1m
timeout: 10s
retries: 3

View File

@ -0,0 +1,28 @@
---
- name: Deploy Syncthing service
block:
- name: Set Syncthing directories
ansible.builtin.set_fact:
syncthing_service_dir: "{{ ansible_env.HOME }}/services/syncthing"
syncthing_data_dir: "/mnt/object_storage/services/syncthing"
- name: Create Syncthing directory
ansible.builtin.file:
path: "{{ syncthing_service_dir }}"
state: directory
mode: "0755"
- name: Deploy Syncthing docker-compose.yml
ansible.builtin.template:
src: docker-compose.yml.j2
dest: "{{ syncthing_service_dir }}/docker-compose.yml"
mode: "0644"
register: syncthing_compose
- name: Stop Syncthing service
ansible.builtin.command: docker compose -f "{{ syncthing_service_dir }}/docker-compose.yml" down --remove-orphans
when: syncthing_compose.changed
- name: Start Syncthing service
ansible.builtin.command: docker compose -f "{{ syncthing_service_dir }}/docker-compose.yml" up -d
when: syncthing_compose.changed