Update syncthing setup
This commit is contained in:
parent
dcbdfdc422
commit
734b1a3321
9 changed files with 363 additions and 195 deletions
153
templates/syncthing/config.j2
Normal file
153
templates/syncthing/config.j2
Normal file
|
|
@ -0,0 +1,153 @@
|
|||
<!-- {{ ansible_managed }} -->
|
||||
|
||||
<configuration version="{{ syncthing_config_version }}">
|
||||
{% for folder in syncthing_folders %}
|
||||
<folder
|
||||
id="{{ folder.id }}"
|
||||
label="{{ folder.label }}"
|
||||
path="{{ folder.path }}"
|
||||
type="{{ folder.type }}">
|
||||
|
||||
{% for id in folder.devices %}
|
||||
<device id="{{ id }}">
|
||||
<encryptionPassword></encryptionPassword>
|
||||
</device>
|
||||
{% endfor %}
|
||||
|
||||
<filesystemType>basic</filesystemType>
|
||||
<minDiskFree unit="%">20</minDiskFree>
|
||||
<versioning>
|
||||
<cleanupIntervalS>3600</cleanupIntervalS>
|
||||
<fsPath></fsPath>
|
||||
<fsType>basic</fsType>
|
||||
</versioning>
|
||||
|
||||
<copiers>0</copiers>
|
||||
<pullerMaxPendingKiB>0</pullerMaxPendingKiB>
|
||||
<hashers>0</hashers>
|
||||
<order>random</order>
|
||||
<ignoreDelete>false</ignoreDelete>
|
||||
<scanProgressIntervalS>0</scanProgressIntervalS>
|
||||
<pullerPauseS>0</pullerPauseS>
|
||||
<maxConflicts>-1</maxConflicts>
|
||||
<disableSparseFiles>false</disableSparseFiles>
|
||||
<disableTempIndexes>false</disableTempIndexes>
|
||||
<paused>false</paused>
|
||||
<weakHashThresholdPct>25</weakHashThresholdPct>
|
||||
<markerName>.stfolder</markerName>
|
||||
<copyOwnershipFromParent>false</copyOwnershipFromParent>
|
||||
<modTimeWindowS>0</modTimeWindowS>
|
||||
<maxConcurrentWrites>2</maxConcurrentWrites>
|
||||
<disableFsync>false</disableFsync>
|
||||
<blockPullOrder>standard</blockPullOrder>
|
||||
<copyRangeMethod>standard</copyRangeMethod>
|
||||
<caseSensitiveFS>false</caseSensitiveFS>
|
||||
<junctionsAsDirs>false</junctionsAsDirs>
|
||||
<syncOwnership>false</syncOwnership>
|
||||
<sendOwnership>false</sendOwnership>
|
||||
<syncXattrs>false</syncXattrs>
|
||||
<sendXattrs>false</sendXattrs>
|
||||
</folder>
|
||||
{% endfor %}
|
||||
|
||||
{% for device in syncthing_devices %}
|
||||
<device
|
||||
id="{{ device.id }}"
|
||||
name="{{ device.name }}"
|
||||
compression="metadata">
|
||||
<address>{{ device.address }}</address>
|
||||
<paused>false</paused>
|
||||
<autoAcceptFolders>false</autoAcceptFolders>
|
||||
<maxSendKbps>0</maxSendKbps>
|
||||
<maxRecvKbps>0</maxRecvKbps>
|
||||
<maxRequestKiB>0</maxRequestKiB>
|
||||
<untrusted>false</untrusted>
|
||||
<remoteGUIPort>0</remoteGUIPort>
|
||||
<numConnections>0</numConnections>
|
||||
</device>
|
||||
{% endfor %}
|
||||
|
||||
<gui enabled="true" tls="true" debugging="false">
|
||||
<address>{{ syncthing_listen_address }}:{{ syncthing_gui_port }}</address>
|
||||
<apikey>{{ syncthing_api_key }}</apikey>
|
||||
<theme>default</theme>
|
||||
<user>{{ syncthing_gui_user }}</user>
|
||||
<password>{{ syncthing_gui_pass }}</password>
|
||||
</gui>
|
||||
|
||||
<options>
|
||||
<listenAddress>tcp://{{ syncthing_listen_address }}:{{ syncthing_protocol_port }}</listenAddress>
|
||||
</options>
|
||||
|
||||
<defaults>
|
||||
<folder
|
||||
id=""
|
||||
label=""
|
||||
path="~"
|
||||
type="sendreceive"
|
||||
rescanIntervalS="3600"
|
||||
fsWatcherEnabled="true"
|
||||
fsWatcherDelayS="10"
|
||||
fsWatcherTimeoutS="0"
|
||||
ignorePerms="false"
|
||||
autoNormalize="true">
|
||||
|
||||
<filesystemType>basic</filesystemType>
|
||||
|
||||
<device id="S7UKX27-GI7ZTXS-GC6RKUA-7AJGZ44-C6NAYEB-HSKTJQK-KJHU2NO-CWV7EQW" introducedBy="">
|
||||
<encryptionPassword></encryptionPassword>
|
||||
</device>
|
||||
|
||||
<minDiskFree unit="%">1</minDiskFree>
|
||||
|
||||
<versioning>
|
||||
<cleanupIntervalS>3600</cleanupIntervalS>
|
||||
<fsPath></fsPath>
|
||||
<fsType>basic</fsType>
|
||||
</versioning>
|
||||
|
||||
<copiers>0</copiers>
|
||||
<pullerMaxPendingKiB>0</pullerMaxPendingKiB>
|
||||
<hashers>0</hashers>
|
||||
<order>random</order>
|
||||
<ignoreDelete>false</ignoreDelete>
|
||||
<scanProgressIntervalS>0</scanProgressIntervalS>
|
||||
<pullerPauseS>0</pullerPauseS>
|
||||
<maxConflicts>10</maxConflicts>
|
||||
<disableSparseFiles>false</disableSparseFiles>
|
||||
<disableTempIndexes>false</disableTempIndexes>
|
||||
<paused>false</paused>
|
||||
<weakHashThresholdPct>25</weakHashThresholdPct>
|
||||
<markerName>.stfolder</markerName>
|
||||
<copyOwnershipFromParent>false</copyOwnershipFromParent>
|
||||
<modTimeWindowS>0</modTimeWindowS>
|
||||
<maxConcurrentWrites>2</maxConcurrentWrites>
|
||||
<disableFsync>false</disableFsync>
|
||||
<blockPullOrder>standard</blockPullOrder>
|
||||
<copyRangeMethod>standard</copyRangeMethod>
|
||||
<caseSensitiveFS>false</caseSensitiveFS>
|
||||
<junctionsAsDirs>false</junctionsAsDirs>
|
||||
</folder>
|
||||
|
||||
<device
|
||||
id=""
|
||||
compression="metadata"
|
||||
introducer="false"
|
||||
skipIntroductionRemovals="false"
|
||||
introducedBy="">
|
||||
<address>dynamic</address>
|
||||
<paused>false</paused>
|
||||
<autoAcceptFolders>false</autoAcceptFolders>
|
||||
<maxSendKbps>0</maxSendKbps>
|
||||
<maxRecvKbps>0</maxRecvKbps>
|
||||
<maxRequestKiB>0</maxRequestKiB>
|
||||
<untrusted>false</untrusted>
|
||||
<remoteGUIPort>0</remoteGUIPort>
|
||||
<numConnections>0</numConnections>
|
||||
</device>
|
||||
|
||||
<ignores>
|
||||
<line>(?d).DS_Store</line>
|
||||
</ignores>
|
||||
</defaults>
|
||||
</configuration>
|
||||
44
templates/syncthing/docker-compose.j2
Normal file
44
templates/syncthing/docker-compose.j2
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
# {{ ansible_managed }}
|
||||
|
||||
networks:
|
||||
syncthing-net:
|
||||
ipam:
|
||||
config:
|
||||
- subnet: '{{ syncthing_subnet }}'
|
||||
|
||||
services:
|
||||
syncthing:
|
||||
image: syncthing/syncthing
|
||||
container_name: syncthing
|
||||
environment:
|
||||
- PUID=1000
|
||||
- PGID=1000
|
||||
volumes:
|
||||
{% for folder in syncthing_folders -%}
|
||||
- {{ folder.source_path }}:{{ folder.path }}
|
||||
{% endfor -%}
|
||||
- {{ syncthing_app_dir }}/state:/var/syncthing/config
|
||||
restart: always
|
||||
networks:
|
||||
syncthing-net:
|
||||
ipv4_address: '{{ syncthing_app_ip }}'
|
||||
healthcheck:
|
||||
test: curl \
|
||||
--fail \
|
||||
--insecure \
|
||||
--max-time 2 \
|
||||
http://syncthing:8384/rest/noauth/health
|
||||
interval: 1m
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
|
||||
nginx:
|
||||
image: nginx:mainline-alpine
|
||||
depends_on:
|
||||
- syncthing
|
||||
restart: always
|
||||
networks:
|
||||
syncthing-net:
|
||||
ipv4_address: '{{ syncthing_nginx_ip }}'
|
||||
volumes:
|
||||
- '{{ syncthing_app_dir }}/nginx.conf.d:/etc/nginx/conf.d'
|
||||
21
templates/syncthing/nginx.j2
Normal file
21
templates/syncthing/nginx.j2
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
# {{ ansible_managed }}
|
||||
|
||||
upstream syncthing-upstream {
|
||||
server syncthing:8384;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
server_name {{ syncthing_domain }};
|
||||
|
||||
location / {
|
||||
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;
|
||||
|
||||
proxy_pass http://syncthing-upstream;
|
||||
proxy_read_timeout 600;
|
||||
proxy_send_timeout 600;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue