Skip to content
Calvin Cheng edited this page Oct 28, 2013 · 8 revisions

Grab source

cd $GOPATH/src
git clone git@github.com:hackerspainters/hp.git

Run app

Getting the app running on your local machine is straightforward. You can find out how to deal with dependencies in the project in the section below named "Dependencies".

1. Set project root

Edit your user's .bash_profile to include export PROJ_CONFIG_PATH=$GOPATH/src/hp.

2. Change directory to the project root directory

cd $GOPATH/src/hp

3. Create project config

Create a config.json file as shown in the example configuration below

4. Install all dependencies

go install hp

5. Build and run

go build
./hp

Now, we should be able to load http://localhost:5050/ in our browser

Dependencies

The first time we run go build (per the steps given below), we may be notified that we are missing certain dependencies. Simply run:

go install hp

to download and install all dependencies. It's the equivalent of python's pip install -r requirements.txt.

The app uses mongodb as a persistent data storage backend. So you will also need to install and run mongodb as well. Use your favorite package manager for this as required of course.

Example configuration

An example app configuration file is included in the source code, named as config.json.example in the project root directory. As mentioned in the "Running the app" section above, you will need to create a config.json of your own before you can run it as ./hp.

{
    "DbName": "hp_db",
    "SessionSecret": "(long random string here)",
    "WebPort": 5050,
    "TemplatePreCompile": true,
    "TemplatePaths": ["./templates"],
    "Debug": false,
    "GoogleAnalyticsTrackingID": "UA-(your GA id)",
    "Streams": [{
            "type": "twitter",
            "user_id": "(your twitter user_id)"
        }, {
            "type": "github",
            "username": "calvinchengx",
            "token": "(your github user token)"
        }
    ],

    "Gallery": {
        "Type": "picasa",
        "UserID": "(your picasa user id)"
    }
}