ActiveShell Installation Instructions
Since my first post two weeks ago, ActiveShell has new ports and verbs, and some back-end code is more easily available on github and npm.
You can set up your own installation by following the instructions below.
ActiveShell requires an HTTP server configured to handle PUT requests.
For this I use revstore, which is a trivially simple revision control system with a REST interface.
Revstore runs on nhttpd which runs on node.
These instructions require Node.js version 0.6.7 or later, and assume:
- Node.js on Linux
- you will install and run nhttpd as root,
- npm installs modules in /usr/local/lib/node_modules/
- you will run the server on port 8080 and connect to it as "localhost" from the same machine.
Otherwise, you may need to edit configuration files, change permissions or owners on some directories, and adjust some commands.
All commands below (except rvs install) assume root privileges, so becoming root may be worthwhile (e.g. "sudo su -
").
Installation
First install nhttpd:
npm install -g nhttpd
The revstore server is included but must be enabled.
Create a directory for revstore to store your data:
mkdir -p /var/lib/revstore/revisions
touch /var/lib/revstore/revisions/manifest
We will copy the example branch configuration file, which serves a revision store at /code/ on your domain, backed by files in the directory we just created.
mkdir -p /etc/nhttpd/branches/
cp /usr/local/lib/node_modules/nhttpd/etc/branches/revstore /etc/nhttpd/branches/
Now run nhttpd (on port 8080 by default):
nhttpd-start
To stop nhttpd later use nhttpd-stop
.
If it crashes you'll need to delete the corresponding pid file in /var/run before running it again.
To see what is happening in the nhttp log file if anything goes wrong, try:
tail -f /var/log/nhttpd/*
Now with nhttpd running, http://localhost:8080/code/ should be a completely blank page.
This blank page is a list of all the files currently in the revstore.
Now let's fix that:
npm install -g revstore-client
rvs install http://boshi.inimino.org/3box-asof/1328440000000/shell/ http://localhost:8080/code/shell/
(The trailing slashes on both URLs are required.)
The output is a list of filenames followed by a list of timestamps as rvs copies a snapshot (as of Unix time 1328440000.000) of the ActiveShell files from my revstore to yours.
If you reload the formerly blank page at http://localhost:8080/code/, you should see a shell/ directory.
In that directory will be a file prototype.html, click this and you are up and running!
To start, you might try typing in the following commands (in this order, and without having run any other commands first):
load "misc"
split 1 " "
last 2
split 3 ","
head 4
split 5 ""
take "3" 6
join 7 ""
With that, you now know the basic grammar of ActiveShell commands, and the way references are used to carry values between commands.
If you can, guess what the next command will output:
each 8 5 4
You can refresh the page or close and re-open it and the session will remain.
To start a fresh session simply go back to prototype.html and click "(new)" again.
ActiveShell, revstore, and nhttpd are all run-at-your-own-risk, discretion-advised, please-back-up-your-data, pre-alpha software.
Revstore is intended to preserve all history, but there are known and unknown crashing bugs and data-loss bugs, so be careful and don't rely on anything you create being preserved.
Note that the revstore served under /code/ is fully pemissive by default, so you or anyone can PUT or GET data to and from the revstore from any host using curl, etc.
The bare shell installation doesn't do much, but you should be able to follow the steps in the previous post and do some similar simple things with local data.
You can copy and paste raw text into the shell by using paste
; run it with no arguments and a box will appear.
To use SSH, AWS, git, or most other new ports, you will need to configure nhttpd to serve a gateway that allows the shell to communicate with these other services, and you'll probably need to configure SSL/TLS.
These setup steps may be covered by a future blog post or project documentation.
You can open a port to the revision store resource tree itself, which doesn't require any gateway, by, e.g.:
openrvs "/code/"
load "rvs"
A ls
A cd "shell/"
Look in "shell/verbs/" to see the verb sets that are installed, and use the load
command to use them in a shell session.
If you break the shell itself, you can run the rvs install
command above again to restore it.
For further updates, follow me on twitter or github.
Bug reports welcome by email, IRC, or github.