Site for hackersandpainters.sg
CSS Go JavaScript
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
ansible
conf
db
event
static
templates
user
.gitignore
LICENSE
README.md
config.json.example
main.go
main_test.go

README.md

Site for hackersandpainters.sg

Build Status

Getting started: Dev environment

You will also need to install mongodb. This project uses the mgo library to persist data.

# Prepare directory and source code
mkdir -p $HOME/go/{src,bin,pkg}
cd $HOME/go/src
git clone git@github.com:hackerspainters/hp.git

# Set environment variables
export GOPATH=$HOME/go
export PATH=$GOPATH/bin:$PATH
export PROJ_PATH=$HOME/go/src/hp

# Get dependencies, build and run tests
cd $PROJ_PATH
go get ./...
go build ./...
go test ./...

# Run the project
go run main.go

# Then, browse to http://localhost:3000

Contributions and Deployment

Contributions are more than welcome and pull requests should be made to the develop branch. Contributors should write unit tests.

Deployment is completely automated in a continuous deployment set-up with drone.io on master branch.

Example deployment script

#! /usr/bin/bash
export HOME=/home/web
export GOPATH=$HOME/go
export PATH=$GOPATH/bin:$PATH
echo $GOPATH
echo $PATH
mkdir -p $GOPATH/{src,bin,pkg}

export PROJ_PATH=$GOPATH/src/hp
rm -rf $PROJ_PATH
cp -rf $HOME/hackerspainters $PROJ_PATH

echo "Delete existing config.json"
rm $PROJ_PATH/config.json
echo "Use production server's config.json"
cp $HOME/config.json $PROJ_PATH/

cd $PROJ_PATH
pwd

go get ./...
go install ./...

echo "Installation completed. Restarting service..."
sudo systemctl restart hp

echo "Clean up deployment directory"
rm -rf $HOME/hackerspainters/*