Hosting multiple TiddlyWikis on Node

I only recently1 found out about TiddlyWiki, and immediately became enamored with it. After a couple months of playing with individual files, today I made a breakthrough today in hosting TiddlyWiki on my site.

I tried a few ways to initialize with cPanel on my current host, without any luck (I may return to this next, now that I’ve seen it in action. It turned out to be much easier to spin up a DigitalOcean droplet with Node, and follow the instructions in this guide from Josh Sullivan. The only modification I made was to use pm2 instead of forever (as DigitalOcean already had it configured). I found another article on initializing pm2 with Tiddlywiki, and I used the following command in place of forever:

pm2 start --name wikiprocessname /lib/node_modules/tiddlywiki/tiddlywiki.js -- nameofwikifolder --listen author=name username=name password=yourpassword "readers=(anon)"

Now, my experimentation with TiddlyWiki involved saving single html files and playing with each individually. I ended up with a few single-topic wikis – one for archiving my old notebooks, one for my video game collection, etc. I may combine at some point, but I thought it would be better for now to host individually. All that needed to happen, at least with the DigitalOcean reverse proxy setup, was to initialize nginx correctly.

sudo nano /etc/nginx/sites-available/DOMAIN2.COM
sudo nano /etc/nginx/sites-available/DOMAIN3.COM

Then in each file, make sure the port is unique and the URL matches. Symbol links for each:

sudo ln -s /etc/nginx/sites-available/DOMAIN2.COM /etc/nginx/sites-enabled/
sudo ln -s /etc/nginx/sites-available/DOMAIN3.COM /etc/nginx/sites-enabled/

Rerun certbot if needed for these URLs, then intialize each in pm2:

pm2 start --name wikiprocessname /lib/node_modules/tiddlywiki/tiddlywiki.js -- nameofwikifolder --listen port=#### author=name username=name password=yourpassword "readers=(anon)"

You can play with the various arguments for the TiddlyWiki webserver outlined here. I made a couple available to only myself for now by removing “readers=(anon)”. Don’t forget to run pm2 save so your server stays up.

Going to keep playing, but right now my commonplace book is live with barely anything in it. Hope this helps someone get theirs off the ground as well.

  1. Pretty sure I picked up the idea from Chris Aldrich, who wrote his own guide for hosting the single file version of TiddlyWiki.↩

Sound off