Line 303: |
Line 303: |
| =====Create Additional Administrators===== | | =====Create Additional Administrators===== |
| http://docs.moodle.org/26/en/Assign_admins | | http://docs.moodle.org/26/en/Assign_admins |
| + | |
| + | ==TiddlyWiki5 Using Node.js== |
| + | [http://tiddlywiki.com/ TiddlyWiki] is "a complete interactive wiki in JavaScript." |
| + | |
| + | {{Warning box|The install and update routines shown here are based on notes from a working installation.<br>The removal routines are untested.}} |
| + | |
| + | ===Prerequisites=== |
| + | # node.js > 8.x (note: I was unable to find a binary installer for curent node releases; I use 'gcc' and compile locally) |
| + | # [https://npmjs.org/package/npm npm] |
| + | |
| + | ===Assumptions=== |
| + | # wiki content will be stored in /opt/tiddlywiki/tiddlers |
| + | # tiddlywiki code will be stored in /opt/tiddlywiki/node_modules |
| + | # tiddlywiki will run as user 'www' |
| + | # tiddlywiki logs will be run as 'smelog' |
| + | # tiddlywiki will be daemonized using daemontools |
| + | |
| + | ===Installation=== |
| + | <nowiki>mkdir /opt/tiddlywiki |
| + | cd /opt/tiddlywiki |
| + | npm install tiddlywiki |
| + | chown -R www:www /opt/tiddlywiki/.</nowiki> |
| + | |
| + | ====Create daemontools scripts, folders, etc==== |
| + | The code below is designed to be run by copy/paste into a server console prompt. |
| + | |
| + | <nowiki>mkdir -p /var/service/tiddlywiki/log |
| + | mkdir -p /var/log/tiddlywiki |
| + | chown -R smelog:smelog /var/log/tiddlywiki |
| + | cd /service |
| + | ln -s /var/service/tiddlywiki . |
| + | cd /var/service/tiddlywiki |
| + | touch down |
| + | # |
| + | # create the service 'run' file |
| + | # |
| + | echo '#!/bin/sh |
| + | # |
| + | # setup node environment |
| + | # |
| + | exec 2>&1 |
| + | # |
| + | APP_DIR=/opt/tiddlywiki |
| + | USER=www |
| + | # |
| + | NODE_EXEC=/usr/local/bin/node |
| + | NODE_ENV=production |
| + | NODE_CONFIG_DIR=$APP_DIR |
| + | NODE_APP=node_modules/tiddlywiki/tiddlywiki.js |
| + | NODE_ARGS=--server |
| + | echo "Starting $NODE_EXEC $APP_DIR/$NODE_APP $NODE_ARGS" |
| + | cd $APP_DIR |
| + | exec \ |
| + | setuidgid $USER \ |
| + | $NODE_EXEC $NODE_APP $NODE_ARGS |
| + | ' > /var/service/tiddlywiki/run |
| + | |
| + | # |
| + | # Create log/run |
| + | # |
| + | echo '#!/bin/sh |
| + | # |
| + | exec \ |
| + | /usr/local/bin/setuidgid smelog \ |
| + | /usr/local/bin/multilog t s5000000 \ |
| + | /var/log/tiddlywiki' > /var/service/tiddlywiki/log/run </nowiki> |
| + | |
| + | ====start the service==== |
| + | sv u tiddlywiki |
| + | |
| + | ====check the log files to see if it worked==== |
| + | tail /var/log/tiddlywiki/current |
| + | |
| + | ====Create init.d script and startup.shutdown scripts==== |
| + | This segment of code will create the scripts needed to start the service at boot and to stop the service at shutdown. |
| + | |
| + | <nowiki>SERVICE=tiddlywiki |
| + | # |
| + | cd /etc/rc.d/init.d |
| + | ln -s daemontools $SERVICE |
| + | cd /etc/rc.d/rc0.d |
| + | ln -s /etc/rc.d/init.d/e-smith-service K01$SERVICE |
| + | cd /etc/rc.d/rc1.d |
| + | ln -s /etc/rc.d/init.d/e-smith-service K01$SERVICE |
| + | cd /etc/rc.d/rc6.d |
| + | ln -s /etc/rc.d/init.d/e-smith-service K01$SERVICE |
| + | cd /etc/rc.d/rc7.d |
| + | ln -s /etc/rc.d/init.d/e-smith/service S99$SERVICE</nowiki> |
| + | |
| + | ====Create config db entry==== |
| + | /etc/rc.d/init.d/e-smith-service will start a service whose status is ''enabled'', and will not start it otherwise. |
| + | |
| + | <nowiki>SERVICE=tiddlywiki |
| + | config set $SERVICE service access public status enabled</nowiki> |
| + | |
| + | ====Proxypass Domain for WAN access==== |
| + | I found that I needed to [http://wiki.contribs.org/SME_Server:Documentation:ProxyPass#ProxyPass_a_domain proxypass a domain]. An [http://wiki.contribs.org/SME_Server:Documentation:ProxyPass#ProxyPass_a_alias.2Fdirectory.2Flocation alias/directory/location] proxypass generated errors and prevented edits from saving correctly. |
| + | |
| + | <nowiki>DOMAIN=tiddlywiki.domain.tld |
| + | db domains set $DOMAIN domain Nameservers internet ProxyPassTarget http://localhost:8080/ TemplatePath ProxyPassVirtualHosts |
| + | signal-event domain-create $DOMAIN</nowiki> |
| + | |
| + | ===Update to the latest tiddlywiki code=== |
| + | <nowiki>cd /opt/tiddlywiki && setuidgid www npm update tiddlywiki && sv t tiddlywiki</nowiki> |
| + | |
| + | ===COMPLETE Removal=== |
| + | <nowiki>DOMAIN=tiddlywiki.domain.tld |
| + | signal-event domain-delete $DOMAIN |
| + | db domains delete $DOMAIN |
| + | # |
| + | SERVICE=tiddlywiki |
| + | config delete $SERVICE |
| + | find /etc/rc.d -name "*$SERVICE*" -exec 'rm' -f "{}" \; |
| + | 'rm' -rf /service/$SERVICE |
| + | 'rm' -rf /var/service/$SERVICE |
| + | 'rm' -rf /var/log/$SERVICE |
| + | # |
| + | cd /opt/$SERVICE |
| + | npm remove $SERVICE |
| + | cd /opt |
| + | 'rm' -rf /opt/$SERVICE </nowiki> |
| | | |
| ==Notes on check_earlytalker== | | ==Notes on check_earlytalker== |