Laptop Server

Federation makes even tiny wiki sites valuable. To feel this value, make some sites. Experiment. Keep the ones you like. Here I reflect on three years of doing this myself.

Install

We've made many different versions of wiki but the easiest to install and the most frequently improved is the node.js version. Look to the internet for advice installing node and the npm package manager that comes with it.

From a command line (in Terminal on my computer) install wiki. Use the -g option which says this is the install that you will use except where you might have installed another.

npm install -g wiki

The npm program prints lots of information useful for developing new versions of wiki. You can ignore it. We're developing new versions every week or so. If you want the newest, just install it again.

npm install -g wiki

There are other ways to update but this way gets the latest version of wiki and all of its parts like plugins.

Launch

Start the wiki server from the command line. We'll show you several versions. First the easy one to understand.

wiki

This should print some more developer info that you can also ignore. If you get the message EADDRINUSE it means you already have wiki (or some other server) running. This is ok but you will have to suggest an unused port number for this one.

wiki -p 3030

By default we use port 3000 but there is nothing special about this number except that it is big enough to not interfere with other network things.

Experiment

See if you have a wiki. Direct your browser to location "localhost:3000". You should see wiki there. The name "localhost" is shorthand for your own computer.

You should see the default welcome page that includes some instructions for making new pages. Try making pages. Type anything. We'll erase this soon and have better suggestions.

Look to see where wiki has saved your pages. On my computer it is in my home directory in a folder with the normally hidden name ".wiki". From the command line I can go look for the files wiki creates there.

cd .wiki ls -l cd pages ls -l cat welcome-visitors

Try removing the typing you did a minute ago by deleting the welcome-visitors file.

rm welcome-visitors

When you refresh your browser window you will see the original welcome page has returned. Wiki keeps a couple of pages in reserve to help you get started. If you don't like what you make of them. Just delete the files in .wiki and start over.

There is much power in making and removing these files. If you are a programmer, you can write files in .wiki yourself and cause new pages to appear. See JSON Schema to understand the format.

Networking

Your laptop will have an address that you can use to access your wiki from other computers. When I use my laptop at home my home router assigns an address that will work from any computer at home. At work I get a different address that only works from computers at work.

I just looked and saw that my laptop has been assigned the address 10.0.1.26. I can go to any computer in the house and visit my wiki by typing that address in place of localhost for the location of my server. 10.0.1.26:3000.

I found my laptop's assigned number using the network interface configuration program, ifconfig.

ifconfig

It blurts out details that I've edited slightly for space. You will see my address near the bottom, labeled inet.

lo0: flags=8049<UP,LOOPBACK,RUNNING> mtu 16384 inet 127.0.0.1 netmask 0xff000000 inet6 ::1 prefixlen 128 inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1 gif0: flags=8010<POINTOPOINT,MULTICAST> mtu 1280 stf0: flags=0<> mtu 1280 en0: flags=8863<UP,RUNNING,SIMPLEX> mtu 1500 ether 10:93:e9:08:0e:a2 inet6 fe80::1293:e9ff:fe08:ea2%en0 scopeid 0x4 inet 10.0.1.26 netmask 0xffffff00 media: autoselect status: active

My assigned address also shows up in my laptop's System Preferences dialogs under Network.

The System Preferences dialog for Network shows my laptop's assigned address.

Everyone who has ever built a networking product has tried to make this simpler. The result is byzantine complexity. For this I apologize in advance.

My laptop supports "zero configuration networking" which simplifies addressing for laptops sharing a local area network. If I name my computer "ward" then my wiki will be known at my house as "ward.local:3000". This is handy if you have it. wikipedia

I can make my laptop visible to the world by adjusting my firewall router to port-forward requests that it sees to my laptop. I say, in essence, requests to the router at port 3000 are to go to ward.local:3000. wikipedia

My router has its own address assigned to it by my internet service provider, comcast. It is the address that every other website in the world knows me as when I visit them from home. If I search google for "what is my ip address" they are kind enough to tell me my router's address. When you port forward through your router, your router is you to the world. google

Farming

A browser sends to a server the address/name that it intends to browse. We can ask the wiki server to keep a separate wiki for each address it sees. When one server serves many wikis we call it a wiki farm.

Launch the wiki server with the -f option for a wiki farm.

wiki -f -p 3060

Now if you browse localhost:3060 you will be looking at one wiki and when you browse 10.0.1.36:3060 you will be looking at another. The address ward.local:3060 is still another. When you port-forward in from the world, still another. Imagine rows an rows of little wikis sprouting up. This is farming.

All of these wiki pages are stored in subfolders of the same .wiki directory. Look for them.

When you run your own server you can move pages around the way you would move any other file. The file names are slugs, a simplified versions of the page title stored in the json. You can rename pages by revising both.

Now is a good time to think about what you'd like to write. See First Write Who & What for how I start each new wiki.

Example

I recently relaunched xpdx.org, a domain name I held even after the local community chose to call itself agilepdx.org.

I built this site by making a farm site on an old mac that I leave on at home. I port-forward port 80 to this machine. I called the site some weird name while I assembled the content for launch.

To launch I went to my domain name registrar, name.com, and revised xpdx.org to point to my home router. I then renamed the subdirectory in .wiki to be xpdx.org. Done.

I announced xpdx.org as a gift where I would assemble pages from my other wikis that I think they would like. My server is providing this service to my community. Its that simple. post