TiddlyWiki is a lightweight, highly customizable self-contained wiki designed for personal knowledge management and project documentation. Its single-file architecture and powerful plugin ecosystem make it an excellent option for self-hosting, offering full control over your data and environment. This guide will walk you through the process of installing, configuring, and managing TiddlyWiki, including steps for setting up a reverse proxy, enabling logging, automating backups, and leveraging its unique features.
Installing TiddlyWiki
π¦ Docker/Docker Compose Setup
Using Docker is one of the easiest ways to deploy TiddlyWiki. Below is a docker-compose.yml
file optimized for a self-hosted setup:
version: "3.8"
services:
tiddlywiki:
image: node:current-alpine
container_name: tiddlywiki
volumes:
- ./data:/wiki
ports:
- "8080:8080"
working_dir: /wiki
command: >
sh -c "npm install -g tiddlywiki &&
tiddlywiki ./wiki --init server --listen port=8080 host=0.0.0.0"
Run the following commands to deploy TiddlyWiki:
mkdir -p ~/tiddlywiki/data
## Navigate to the directory and create the docker-compose.yml file
cd ~/tiddlywiki
nano docker-compose.yml
## Start the container
docker-compose up -d
π Manual Installation
For those who prefer a manual setup on a Linux server, hereβs how to install and run TiddlyWiki:
## Update the system and install Node.js
sudo apt update && sudo apt upgrade -y
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt install -y nodejs
## Install TiddlyWiki globally
sudo npm install -g tiddlywiki
## Initialize and run your TiddlyWiki instance
mkdir ~/tiddlywiki
cd ~/tiddlywiki
tiddlywiki ./wiki --init server
tiddlywiki ./wiki --listen port=8080 host=0.0.0.0
TiddlyWiki will now be available on http://<your-server-ip>:8080
.
Configuring Nginx as a Reverse Proxy
π Nginx Configuration
To serve TiddlyWiki via a domain, configure Nginx as a reverse proxy:
sudo nano /etc/nginx/sites-available/tiddlywiki
Add the following configuration:
server {
listen 80;
server_name yourdomain.com;
location / {
proxy_pass http://localhost:8080;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
Activate the configuration and restart Nginx:
sudo ln -s /etc/nginx/sites-available/tiddlywiki /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl restart nginx
π SSL/TLS Setup
Secure your installation with Let's Encrypt:
sudo apt install certbot python3-certbot-nginx -y
sudo certbot --nginx -d yourdomain.com
sudo systemctl reload nginx
π οΈ Testing and Reloading Nginx
Verify that Nginx is configured correctly and reload the service:
sudo nginx -t
sudo systemctl reload nginx
Logging and Debugging TiddlyWiki
ποΈ Enabling Debug Logs
Enable debug-level logging in TiddlyWiki by appending the debug-level
flag to your startup command:
tiddlywiki ./wiki --listen port=8080 host=0.0.0.0 debug-level=debug
π Viewing Logs
If you're running TiddlyWiki in Docker, view logs with:
docker logs tiddlywiki
For manual setups, logs will appear in the terminal output or can be redirected to a file:
tiddlywiki ./wiki --listen port=8080 host=0.0.0.0 > tiddlywiki.log 2>&1
π οΈ Troubleshooting Common Issues
If TiddlyWiki fails to start, verify the following:
-
Port conflicts: Ensure no other services are using the same port.
-
Node.js version: Use a supported version (Node.js 14+).
π€ Exporting Logs
Send logs to an external log management system like ELK Stack using Filebeat or similar tools. Example Filebeat configuration snippet:
filebeat.inputs:
- type: log
paths:
- /path/to/tiddlywiki.log
Backup and Restore
ποΈ File-Based Backups
For file-based installations, back up the wiki
directory:
tar -czvf tiddlywiki-backup.tar.gz ~/tiddlywiki/wiki
π Database Backups
If using a database plugin, export the data using the pluginβs documentation and commands.
π Automated Backup Scripts
Create a cron job to automate backups:
echo "0 2 * * * tar -czvf ~/tiddlywiki-backup-$(date +\%F).tar.gz ~/tiddlywiki/wiki" | crontab -
Updating and Upgrading TiddlyWiki
β¬οΈ Updating Docker Images
Update your Dockerized TiddlyWiki instance:
docker-compose pull
docker-compose down
docker-compose up -d
π οΈ Manual Updates
For manual installations, update TiddlyWiki globally:
sudo npm install -g tiddlywiki
π Checking for Updates
Verify the installed version of TiddlyWiki:
tiddlywiki --version
Leveraging TiddlyWikiβs Unique Features
π§ Enabling APIs
Enable the REST API for TiddlyWiki by starting it with the credentials
option:
tiddlywiki ./wiki --listen port=8080 host=0.0.0.0 username=user password=pass
Access the API using curl
:
curl -u user:pass http://localhost:8080
π Advanced Configurations
Customize TiddlyWiki further by editing the $:/config
tiddlers from the graphical interface. You can also integrate third-party tools like Pandoc for exporting wikis to other formats.
Wrapping Up
This guide covered the essentials of deploying, configuring, and managing TiddlyWiki, including Docker setups, Nginx reverse proxying, logging, backups, and updates. Self-hosting TiddlyWiki grants you unparalleled flexibility and control over your data. With these steps, youβre ready to fully exploit TiddlyWikiβs robust capabilities. Dive in, customize, and enjoy!