Help to run TW on a Server

Hello TW-Community,

I was able to setup a raspberry pi server and to install tiddlywiki.
My sandbox is
tiddlywiki mynewwiki --listen host=0.0.0.0
and I can reach it from all devices in my network :slight_smile:

Hopefully my questions can be answered here:

  1. If I start the tiddlywiki on my server the output is done on the display on the server and I cannot do anything else. I have to stop the server if I want to do whatever.
    My question: How to start tiddlywiki as background process?
  2. Is it possible to run two or more wikis parallel?
  3. How to start my wikis in case of restart the server?
  4. How to make daily backups from my wikis?

Any help is welcome.
Thank you
Stefan

1,3: maybe pm2 is you want

pm2 is what I use :slight_smile:

2, yes, on different ports. Or multiwikiserver on a single port.

4, syncthing.

here is the command I use to run multiple servers, changing the port for each one:

nohup tiddlywiki --listen host=0.0.0.0 port=6666 root-tiddler=$:/core/save/lazy-images username=user password=passwd "readers=(anon)" > serverup.out &

You can leave the nohup command out - that just allows writing to a file so I can see if there are any problems. See this article.

The important part is the & at the end - this makes the command run in the background so then you can run multiple commands from the same terminal. So you could just use:

tiddlywiki --listen host=0.0.0.0 port=6666 root-tiddler=$:/core/save/lazy-images username=user password=passwd "readers=(anon)"  &

Setting a port is also required when running multiple servers. The user and password are optional.

If you want to keep an eye on the servers as they are running your could use tmux or screen.

1 Like

And as a bouns, start it when server starts, I was using GitHub - tiddly-gittly/Tiddlywiki-NodeJS-Github-Template at feat/auto-start

Is it possible to run two or more wikis parallel?

Wait for “MWS” , you can search for this in the forum and Tiddlywiki Github repo.

How to make daily backups from my wikis?

To solve this I was using GitHub - tiddly-gittly/git-sync-js: JS implementation for Git-Sync, a script that backup notes in git repo to the remote. and git-sync.sh it mentioned. And later they are integrated into TidGi app.

BTW, all these features are all included in TidGi app. But I’ve recommend it too much today perhaps…

The way I’m currently running my wikis is to run each TiddlyWiki server in it’s own container, with caddy sitting in front as a reverse proxy. Each wiki has it’s own persistent storage mounted as a volume, and the container lifecycle is managed with systemd services generated from podman generate systemd.

I’ve got a Dockerfile for a TiddlyWiki container image that I maintain locally and update when there’s a new release of TiddlyWiki or the underlying node image it’s based on. When I update the underlying image, I just restart the running systemd services and they get the latest version (assuming I tagged everything correctly during the image build).

It’s not a perfect system. Just while looking at the setup to type this response, I realized I could parameterize the systemd units into service templates, so that I wouldn’t have to manage multiple service definitions. Also, the generate systemd command in podman is deprecated, replaced by the quadlet systemd support; however, the version of podman in RaspberryPi OS isn’t new enough for quadlets (maybe it will be after Debian 13 comes out). And if I were running more than just a single Raspberry Pi, I’d probably set up a kubernetes cluster, but that seemed like overkill for a single node.

You can follow this steps to setup a server in Ubuntu: