so I managed to deploy a working TW5 on a Qnap NAS in a container using deadlemon image from docker.hub. Unfortunately I am unable to figure out how I can make it lazy load. My TW is about 100MB (1400 tiddlers with images) and it takes approx. 4min. to load depending on a connection speed.
Where is a option to lazy load? How to make it lazy load on every restart?
The pre-built image you are using is already compiled with the startup lines, so if you want to use the root-tiddler=$:/core/save/lazy-images startup config, you will most likely have to compile your own docker image. Does deadlemon offer the Dockerfile that was used to create the image? If so, you can build your own. I build my own from an init script I found somewhere a while back and customized it. I also use lazy-images, and just build a new image with each release of tiddlywiki.
Hi there, I never tried to compile docker images but if it is the only way to go I need to learn it.
Can you explan what are the steps to do it and maybe you could upload somewhere needed files? I will try to do it
Well, I’m not familiar with the Qnap NAS as far as if you can bring up a terminal and install everything required to build images from the terminal of the NAS itself, or if you will have to have a separate machine with a terminal to build it. I built mine on a linux machine, compiling it for the arm64 processor on my raspberry pi machines. I am going to be building images for arm64 and amd64 and placing them online for all my machines, so perhaps you could simply try using my images when I upload them to the docker hub after each Tiddlywiki upgrade, similar to how you are currently using deadlemon’s image.
Do you know what architecture your NAS is using? Is it arm or amd/intel?
Not sure what CPU your NAS is running, but if it is armv7 you’ll have to wait until I get around to pushing an image for that. If you are unsure, just try pulling the image and if your NAS is on arm64 or 64 bit intel/amd then it will pull the correct image.
It is absolutely great to have a docker image of a tiddlywiki-server. Can you tell more about what you did there? Is it a node.js mws instance? Does it already incorporate the bags and recepies concept?
Sure, it is a pretty straightforward and easy docker build. It uses the Dockerfile as well as a file called init-and-run-wiki, which is a shell script to setup the node v8 memory management and the initialization lines to run the server.
Dockerfile:
FROM node:alpine
RUN npm install -g tiddlywiki
WORKDIR /var/lib/tiddlywiki
# Add init-and-run script
ADD init-and-run-wiki /usr/local/bin/init-and-run-wiki
# Meta
CMD ["/usr/local/bin/init-and-run-wiki"]
EXPOSE 8080
init-and-run-wiki:
#!/bin/sh
set -e
tiddlywiki_script=$(readlink -f $(which tiddlywiki))
if [ -n "$NODE_MEM" ]; then
# Based on rule of thumb:
# This will determine the correct max_old_space_size depending on the memory of the system.
# This is to ensure th V8 engine does not crash your tiddlywiki process and ensure you do
# not run out of memory on the system.
mem_node_old_space=$((($NODE_MEM*4)/5))
NODEJS_V8_ARGS="--max_old_space_size=$mem_node_old_space $NODEJS_V8_ARGS"
fi
if [ ! -d /var/lib/tiddlywiki/mywiki ]; then
/usr/bin/env node $NODEJS_V8_ARGS $tiddlywiki_script mywiki --init server
mkdir /var/lib/tiddlywiki/mywiki/tiddlers
fi
# Start the tiddlywiki server
exec /usr/bin/env node $NODEJS_V8_ARGS $tiddlywiki_script mywiki --listen root-tiddler=$:/core/save/lazy-images host=0.0.0.0 port=8080 debug-level=${DEBUG_LEVEL-none}
Just put the Dockerfile in a directory with the init-and-run-wiki file and run:
But thank you a lot for this. It would be great to have a documentation and if the MWS is stable a version of that. My dream would be to be able to integrate tiddlywiki into a nextcloud that way … and to be able to use the NC user-managment. Dockerization is an important step for that.