Skip to content
dphiffer edited this page Sep 13, 2010 · 48 revisions

Java

Make sure that you are running Java 1.6 for OS X. You can select this by going to Applications/Utilities/Java Preferences (Java SE 6 is the same as 1.6). You can also use java -version at the command line.

Installing Git

If you are working with official Developer Alpha releases you can ignore all instructions about Git.

We recommend that you install the latest version of Git from here. If you are running on 10.4 we recommend you install the git-core package using Porticus.

Configuring your path

Once you’ve installed git you’ll probably need to update your PATH variable so that you can use git from the command line. Open your .bash_profile, you can find it in your home directory. You’ll need a text editor (Coda, TextWrangler) that can see invisible files in order to do this. If you’re comfortable with the command line use emacs, nano, or vim to create/edit this file.

Add the following:

PATH=$PATH:/usr/local/git/bin
export PATH

Open a new terminal window and confirm that the git command responds when you type it in and press enter.

Getting ShiftSpace

If you are working with official Developer Alpha releases you can ignore all instructions about Git.

Clone the main shiftspace repository into your Sites folder on your machine by typing the following using Terminal.app:

cd ~/Sites
git clone git:/ShiftSpace/shiftspace.git

Then the run the following to pull in the various git submodules required by shiftspace:

cd shiftspace
git submodule init
git submodule update

Your clone is now ready to go.

Installing CouchDB

We recommend that you install CouchDB 1.0.1

Drop the CouchDBX application into your Applications folder. Double-click on the application to start up CouchDB. Once it’s started, point your browser at http://localhost:5984/_utils/ to make sure that nothing went horribly wrong.

Introducing Shifty

ShiftSpace comes with a helper script called Shifty that allows to run common tasks. Shifty is directly inspired by the friendly manage.py script in Django.

Python dependencies

Run the following at the terminal:

cd ~/Sites/shiftspace
sudo python shifty.py installdeps

This installs all of the Python libraries the ShiftSpace backend needs to run. You might notice there is couchdb-lucene .jar as well. We’ll get to that in a moment.

Initializing the database

Now we need to initialize the database. Make sure that CouchDBX is running. Type the following into your terminal:

cd ~/Sites/shiftspace
python shifty.py initdb

You should see some output as new documents are added to the databse.

You should point your web browser to http://localhost:5984/_utils/database.html?shiftspace%2Fmaster to see that the shiftspace database is there and in fact populated with design documents.

Configuring couchdb-lucene

Now that you have CouchDB up and running, you should configure couchdb-lucene. In order for Lucene to index CouchDB and provide full text search capabilities you’ll need to edit your CouchDB local.ini file.

Right click on the CouchDBX application in your Applications directory using the Finder and choose Show Package Contents. You’ll get a new window displaying the contents of the application. Drill down through Contents/Resources/couchdbx-core/couchdb/etc/couchdb/. Open up local.ini in your favorite text editor. Edit the contents of local.ini as specified below.

local.ini

At the top of the file change the timeout:

[couchdb]
os_process_timeout=60000 ; increase the timeout from 5 seconds.
;max_document_size = 4294967296 ; bytes

At the bottom of the file add the following:

[external]
fti=/usr/bin/python /Users/username/Sites/shiftspace/server/couchdb-lucene/tools/couchdb-external-hook.py

[httpd_db_handlers]
_fti = {couch_httpd_external, handle_external_req, <<"fti">>}

IMPORTANT You need to change the two lines that call into the couchdb-lucene jar so that the username portion of the path actually matches your own username. If CouchDBX is running shut it down and start it up again to verify there were no errors.

Wrapping up CouchDB configuration

You should stop CouchDB by pressing the stop button in the CouchDBX main window. At the terminal you should run the following:

cd ~/Sites/shiftspace
python shifty.py runlucene

Start up CouchDB again by pressing the start button in the CouchDBX main window. Point your browser at http://localhost:5984/shiftspace%2Fmaster/_fti/_design/lucene/users. You should see some json output like the following (it doesn’t matter if it doesn’t completely match).

{
    "current": true,
    "disk_size": 584,
    "doc_count": 2,
    "doc_del_count": 0,
    "fields": [
        "email",
        "userName"
    ],
    "last_modified": "1283629588000",
    "optimized": true,
    "ref_count": 2
}

Preparing to start the server

In order for the ShiftSpace script to build properly between page refreshes you must set the url where ShiftSpace will be running from.

cd ~/Sites/shiftspace
python shifty.py configure http://localhost:8080

Starting the server

You can now start the ShiftSpace server. Again make sure that the CouchDBX is running.

You’ll be prompted for you admin password.

Let’s start the actual ShiftSpace server. Type following into a new terminal:

cd ~/Sites/shiftspace
python shifty.py runserver

This starts up the server on port 8080. If you’d like to run on another port you need to do the following:

python shifty.py configure http://localhost:PORT_NUMBER
python shifty.py runserver PORT_NUMBER

You should see some output that CherryPy is starting up. In your browser goto http://localhost:8080/. Don’t forget the trailing slash. You should see a greeting.

Now to really verify that things are working point your browser to to http://localhost:8080/sandbox/. Don’t miss the trailing slash (we’ll fix this later). You should be able to open the ShiftSpace Console by typing the shift key plus the space key together. You should see a Login tab. In the login tab there is a Join subtab. Select this. Enter your information and click submit (sorry the enter key doesn’t work yet).

You should now be logged in. Open up the Spaces menu in the lower left. Click on the Notes Space button. You should see an empty note fade onto the page. Type some text and click the save button. You should see your new shift appear in the Console.

Congratulations! You’ve successfully installed ShiftSpace 1.0. Please refer to the developer manual if you’d like to know more about developing spaces.

Recap

Whenever you want to hack on ShiftSpace, first start up CouchDB by launching CouchDBX.

Then type the following at a new terminal:

cd ~/Sites/shiftspace
python shifty.py runserver

You can then point your browser to http://localhost:8080/sandbox/, and that’s all there is to it.

GreaseMonkey

If you have GreaseMonkey (and especially if you have a older version of ShiftSpace running) make sure to use the GreaseMonkey Manage User Scripts Window (you can get to it by right-clicking on the GreaseMonkey icon in the lower right corner of your browser) to exclude whatever domain ShiftSpace is running on – i.e. http://localhost:8080/* if you followed this tutorial.