This is a fork of elasticdog's work.
I'm grateful for Aaron's work on this Dockerfile and
corresponding scripts in the contrib directory.
It appears to me that the original project is no longer being actively maintained (there are open pull requests with no comments to update the TiddlyWiki version dating back well over a year at the time of this writing.)
I'm further grateful that Aaron licensed this work under the MIT license so I can fork and maintain a copy for myself, and anyone else who is interested. I am maintaining the MIT license. In the unlikely case that it becomes relevant which portions of this repository's copyright is held by a specific individual, please examine the commit history.
Currently I've left the previous CircleCI config around but it is not hooked up to anything. I plan to use Github Actions to automate releases in the future.
TiddlyWiki is a self-contained JavaScript wiki that's useful as a non-linear notebook for capturing, organizing, and sharing complex information. These container images are for running TiddlyWiki as a Node.js application, which improves syncing and saving functionality over the single file version.
See the TiddlyWiki release notes for details on specific versions. Automated builds of these images are published to [elasticdog/tiddlywiki
on Docker Hub][].
These Docker images are meant to replicate the functionality of the tiddlywiki
CLI executable. As a sanity check, you can expect the following command to display the version number of TiddlyWiki:
docker run -it --rm jdharms/tiddlywiki --version
That said, there are a few caveats to consider when using a Docker-ized version of this command:
-
Port Publishing
The Dockerfile exposes port 8080 from the container, but you must bind to0.0.0.0
rather than the default127.0.0.1
(localhost) when running the HTTP server interface, or connectivity won't work from the host. -
Data Persistence
If you actually want to persist your tiddlers, you'll need to get them out of the container; you can use either volumes or bind mounts. In the container, there is a predefined data volume under/tiddlywiki
that is used as the default working directory. -
Ownership Permissions
If you do use a bind mount, don't forget that the process running within the container will change the host filesystem. You should run the container with the--user
option so that files are created with the desired ownership.
To facilitate handling these things, you can write short wrapper scripts for common scenarios...
NOTE: Advanced versions of these example scripts can be found in the contrib directory of the source repository.
For the scenario where you want to run commands interactively, you could create something like the following wrapper script:
#!/usr/bin/env bash
docker run --interactive --tty --rm \
--publish 127.0.0.1:8080:8080 \
--mount "type=bind,source=${PWD},target=/tiddlywiki" \
--user "$(id -u):$(id -g)" \
jdharms/tiddlywiki \
"$@"
Assuming the interactive wrapper script is named tiddlywiki-docker
and exists in the current directory, you can initialize and serve a new wiki using the following commands:
-
Create a folder for a new wiki that includes the server-related components:
$ ./tiddlywiki-docker mynewwiki --init server Copied edition 'server' to mynewwiki
-
Start the TiddlyWiki server:
$ ./tiddlywiki-docker mynewwiki --listen host=0.0.0.0 Serving on 0.0.0.0:8080 (press ctrl-C to exit) syncer-server-filesystem: Dispatching 'save' task: $:/StoryList filesystem: Saved file /tiddlywiki/mynewwiki/tiddlers/$__StoryList.tid
-
Edit the TiddlyWiki by navigating to http://localhost:8080 in your host's web browser. You should follow the Getting Started instructions to make sure that your changes are being reliably saved.
-
Stop the TiddlyWiki server by pressing
<Ctrl-C>
back in the terminal.
See ./tiddlywiki-docker --help
for more details.
For the scenario where you want to run commands in the background (e.g. to serve an existing wiki), you could create something like the following wrapper script:
#!/usr/bin/env bash
readonly WIKIFOLDER=$1
docker run --detach --rm \
--name tiddlywiki \
--publish 127.0.0.1:8080:8080 \
--mount "type=bind,source=${PWD},target=/tiddlywiki" \
--user "$(id -u):$(id -g)" \
jdharms/tiddlywiki \
"$WIKIFOLDER" \
--listen host=0.0.0.0
Assuming the background wrapper script is named tiddlywiki-serve
and exists in the current directory, you can serve an existing wiki using the following commands:
-
Start the TiddlyWiki server:
$ ./tiddlywiki-serve mynewwiki 9b76d1be260f9e19406cbdec9f5dd4d087ce87d81f345da4eb6d23723e928043
-
You can see that the TiddlyWiki server is still running in the background:
$ docker ps --latest CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 9b76d1be260f jdharms/tiddlywiki:latest "/sbin/tini -- tiddl…" Less than a second ago Up 23 seconds 127.0.0.1:8080->8080/tcp tiddlywiki
-
Edit the TiddlyWiki by navigating to http://localhost:8080 in your host's web browser.
-
Stop the TiddlyWiki server:
docker stop tiddlywiki
The TiddlyWiki Docker project welcomes contributions from everyone. If you're thinking of helping out, please read the guidelines for contributing.
tiddlywiki-docker is provided under the terms of the MIT License.
Portions Copyright © 2018–2021, Aaron Bull Schaefer.
Portions Copyright © 2023, Daniel Harms