MultiWikiServer docker

Context and Motivation
I run all my wikis under Docker. Since I manage several, I decided to try MWS. So far, I’m impressed by the project’s quality—especially its authentication, role management, and separation between wikis.

Performance Observations
On the performance side, I’ve seen a slight improvement with my largest wiki: load time dropped from 30 seconds on a legacy Node.js server to 24 seconds with MWS. While not a huge difference, I suspect this is due to how I load images internally (without HTTP requests). I’d welcome advice on this: Should I set up a dedicated HTML server just for images? If so, what’s the most effective way to do it?

Docker Benefits
Running MWS under Docker makes it easy to iterate in a test environment. Binding the container to a local directory ensures persistent wiki data.

Automation Script
Not being a Docker expert, I spent some time building a script that works for both initial image creation and subsequent container runs. The code is available—feel free to try it out and adapt it to your needs.

docker-compose.yml:

services:
  mwsTiddlywiki:
    image: node:latest
    container_name: mwstiddlywiki
    user: "node"
    restart: unless-stopped
    ports:
      - "8900:8080"
    volumes:
      - .:/home/node/app
    working_dir: /home/node/app
    environment:
      - HOME=/home/node
      - USER=node
      - HOST=0.0.0.0
    command: >
      sh -c "
      if [ ! -d \"mwsTiddlywiki\" ]; then
        npm init @tiddlywiki/mws@latest \"mwsTiddlywiki\"
      fi &&
      cd mwsTiddlywiki &&
      if [ ! -f \"store.json\" ]; then
        npx mws init-store
      fi &&
      npx mws listen --listener host=0.0.0.0
      "
1 Like

Thanks for sharing. As a very occasional user of docker, building such images, even finding and using one is all but imposible especialy if we want to prepare it for online hosting. I would hope one day when MWS has stabalised someone would document thi, such even us “docker” dummies could implement it, but I see the same need for standard node tiddlywiki.

  • As far as I can tell its the only practical way to get a node application safely and easily on the internet.

This may be the reason, why file access is slow. Which OS do you use?

IMO you should use an extra docker volume for persistent data and mount it to the MWS container. It should be much more performant than if the docker container needs to reach out to the OS filesystem.

IMO it would be worth an experiment.

For saves, but perhaps outside for backups?

I tried to build a container using a docker named volume, stored in Docker’s internal volume store. My config uses the node user, more safe than running a container with root. I couldn’t get around a permission issue, Docker creating the volume with the root user and node couldn’t access it with the node user. Even with the assistance of three AI agents I didn’t succeed yet!

I must move to something else now but I.LL share the solution if I find it later.