I recently started using TiddlyWiki and was setting it up on DigitalOcean following Josh Sullivan’s thorough tutorial. One thing the tutorial does not go into is backing up the TiddlyWiki directory.
Here are the steps I followed to set up versioned backups for my TiddliWiki directory.
Setting up the tools
- Clone and install https://github.com/gitwatch/gitwatch/
- Create a repo on Github/Bitbucket/Gitlab/…
- Generate an SSH key for your server and add it to your Github settings so that you can push commits from your DigitalOcean droplet.
git remote add origin email@example.com:your/repo.git
git branch --set-upstream-to origin/master
- Copy the
systemdservice file to
$HOME/.config/systemd/user/gitwatch@.service. You’ll need to edit the
ExecStartline so that
gitwatchalso pushes after making each commit:
ExecStart=bash /usr/local/bin/gitwatch -s 30 -r origin "%I"
-s 30 so that commits are only made at most once every 30
-r origin sets the remote to push to.
I also add a
Restart=always line in the
[Service] section, just
in case the
gitwatch service itself crashes.
- Enable and start the service
systemctl --user enable gitwatch@$(systemd-escape /your/tiddly/dir).service systemctl --user start gitwatch@$(systemd-escape /your/tiddly/dir).service
Make changes to your TiddlyWiki, and check that the service is working:
systemctl --user status gitwatch@$(systemd-escape /your/tiddly/dir).service
You’ll also want to check the Github repo to see that your changes got pushed.
If you’re using TiddlyWiki’s basic authentication mechanism(which
reads usernames/passwords from a CSV file), you’ll probably want to
add the CSV file to the repository’s