Skip to content

Development Workflow

Shivam Kumar Jha edited this page Nov 2, 2018 · 3 revisions

Local Setup

Requirements

  • Install Go 1.10 and above
  • Install Git
  • Install PostgreSQL

Installation

go get -u github.com/kshitij10496/hercules

Setup Local Database

  • Make sure you have postgresql installed in order to use the cli comands createdb and pg_restore

  • We can run postgresql locally but lets use a docker version instead: (We're creating a container with the latest version of postgres, exposing the default port 5432, with the default user postgres and password postgres)

docker run --name postgres -e POSTGRES_PASSWORD=postgres -p 5432:5432 -d postgres
  • Create the database
createdb herculesdb
  • Restore the backup located in the project root (hercules_backup_XXXXXXXX.dump)
pg_restore --verbose --clean --no-acl --no-owner -h localhost -U postgres -d hercules_testdb ./hercules_backup_20181020.dump

Run hercules locally

  • Download the dependencies (Run this command in the project root)
dep ensure
  • Expose the Database connection settings in your terminal
export HERCULES_DATABASE="user=postgres password=postgres dbname=herculesdb sslmode=disable"
  • Run the project and have fun
go run server.go

Testing

  • Test the entire app:
go test -v ./...
  • Test a particular service:
go test -v services/<name>
Clone this wiki locally