Home TrueNAS : Add SyncThing
Post
Cancel
Preview Image

TrueNAS : Add SyncThing

Introduction

The BB Archive is an offline website where I keep all my information and data collected over the years related to my hobbies. It uses Jekyll to create a static data with a rich appearance.

Main Website Data

The website is served via an Apache HTTPD link to website running in Docker on Titan, from a dataset on TrueNAS at Media/Archive_Jekyll which has two main folders:

  • jekyll_data: this is a copy of the Jekyll source files from the Mac, and includes the sub-folder _site which contains the static HTML files created by Jekyll. These are the files that Apache serves to the browser, however there are no images or PDF files or other static data files included here; they are locted in:

  • files: this is the storage location for all images and data files associated with the archive. They are filed under subject headings, such as Computer, Electronics, etc. There are additional sub-folders:

    • headers: contains all the header files shown on the webpages specific to each post / article. The PhotoShop masters for the header images are also here in the file headers_master.psd
    • img: any additional images required in support of the Archive, e.g. the Avatar image

Master Source Data

On the Mac, the Jekyll source data and generated site files are in a folder jekyll_website in the main Documents folder. Editing of the mark-down files is done using VSCode. Jekyll dynamically updates the static HTML files as edits are completed. They can be viewed locally on the Mac in the browser at http://localhost:4000/, although this will not include the images on TrueNAS unless the full URL /files… to /files/… is used in links.

This master data is copied to the TrueNAS folder using Syncthing instances on the Mac and TrueNAS. The whole of the jekyll_website folder is copied to /Media/Archive_Jekyll/jekyll_data/ from where Apache can access all the data including the static data files which are mapped in Apache to /files in the browser.

Install SyncThing on TrueNAS

  • Login to TrueNAS
  • Select Plugins at LHS
  • Choose pool for Plugin; I used MasterPool
  • Find and select SyncThing plugin, click Install button
  • Assign Jail Name = SyncThing
  • WAIT a few minutes!

NOTE: This creates a new dataset called iocage under the MasterPool dataset. Under the Jails menu item, have the new jail SyncThing. Under the Plugins menu item the SyncThing entry has URL to SyncThing GUI

Setup SyncThing

  • Go to browser http://192.168.0.10:8384/syncthing/

  • Will need to set username:PW on first use, as follows:
    • Go to Actions (top right) -> Settings
      • Under General tab, set Device Name: SyncThing @ TrueNAS
      • Under GUI tab, set GUI User: [STRONGBOX], GUI Password: [STRONGBOX]
      • Click Save button
  • 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
    • Click Save button

Add Archive_Jekyll Folder on TrueNAS

  • SyncThing needs to be permissions to manipulate the files in the destination folder. SyncThing has already generated its own user, so need to find its UID to map into TrueNAS
    • Go to Jails, select SyncThing jail and “>” at RHS
    • Click Shell button
    • Type id syncthing, which should give UID = 983
  • Add user to TrueNAS with SyncThing UID
    • Go to Accounts -> Users
    • Click Add button
    • Set Fullname: SyncThing, Username: sync, Password as for SyncThing jail
    • Set UserID: 983 [must match UID from SyncThing plugin above]
    • Click Submit button to create new user
  • Add user to Group
    • Go to Accounts -> Groups
    • NOTE: Had to delete sync group has it had wrong GID
    • Click Add button
    • Set GID: 983, Name: sync
    • Click Submit button to create new user
    • Select group sync and “>” at RHS, click Members button
    • Add sync and bob to group
    • Click Save button
  • Create a dataset in TrueNAS for the Jekyll Archive (will also store all static data)
    • Under Storage -> Pools, select Media, 3-dots RHS, select Add Dataset
      • Set Name = Archive_Jekyll
      • Click Submit button
    • Select dataset Archive_Jekyll, and 3-dots at RHS, then *Edit Permissions
      • Default is User = root, Group = wheel
      • Should set both to sync but that did not work properly (SyncThing ok, but could not see share on Mac), so set User = sync, Group = bob
      • Tick Apply User and Apply Group, tick Apply recursively
      • Click Save button
  • Map dataset folder to SyncThing plugin
    • Go to Jails, on SyncThing row, click “>” at RHS
    • Click Stop button to change mount points
    • Click Mount Points button
    • Set Source = /mnt/MasterPool/Media/Archive_Jekyll/jekyll_data
    • Set Destination = /mnt/MasterPool/iocage/jails/SyncThing/root/mnt
    • Click Save button

Setup SyncThing Folder on Mac

  • Under Folders section, click +Add Folder button
    • In General tab:
      • Set Folder Label: Jekyll HTML Files on Bob's Mac
      • Set Folder Path: /Volumes/MacOS Catalina - Home/bob/Documents/jekyll_website
    • In Sharing tab:
      • Tick SyncThing @ TrueNAS
    • In Advanced tab:
      • Set Folder Type: Send Only
    • Click Save button

Setup SyncThing Folder on TrueNAS

  • In the TrueNAS instance of SyncThing a popup will indicate that SyncThing @ Titan is offering a new folder for sharing
    • In General tab:
      • Set Folder Path: /mnt; this is mapped to the Archive_Jekyll folder in TrueNAS
    • In Advanced tab:
      • Set Folder Type: Receive Only
    • Click Save button

SyncThing should then copy and maintain sync between the files on the Mac and those on Titan.

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