Running Federated Wiki locally as Windows Service

Smallest Federated Wiki is the brainchild of Ward Cunningham - the “Father of Wiki”

Although the main feature is the ability to fork content from other wikis, and to allow other wiki users to fork your content, many people also want to run a local copy as a private notebook or commonplace book.

The most stable distribution of wiki is written in node, so will run anywhere that node will. It’s really useful to have wiki run continuously, so in this approach we use node-windows to install wiki as a windows service.

Preparation

  • install node and npm
  • npm install -g wiki
  • npm install -g node-windows

Test that wiki works

cd ~

wiki

Visit http://localhost:3000, you should see a wiki page.

FedWiki default start page
FedWiki default start page

Customise wiki setup

  • create config.json in ~/.wiki
{
  "security_type": "friends",
  "cookieSecret": "SECRET",
  "session_duration": 900,
}
  • optionally, customise data location
 "data": "d:/Dropbox/fedwiki/localhost/data"

Run wiki and claim

  • start wiki as above
  • in browser, click the padlock icon

A new file owner.json will be created in the status subdirectory of the wiki data directory.

Contents will look something like this:

{
  "name": "randomname",
  "friend": {
    "secret": "AVERYLONGKEY"
  }
}

If you ever get locked out then the value of AVERYLONGKEY is what you will need to paste in the popup that wiki shows you

You can edit the name to something else (like your own name)

Create windows service to run wiki automatically

  • create a directory for the scripts that will create a windows service
mkdir ~\wikisvc
  • copy wiki config file
cp ~/.wiki/config.json .
  • In the new directory create the following scripts:

wikiservice.js

var Service = require('node-windows').Service;

var svc = new Service ({
    name:'Wiki',
    description: 'FedWiki as windows service',
    script: 'C:/bin/Nodist/bin/node_modules/wiki/index.js',
}); 

svc.on('install', function(){
    svc.start();
});

svc.install();

wikiservice-uninstall.js

var Service = require('node-windows').Service;

var svc = new Service ({
    name:'Wiki',
    description: 'FedWiki as windows service',
    script: 'C:/bin/Nodist/bin/node_modules/wiki/index.js',
}); 

svc.on('uninstall', function(){
    console.log('uninstalled');
});

svc.uninstall();
  • in the new directory run:
npm link node-windows
node wikiservice.js
  • open Windows Service Manager and check for the new service:
Windows Services Manager
Windows Services Manager
  • if it isn’t started, start it

  • visit the wiki page in a browser to confirm all works

Avatar
Proactive application of technology to business

My interests include technology, personal knowledge management, social change

Related

Next
Previous