Testing the Multi Wiki Server Plugin

I’ve added a new site at https://mws.tiddlywiki.com/, and a new badge to the front page of tiddlywiki.com, to encourage people to test out the upcoming Multi Wiki Server plugin.

Thanks to the support of @Hans_Wobbe and the extensive contributions of @webplusai, MWS has now gained some important new capabilities around supporting multiple user accounts and the ability to limit what each user can see.

MWS is not yet ready for production use, but this is an excellent time to give it some testing, and help us refine the features and user experience.

Running MWS on a desktop computer does require use of the command line but it is very straightforward, even if you haven’t any experience of it before. Once you’ve downloaded MWS, there are two command needed to get it running: npm install and npm start. It really is that simple.

As well as feedback on MWS itself, I’d also appreciate any feedback on the documentation I’ve added to tiddlywiki.com. My goal was to give clear instructions and try to convey how easy it is to get MWS up and running.

The new badge features my own cut-and-paste artwork. I think the bags and recipes model is relatively concrete to visualise in ones head, but it’s still hard to put across the basic idea while keeping the image comprehensible. More broadly, MWS could really do with some branding, so I would also welcome any thoughts/sketches to help us.

8 Likes

This is awesome I’ve been using the dav-farm plugin and using a sketchy rework of tiddlywiki share for authentication :laughing:

Been running an MWS instance on my NAS for a bit alongside 5.3.5, find loading times superior, and have found accessing the wiki working flawlessly even with all my plugins.

The recipes/bags screen is still a bit wonky, I’ve had trouble deleting old recipes if I configured the recipe wrong or if something within a bag becomes corrupted – though this may have been fixed in an update since I set it up.

Very much looking forward to the official release, I think it’s going to be an exciting step forward!

1 Like

Probably not what you were thinking of, not sure if it should work, but running it in termux on my android results in:

gyp: Undefined variable android_ndk_path in binding.gyp while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.<anonymous> (/data/data/com.termux/files/usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:297:18)
gyp ERR! stack at ChildProcess.emit (node:events:520:28)
gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:294:12)
gyp ERR! System Linux 5.15.123-android13-8-28577312-abS918BXXS6CXGA
gyp ERR! command "/data/data/com.termux/files/usr/bin/node" "/data/data/com.termux/files/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--release"
gyp ERR! cwd /data/data/com.termux/files/home/TiddlyWiki5/node_modules/better-sqlite3
gyp ERR! node -v v22.8.0
gyp ERR! node-gyp -v v10.1.0
gyp ERR! not ok
npm error code 1
npm error path /data/data/com.termux/files/home/TiddlyWiki5/node_modules/better-sqlite3
npm error command failed
npm error command sh -c prebuild-install || node-gyp rebuild --release
npm error A complete log of this run can be found in: /data/data/com.termux/files/home/.npm/_logs/2024-11-14T20_06_37_582Z-debug-0.log

It is really that simple. Now I need a little bit more infos on how to import tiddlers in a bag from an existing Tiddlywiki file. I tried to import a exported tiddler as a .tid file in a new bag. The import went fine but once the bag imported in a new recipe, the tiddler is present but a big yellow square says “this tiddler contents binary data” and no content at all…
I definitly need a little help to understand the way of dealing with bags and tiddlers and wikis…

I love the simple instructions, how do I adjust for running on my local network? I tried the command that npm start is a shortcut for and added host=0.0.0.0 like regular node and that didn’t seem to work.

1 Like

Just wondering before I start out. Should / will this work on Raspberry Pi? ARM processor? Or am I jumping the gun (again)?

https://manuals.annafreud.org/ is very cool btw. Great example.

Rsspberry Pi was going to be my next test! :slight_smile:

1 Like

I do not have this problem – MWS is currently working as an experimental space and backup for my 5.3.5 wiki and to update I drag all the .tids from my synced backup folder into the MWS instance and import.

I’ve got it running with host=0.0.0.0. It really was just adding that bit as a paramenter to the --mws-listen command, so I’m curious why it isn’t working for you.

In a related note, I’ve tried to run the multiwikiserver on a non-root path using path-prefix=... but have so far had no luck getting the multiwikiclient to point to the correct server path. It looks like there is a config tiddler for this at $:/config/multiwikiclient/host similar to how $:/config/tiddlyweb/host works for the regular node.js server, but I can’t figure out where to put this tiddler to get it to load for the client. So far I’ve tried:

  • Put it in ./editions/multiwikiserver/tiddlers
  • Add it to the tiddlers in ./plugins/tiddlywiki/multiwikiclient
  • Manually insert it into the tiddlers and fields tables of the data store (using the same bag as the multiwikiclient plugin)

Is there a specific bag and/or file location to put that config tiddler so it will be used by the multiwikiclient web interface?

I’ve established a new site for the MWS documentation:

https://mws.tiddlywiki.com/

The idea is to make the MWS docs easily accessible without cluttering up the main site with material that will not be relevant to everyone.

3 Likes

Hi all,

reading the docs and trying this out I must admit I have no clue what this is actually doing.
Is it possible for someone experienced to post a video / screencast where we can see how this is meant to be used?

Simon

3 Likes

Follwing the instruction (TiddlyWiki MultiWikiServer — TiddlyWiki for the People), I get below error:

# npm start

> tiddlywiki@5.3.7-prerelease start
> node ./tiddlywiki.js ./editions/multiwikiserver --mws-load-plugin-bags --build load-mws-demo-data --mws-listen

$:/plugins/tiddlywiki/multiwikiserver/commands/mws-load-plugin-bags.js:43
                                console.log(`Error creating plugin bag ${bagname}: ${JSON.stringify(result)}`);
                                                                         ^

ReferenceError: bagname is not defined
    at savePlugin ($:/plugins/tiddlywiki/multiwikiserver/commands/mws-load-plugin-bags.js:43:46)
    at collectPlugins ($:/plugins/tiddlywiki/multiwikiserver/commands/mws-load-plugin-bags.js:54:7)
    at collectPublisherPlugins ($:/plugins/tiddlywiki/multiwikiserver/commands/mws-load-plugin-bags.js:64:6)
    at $:/plugins/tiddlywiki/multiwikiserver/commands/mws-load-plugin-bags.js:69:3
    at $tw.utils.each ($:/boot/boot.js:146:12)
    at loadPluginBags ($:/plugins/tiddlywiki/multiwikiserver/commands/mws-load-plugin-bags.js:68:12)
    at Command.execute ($:/plugins/tiddlywiki/multiwikiserver/commands/mws-load-plugin-bags.js:28:2)
    at Commander.executeNextCommand ($:/core/modules/commander.js:114:14)
    at Commander.execute ($:/core/modules/commander.js:71:7)
    at exports.startup ($:/core/modules/startup/commands.js:34:12)

Node.js v18.17.1
1 Like

Playing around some more with passing path-prefix to --mws-listen, I’ve come to the conclusion that this simply won’t work (yet) for multiple reasons.

First, for the interface that shows the list of bags, recipes, authentication, etc., I realized that multiwikiserver is rendering all of this server side. The paths in the template tiddlers are not currently written in a way that would take alternate path mounting into consideration. So even though the server will gladly serve requests on the specified path (eg: “/mws”), all of the links generated at the server side will be broken.

Second, the multiwikiclient does use the $:/config/multiwikiclient/host config tiddler if it exists in the recipe for the currently loaded wiki (and is not involved at all in the initial admin interface, as I discovered above). Using the demo data, creating this config tiddler in bag-alpha caused all of the other recipes that contain bag-alpha to “just work” with the path-prefix, so count that as a success!

However, due to the previously mentioned lack of server-side awareness for path-prefix, any tiddlers that use a _canonical_uri that points to a blob somewhere in a bag will not properly load, since the URI starts with “/bags/…” instead of “/mws/bags/…” (reusing the same example prefix from before). Discovered this accidentally when I tried to be clever by uploading the text for the $:/config/multiwikiclient/host tiddler directly to bag-alpha through the admin interface, versus creating it as a normal tiddler in the wiki for recipe-tau.

Thanks.

I’ll be in touch soon: putting final inputs into huge ai and society grant that includes a Tw component.

That error came from “gyp”. This is the tool within npm that is responsible for compiling native C modules for use on the current platform. For most operating systems, “prebuilds” are available which are automatically downloaded, avoiding the compilation step, but when gyp is needed it requires a C compiler and associated tools to be installed. On a Mac, that typically means that Xcode needs to be installed. In your case, the error mentions “android_ndk_path” not being installed, which suggests that it would be worth manually installing the Android NDK and trying again.

However, it may be possible to work around the error. The error is occurring with the better-sqlite3 module, which is mostly written in C, and hence runs into the gyp issue. MWS also supports the alternate database engine node-sqlite3-wasm which has the advantage that it is written in pure JS, using WASM to run sqlite itself. The disadvantage is that WASM is not available in some environments (notably iOS due to the restrictions on JIT compilers).

I’ve added some docs to the site to troubleshoot these issues and explain the workaround.

1 Like

Hi @Thomas_Chuffart I’m glad to hear you’ve got things working.

How did you import the .tid file? Things should work as expected if you just drag the file to a wiki that has the bag you want to use at the top of its recipe.

The “import” button at the top of the bag listing page is primarily intended for importing large binary tiddlers directly to the server. It doesn’t understand .tid files, and will just faithfully import the .tid file as a binary file.

Thanks @jrbntt we are investigating, and I have created a GitHub ticket

  1. And after I add a new tiddler, I see no disk change, where is the new tiddler stored?

Is this a bug? I think it should save to ./editions/multiwikiserver. when I use npm start.

  1. Can I store the tid as plain text now? .db file will be bad for git backup. Is that what mws-save-archive and mws-load-archive command does? I think I can run them right before git backup. But I didn’t read how you handle deletion and conflict, when people sync notes between machines.

  2. Can we come up with a friendly name for MWS? Like “multi wiki mode”? I want to allow user enable this feature by checking an option. And for most of users, they are not setting up a server, they might enable MWS feature only for separating public/private notes.

So new user of TW can directly start editing, and optionally setup mws and bags later, will adding MWS break existing wiki?
Because I want to use MWS to build Notion style public/private space in TidGi app, so it is one step closer to Notion. Each bag will save to different folder, and sync to different git repo, one is public, one is private.