Home Install SyncThing on Docker
Post
Cancel
Preview Image

Install SyncThing on Docker

This install assumes that Docker has been installed previously, and extends the Docker stack created for the Traefik Reverse Proxy.

SyncThing is a continuous file synchronisation program.

In this instance it is used to sync the Docker installation files on the Mac workstation with the Titan/Hyperion servers, allowing editing to be done in VSCode on the Mac, and then updated to the server. This minimises the use of nano on the server.

Install SyncThing

Create folder for SyncThing config data:

1
2
3
cd ~/docker
mkdir syncthing
mkdir syncthing/config

Add the following service definition to docker-compose.yml in docker root folder

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
version: "3.9"

# NETWORKS ####################################################

networks:
  traefik_proxy:
    external: true

# SERVICES ####################################################

services:

  syncthing:
    container_name: syncthing
    image: linuxserver/syncthing:latest
    #
    restart: unless-stopped
    security_opt:
      - no-new-privileges:true
    #
    networks:
      - traefik_proxy
    ports:
      - 22000:22000/tcp
      - 22000:22000/udp
      - 21027:21027/udp
      - 8384:8384
    #
    volumes:
      - $DOCKERDIR/syncthing/config:/config
      - $DOCKERDIR:/syncfolder
    environment:
      TZ: $TZ
      PUID: $PUID
      PGID: $PGID
    labels:
      - "traefik.enable=true"
      ## HTTP Routers
      - "traefik.http.routers.syncthing-secure.entrypoints=web_https"
      - "traefik.http.routers.syncthing-secure.rule=Host(`syncthing.$DOMAINNAME_CLOUD_SERVER`)"
      - "traefik.http.routers.syncthing-secure.tls=true"
      ## Middlewares
      #- "traefik.http.routers.syncthing-secure.middlewares=middlewares-basic-auth@file"
      ## HTTP Services
      - "traefik.http.routers.syncthing-secure.service=syncthing-svc"
      - "traefik.http.services.syncthing-svc.loadbalancer.server.port=8384"

From the Docker root folder, run this command to build the container:

1
sudo docker compose -f dc-syncthing.yml up -d

Configure SyncThing @ Hyperion

  • Go to browser syncthing.bbproj.org
  • Will need to set username:PW on first use, as below
  • Go to Actions (top right) -> Settings
    • Under General tab, set Device Name: SyncThing @ Titan
    • Under GUI tab, set GUI User: [STRONGBOX], GUI Password: [STRONGBOX]
    • Click Save button
  • Under Folders section, click +Add Folder button
    • In General tab:
      • Set Folder Label: Hyperion Docker Folder
      • Set Folder Path: /syncfolder/, as mapped in Docker Compose file to Docker root folder
    • In Ignore Patterns tab:
      • Add “portainer”; most items failed permissions, so easier to omit
      • Add “_*”; avoids putting “_hidden file.txt” message onto Hyperion
      • Add “acme”; certificate folder has only root permissions
  • Under Remote Devices section, click +Add Remote Device button
    • In the General tab, it is likely that the Device ID for Bob’s Mac is being shown so select it, or simply paste the Device ID from Bob’s Mac. Amend the Device Name as required
    • In the Sharing tab, select the folder setup above
    • Click Save button

Add SyncThing to Mac

  • Download the SyncThing DMG for Mac from their website, open the DMG, and copy SyncThing.app to the Applications folder
  • Run the application which puts the SyncThing icon in the upper right menu bar
  • Click the icon -> Preferences, tick Start at login
    • Create a SyncThing folder under Documents for related files
  • Click the icon -> Open, starts the SyncThing GUI
    • Go to Actions (top right) -> Settings
      • Under General tab, click Edit Folder Defaults button
        • Change Folder Path: /Volumes/MacOS Catalina – Home/bob/Documents/SyncThing
      • Click Save button
    • Go to Actions -> Show ID, and copy the Device ID to the Clipboard, this is used to share with other SyncThing instances to identify Bob’s Mac

Share Files

With the remaining default settings, the contents of the Hyperion Docker Files will be synchronised both ways to the Documents/SyncThings folder on the Mac. It is intended that

  • Docker Compose files on Mac can be edited in VSCode and automatically synchronised to Hyperion, rather than use nano. Also using Filezilla over SSH, and edit files in VSCode
  • Log files will be copied to the Mac and can be viewed for debugging purposes

Resources

This post is licensed under CC BY 4.0 by the author.
Recently Updated
Trending Tags
Contents
Trending Tags