/predix-cloudfoundary-go-postges

Sample web app in Go pushed to Predix Cloud reading data from PostgresDB on Predix.

Primary LanguageGo

Predix-Go-Sample-App

Sample web app in Go pushed to Predix Cloud reading data from PostgresDB on Predix.

Prerequisistes

  • Predix.io account
  • PostgreSQL instance on Predix

On your local machine:

  • CF CLI
  • Git
  • Go (v.1.9.x)
  • GoVendor: install it with go get -u github.com/kardianos/govendor

Get the app, configure and push to Predix

  1. Clone the repos:
$ go get -u https://github.com/indaco/predix-go-sample-app
  1. Move to the app folder:
$ cd $GOPATH/src/github.com/indaco/predix-go-sample-app
  1. Sync dependencies:
$ $GOPATH/bin/govendor sync
  1. Edit config.json and update it with Predix Postgres credentials
  2. Use the sample db.sql file to create a dummy table with some entries on PostgreSQL or adapt the main.go code to reflect the data table on PostgreSQL
  3. Edit manifest.yml file and update the application name
  4. Push the app to Predix Cloud:
$ cf push