OK, after pulling my hair out for a couple of days I seem to have it 
working.
I'll make it clear though this is all about cut & paste and stubbornness 
rather than any real understanding, YMMV.

This is Tiddlywiki 5, Node.js install on a VPS running Ubuntu 12.04LTS, 
launching at boot. 
The same principal should apply to any distribution using 
Upstart<http://upstart.ubuntu.com/>
 though.

I installed node.js following this 
guide<https://www.digitalocean.com/community/articles/how-to-install-an-upstream-version-of-node-js-on-ubuntu-12-04>.
 
You can ignore the penultimate step as mentioned in the comments as the 
Node Package Manager seems to be bundled now.

Install Tiddlywiki on 
Node.js<http://tiddlywiki.com/static/Installing%2520TiddlyWiki%2520on%2520Node.js.html>
 as 
outlined in the docs.

Add an Upstart script to /etc/init

$sudo nano /etc/init/tiddywiki-forever.conf

# /etc/init/tiddlywiki-forever.conf
 
description "Tiddlywiki 5 Launcher"
author      "J Donaldson"


# If network interface is wireless
# start on (local-filesystems and net-device-up IFACE=wlan0)
# If network interface is Ethernet
start on (local-filesystems and net-device-up IFACE=eth0)
 
stop on shutdown
 
# Automatically Respawn:
respawn
respawn limit 99 5


# We run as this user instead of as root (the default user).
# Depending on your environment you may want to add a user for node.
setuid user
 
script
    # Not sure why $HOME is needed, but it seems to be:
    export HOME="/home/user/mywiki"
    
    cd $HOME
 
    exec /home/user/local/bin/node /home/user/local/lib/node_modules/
tiddlywiki/tiddlywiki.js --server

end script

You will need to tweak this to match your details and adding logging may be 
a good idea.

$sudo start tiddlwiki-forever
will launch it

$sudo stop tiddlwiki-forever
will stop it and it should run as soon as your network comes up after a 
reboot.

You ought to be able to add any of the server 
commands<http://tiddlywiki.com/static/ServerCommand.html>
 too.
I'm not wise enough to know if this is the best way to achieve this or 
whether it is secure, robust or whatever else so use it at your own risk.

>
>  

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to