1. create a directory for tiddlywiki
mkdir tdwiki
2. Under this directory, initialize a notebook named "mywiki"
user:~/tdwiki$ tiddlywiki mywiki --init server
Copied edition 'server' to mywiki
After this command, we are supposed to a see sub-directory named "mywiki" created under the parent directory "tdwiki"
3. To load exting tiddlers in index_2015-9-23.html created by tiddlywiki desktop verion
3.1 --type the help on load command
user:~/tdwiki$ tiddlywiki --help load
Load tiddlers from 2.x.x TiddlyWiki files (.html), .tiddler, .tid, .json or other files
3.2 --actual loading
To load tiddlers from the exsiting html file.
tiddlywiki ./MyWiki --load my_encrypted_wiki.html
user:~/tdwiki$ tiddlywiki ./mywiki --load index_2015-9-23.html
syncer-server: Dispatching 'save' task: $:/StoryList
FileSystem: Saved file /home/user/tdwiki/mywiki/tiddlers/$__StoryList.tid
syncer-server: Dispatching 'save' task: bf Operator
FileSystem: Saved file /home/user/tdwiki/mywiki/tiddlers/bf_Operator.tid
syncer-server: Dispatching 'save' task: BetaReleases
FileSystem: Saved file /home/user/tdwiki/mywiki/tiddlers/BetaReleases.tid
syncer-server: Dispatching 'save' task: before Operator (Examples)
FileSystem: Saved file /home/user/tdwiki/mywiki/tiddlers/before_Operator_(Examples).tid
syncer-server: Dispatching 'save' task: before Operator
FileSystem: Saved file /home/user/tdwiki/mywiki/tiddlers/before_Operator.tid
...
4. verify that many tiddlers are created under the "miwiki" subdirectory
5. finaly, start the tiddlywiki service for "mywiki" on port 8080 of server ip 192.168.0.96, with logon id & password
nohup /usr/local/bin/tiddlywiki /home/user/tdwiki/mywiki --server 8080 $:/core/save/all text/plain text/html user xxxxxxx 192.168.0.96 &
6. To permanent add it as sysv service in 14.04. I created the following 3 scripts for init.d service to start the service called "mywiki" automatically upon rebooting.
/home/user/tdwiki/start_mywiki.sh
/home/user/tdwiki/stop_mywiki.sh
/etc/init.d/mywiki
user:~/tdwiki$ cat start_mywiki.sh
#!/bin/bash
nohup /usr/local/bin/tiddlywiki /home/user/tdwiki/mywiki --server 8080 $:/core/save/all text/plain text/html user xxxxxxx 192.168.0.96 &
user:~/tdwiki$ cat stop_mywiki.sh
#!/bin/bash
ps -fu user |grep mywiki |grep 8080 |awk '{ print $2 }' | xargs kill
#Note here the scipt name /etc/init.d/mywiki should not have the suffix ".sh"
user:~/tdwiki$ cat /etc/init.d/mywiki
#! /bin/sh
### BEGIN INIT INFO
# Provides: daoqidao wiki
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: for daoqidao tiddlywiki service
# Description: This file starts and stops tiddlywiki server
#
### END INIT INFO
case "$1" in
start)
su user -c /home/user/tdwiki/start_mywiki.sh
;;
stop)
su user -c /home/user/tdwiki/stop_mywiki.sh
sleep 1
;;
status)
ps -fu user |grep mywiki |grep 8080
;;
restart)
su user -c /home/user/tdwiki/stop_mywiki.sh
sleep 2
su user -c /home/user/tdwiki/start_mywiki.sh
;;
*)
echo "Usage: mywiki {start|stop|restart}" >&2
exit 3
;;
esac
7. If all goes well then register the script as an init script:
sudo update-rc.d mywiki defaults
8. Reboot the machine and make sure that Tomcat has started.
References: https://mobiarch.wordpress.com/2014/05/16/creating-an-init-script-in-ubuntu-14-04/
9. I also created a such service in one Ubuntu 15.04, which uses systemd instead to manage the service. The script is different.
user:~/tdwiki/ubuntu15.04$ cat /etc/tiddlywiki.conf
WIKI=/home/user/tdwiki/mywiki
PORT=8080
OPTS="$:/core/save/all text/plain text/html"
USER=user
PWD=xxxxxxx
IP=192.168.0.96
user:~/tdwiki/ubuntu15.04$ cat tiddlywiki.service
[Unit]
Description=TiddlyWiki
After=syslog.target
[Service]
User=user
Group=user
SyslogIdentifier=tiddlywiki
Restart=always
setuid=1000
StandardOutput=syslog
EnvironmentFile=/etc/tiddlywiki.conf
ExecStart=/usr/local/bin/tiddlywiki $WIKI --server $PORT $OPTS $USER $PWD $IP
[Install]
WantedBy=multi-user.target
10. move the file tiddlywiki.service to /etc/systemd/system and ran sudo systemctl enable tiddlywiki.service to create link scripts.
11. Restart server for verification
Showing posts with label knives. Show all posts
Showing posts with label knives. Show all posts
Monday, September 28, 2015
Friday, September 25, 2015
running tiddlywiki on windows as a service
Referenced below two links: http://tiddlywiki.com/static/Installing%2520TiddlyWiki%2520on%2520Node.js.html
http://www.rubix.nl/blogs/running-tiddlywiki-service-linux-and-windows
But they are not detai enough for me, so list down my steps after spending half an hour on the setup.
1. download node.js from https://nodejs.org/dist/latest/ and installed it.
2. now I have npm.exe to install tiddlywiki.
C:\Users\liqy>npm install -g tiddlywiki
C:\Users\liqy\AppData\Roaming\npm\tiddlywiki -> C:\Users\liqy\AppData\Roaming\npm\node_modules\tiddlywiki\tiddlywiki.js
tiddlywiki@5.1.9 C:\Users\liqy\AppData\Roaming\npm\node_modules\tiddlywiki
Note that tiddlywiki.js is installed under AppData sub-directory by default.
C:\Users\liqy>
3. now initialize the notebook named "mywiki". The step should be followed, which same as on Linux platform.
Note that the directory for notebook "mywiki" should be empty.
C:\Users\liqy\AppData\Roaming\npm\node_modules\tiddlywiki>node .\tiddlywiki.js "
D:\mydoc\pp\sync\mywiki" --init server
Error: Wiki folder is not empty
--this is due to I put a local copy of tiddlywik html file there.
--after remove it , and try again
C:\Users\liqy\AppData\Roaming\npm\node_modules\tiddlywiki>node .\tiddlywiki.js "
D:\mydoc\pp\sync\mywiki" --init server
Copied edition 'server' to D:\mydoc\pp\sync\mywiki
3.2 If not, I hit below error when I try to start the service
C:\Users\liqy\AppData\Roaming\npm\node_modules\tiddlywiki>node .\tiddlywiki.js "
D:\mydoc\pp\sync\mywiki" --server 88 --verbose --rendertiddler $:/core/save/all
mywiki.html text/plain
Warning: Wiki folder 'D:\mydoc\pp\sync\mywiki' does not exist or is missing a ti
ddlywiki.info file
Serving on 127.0.0.1:88
(press ctrl-C to exit)
$:/core/modules/commands/server.js:304
if($tw.boot.wikiInfo.plugins.indexOf("tiddlywiki/tiddlyweb") === -1 || $
tw.boot.wikiInfo.plugins.indexOf("tiddlywiki/filesystem") === -1) {
^
TypeError: Cannot read property 'plugins' of null
at Command.execute ($:/core/modules/commands/server.js:304:22)
at Commander.executeNextCommand ($:/core/modules/commander.js:82:14)
at Commander.execute ($:/core/modules/commander.js:46:7)
at Object.exports.startup ($:/core/modules/startup/commands.js:34:12)
at $tw.boot.executeNextStartupTask (C:\Users\liqy\AppData\Roaming\npm\node_m
odules\tiddlywiki\boot\boot.js:1905:10)
at $tw.boot.executeNextStartupTask (C:\Users\liqy\AppData\Roaming\npm\node_m
odules\tiddlywiki\boot\boot.js:1903:21)
at $tw.boot.executeNextStartupTask (C:\Users\liqy\AppData\Roaming\npm\node_m
odules\tiddlywiki\boot\boot.js:1903:21)
at $tw.boot.executeNextStartupTask (C:\Users\liqy\AppData\Roaming\npm\node_m
odules\tiddlywiki\boot\boot.js:1903:21)
at $tw.boot.executeNextStartupTask (C:\Users\liqy\AppData\Roaming\npm\node_m
odules\tiddlywiki\boot\boot.js:1903:21)
at $tw.boot.startup (C:\Users\liqy\AppData\Roaming\npm\node_modules\tiddlywi
ki\boot\boot.js:1856:11)
The command
node .\tiddlywiki.js "D:\mydoc\pp\sync\mywiki" --server 88 --verbose --rendertiddler $:/core/save/all mywiki.html text/plain
This is to start the tiddly service listening on localhost port 88 , for notebook named "mywiki"
C:\Users\liqy\AppData\Roaming\npm\node_modules\tiddlywiki>node .\tiddlywiki.js "
D:\mydoc\pp\sync\mywiki" --server 88 --verbose --rendertiddler $:/core/save/all
mywiki.html text/plain
Serving on 127.0.0.1:88
(press ctrl-C to exit)
Boot log:
Startup task: load-modules
Startup task: info after: load-modules before: startup
Startup task: startup after: load-modules
Startup task: story after: startup
Startup task: commands platforms: node after: story
Executing command: rendertiddler $:/core/save/all mywiki.html text/plain
syncer-server: Dispatching 'save' task: $:/StoryList
FileSystem: Saved file D:\mydoc\pp\sync\mywiki\tiddlers\$__StoryList.tid
syncer-server: Dispatching 'save' task: $:/StoryList
FileSystem: Saved file D:\mydoc\pp\sync\mywiki\tiddlers\$__StoryList.tid
5. Confirmed no issue with method, pressed CTRL+C to stop it , and invoke the nssm installed to add service to the windows registry.
D:\tools\nssm\win32>nssm install tiddlywiki
Service "tiddlywiki" installed successfully!
The startup directory in my case is:
C:\Users\liqy\AppData\Roaming\npm\node_modules\tiddlywiki
The arguments in my case is :
.\tiddlywiki.js "D:\mydoc\pp\sync\mywiki" --server 88 --verbose --rendertiddler $:/core/save/all mywiki.html text/plain
By the way, command to edit the tiddlywiki is
D:\tools\nssm\win32>nssm edit tiddlywiki
6.Verify that "tiddlywiki" service is added in "control panel/services"
7. Finally I see it in my web browser with address "http://localhost:88"
8. If there is existing tiddlers in a single html file, I believe tiddlywiki upload command can help to migrate existing tiddlers.
http://www.rubix.nl/blogs/running-tiddlywiki-service-linux-and-windows
But they are not detai enough for me, so list down my steps after spending half an hour on the setup.
1. download node.js from https://nodejs.org/dist/latest/ and installed it.
2. now I have npm.exe to install tiddlywiki.
C:\Users\liqy>npm install -g tiddlywiki
C:\Users\liqy\AppData\Roaming\npm\tiddlywiki -> C:\Users\liqy\AppData\Roaming\npm\node_modules\tiddlywiki\tiddlywiki.js
tiddlywiki@5.1.9 C:\Users\liqy\AppData\Roaming\npm\node_modules\tiddlywiki
Note that tiddlywiki.js is installed under AppData sub-directory by default.
C:\Users\liqy>
3. now initialize the notebook named "mywiki". The step should be followed, which same as on Linux platform.
Note that the directory for notebook "mywiki" should be empty.
C:\Users\liqy\AppData\Roaming\npm\node_modules\tiddlywiki>node .\tiddlywiki.js "
D:\mydoc\pp\sync\mywiki" --init server
Error: Wiki folder is not empty
--this is due to I put a local copy of tiddlywik html file there.
--after remove it , and try again
C:\Users\liqy\AppData\Roaming\npm\node_modules\tiddlywiki>node .\tiddlywiki.js "
D:\mydoc\pp\sync\mywiki" --init server
Copied edition 'server' to D:\mydoc\pp\sync\mywiki
C:\Users\liqy\AppData\Roaming\npm\node_modules\tiddlywiki>node .\tiddlywiki.js "
D:\mydoc\pp\sync\mywiki" --server 88 --verbose --rendertiddler $:/core/save/all
mywiki.html text/plain
Warning: Wiki folder 'D:\mydoc\pp\sync\mywiki' does not exist or is missing a ti
ddlywiki.info file
Serving on 127.0.0.1:88
(press ctrl-C to exit)
$:/core/modules/commands/server.js:304
if($tw.boot.wikiInfo.plugins.indexOf("tiddlywiki/tiddlyweb") === -1 || $
tw.boot.wikiInfo.plugins.indexOf("tiddlywiki/filesystem") === -1) {
^
TypeError: Cannot read property 'plugins' of null
at Command.execute ($:/core/modules/commands/server.js:304:22)
at Commander.executeNextCommand ($:/core/modules/commander.js:82:14)
at Commander.execute ($:/core/modules/commander.js:46:7)
at Object.exports.startup ($:/core/modules/startup/commands.js:34:12)
at $tw.boot.executeNextStartupTask (C:\Users\liqy\AppData\Roaming\npm\node_m
odules\tiddlywiki\boot\boot.js:1905:10)
at $tw.boot.executeNextStartupTask (C:\Users\liqy\AppData\Roaming\npm\node_m
odules\tiddlywiki\boot\boot.js:1903:21)
at $tw.boot.executeNextStartupTask (C:\Users\liqy\AppData\Roaming\npm\node_m
odules\tiddlywiki\boot\boot.js:1903:21)
at $tw.boot.executeNextStartupTask (C:\Users\liqy\AppData\Roaming\npm\node_m
odules\tiddlywiki\boot\boot.js:1903:21)
at $tw.boot.executeNextStartupTask (C:\Users\liqy\AppData\Roaming\npm\node_m
odules\tiddlywiki\boot\boot.js:1903:21)
at $tw.boot.startup (C:\Users\liqy\AppData\Roaming\npm\node_modules\tiddlywi
ki\boot\boot.js:1856:11)
4. Try to start the service to see if any error, before adding as a service
The command
node .\tiddlywiki.js "D:\mydoc\pp\sync\mywiki" --server 88 --verbose --rendertiddler $:/core/save/all mywiki.html text/plain
This is to start the tiddly service listening on localhost port 88 , for notebook named "mywiki"
C:\Users\liqy\AppData\Roaming\npm\node_modules\tiddlywiki>node .\tiddlywiki.js "
D:\mydoc\pp\sync\mywiki" --server 88 --verbose --rendertiddler $:/core/save/all
mywiki.html text/plain
Serving on 127.0.0.1:88
(press ctrl-C to exit)
Boot log:
Startup task: load-modules
Startup task: info after: load-modules before: startup
Startup task: startup after: load-modules
Startup task: story after: startup
Startup task: commands platforms: node after: story
Executing command: rendertiddler $:/core/save/all mywiki.html text/plain
syncer-server: Dispatching 'save' task: $:/StoryList
FileSystem: Saved file D:\mydoc\pp\sync\mywiki\tiddlers\$__StoryList.tid
syncer-server: Dispatching 'save' task: $:/StoryList
FileSystem: Saved file D:\mydoc\pp\sync\mywiki\tiddlers\$__StoryList.tid
5. Confirmed no issue with method, pressed CTRL+C to stop it , and invoke the nssm installed to add service to the windows registry.
D:\tools\nssm\win32>nssm install tiddlywiki
Service "tiddlywiki" installed successfully!
The startup directory in my case is:
C:\Users\liqy\AppData\Roaming\npm\node_modules\tiddlywiki
The arguments in my case is :
.\tiddlywiki.js "D:\mydoc\pp\sync\mywiki" --server 88 --verbose --rendertiddler $:/core/save/all mywiki.html text/plain
By the way, command to edit the tiddlywiki is
D:\tools\nssm\win32>nssm edit tiddlywiki
6.Verify that "tiddlywiki" service is added in "control panel/services"
7. Finally I see it in my web browser with address "http://localhost:88"
8. If there is existing tiddlers in a single html file, I believe tiddlywiki upload command can help to migrate existing tiddlers.
Wednesday, June 12, 2013
Subscribe to:
Posts (Atom)





