Skip to content

Instantly share code, notes, and snippets.

@jg3
Last active December 7, 2023 00:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jg3/81c84b1dfba4c15c1957d0a8a56dda3e to your computer and use it in GitHub Desktop.
Save jg3/81c84b1dfba4c15c1957d0a8a56dda3e to your computer and use it in GitHub Desktop.
notes on HADS for HOME

HADS

https://github.com/sinedied/hads

A simple, markdown-based wiki written in Node. It does just enough for what I need and not much more.

Installed on TrueNas in a FreeBSD jail. HADS lives in /mnt/HADS/

Prep & Install

  • Create DNS A record for home pointing to 10.39.6.46
  • pkg install setsid npm sudo
  • sudo visudo to add a line for user ALL=NOPASSWD: /mnt/HADS/node_modules/hads/bin/hads
  • Map persistent directories:
  /mnt/Vol_2X8T/Server/Apps/home-server    --> /mnt/Vol_2X8T/iocage/jails/HOME/root/mnt
  /mnt/Vol_2X8T/Server/Apps/home-server/etc -->  /mnt/Vol_2X8T/iocage/jails/HOME/root/etc

Note: for the second command to work, I had to become root on the server and do this:
root@fn:/mnt/Vol_2X8T/iocage/jails/home-www/root # mv etc etc-orig

  • Edit user's crontab:
SHELL=/bin/sh

@reboot setsid sudo /mnt/HADS/node_modules/hads/bin/hads /mnt/HADS/data -i /mnt/HADS/images/ --host 10.39.6.46 --port 80 --readonly >>/var/log/hads_ro.log 2>&1 < /dev/null &  echo $! >/tmp/hads_
ro.pid

@reboot setsid sudo /mnt/HADS/node_modules/hads/bin/hads /mnt/HADS/data -i /mnt/HADS/images/ --host 10.39.6.46 --port 3906 >>/var/log/hads_rw.log 2>&1 < /dev/null &  echo $! >/tmp/hads_rw.pid

Usage

Any browser can reach the HADS server on HTTP://home ... to edit they must connect to HTTP://home:3906. Firewall restrictions allow only local authenticated access to the 3906 port.

Manage (stop) the daemons in the shell with e.g.:

kill `echo /tmp/hads_ro.pid`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment