elasticdog / tiddlywiki-docker

Tools for running TiddlyWiki via a Docker container

Home Page:https://hub.docker.com/r/elasticdog/tiddlywiki/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Supported tags and respective Dockerfile links

TiddlyWiki Docker

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.

Build Status

See the TiddlyWiki release notes for details on specific versions. Automated builds of these images are published to elasticdog/tiddlywiki on Docker Hub.

Usage

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 elasticdog/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 to 0.0.0.0 rather than the default 127.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.

Interactive Wrapper

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)" \
	elasticdog/tiddlywiki \
	"$@"

Interactive Example

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:

  1. Create a folder for a new wiki that includes the server-related components:

    $ ./tiddlywiki-docker mynewwiki --init server
    Copied edition 'server' to mynewwiki
    
  2. 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
    
  3. 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.

  4. Stop the TiddlyWiki server by pressing <Ctrl-C> back in the terminal.

See ./tiddlywiki-docker --help for more details.

Background Wrapper

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)" \
	elasticdog/tiddlywiki \
	"$WIKIFOLDER" \
	--listen host=0.0.0.0

Background Example

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:

  1. Start the TiddlyWiki server:

    $ ./tiddlywiki-serve mynewwiki
    9b76d1be260f9e19406cbdec9f5dd4d087ce87d81f345da4eb6d23723e928043
    
  2. 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        elasticdog/tiddlywiki:latest   "/sbin/tini -- tiddl…"   Less than a second ago   Up 23 seconds       127.0.0.1:8080->8080/tcp   tiddlywiki
    
  3. Edit the TiddlyWiki by navigating to http://localhost:8080 in your host's web browser.

  4. Stop the TiddlyWiki server:

    docker stop tiddlywiki
    

Contributing

The TiddlyWiki Docker project welcomes contributions from everyone. If you're thinking of helping out, please read the guidelines for contributing.

License

tiddlywiki-docker is provided under the terms of the MIT License.

Copyright © 2018–2021, Aaron Bull Schaefer.

About

Tools for running TiddlyWiki via a Docker container

https://hub.docker.com/r/elasticdog/tiddlywiki/

License:MIT License


Languages

Language:Shell 59.9%Language:Makefile 29.8%Language:Dockerfile 10.3%