/calm-cicd-demo

CI/CD demo app

Primary LanguageGo

Installation

  1. Install Go 1.5.x or greater, git, setup $GOPATH, and PATH=$PATH:$GOPATH/bin

  2. Run the server

    cd $GOPATH/src/github.com/ideadevice/calm-cicd-demo
    go run main.go
    

Environment Variables for Configuration

  • HTTP_ADDR: The host and port. Default: ":8888"

  • HTTP_CERT_FILE: Path to cert file. Default: ""

  • HTTP_KEY_FILE: Path to key file. Default: ""

  • HTTP_DRAIN_INTERVAL: How long application will wait to drain old requests before restarting. Default: "1s"

  • COOKIE_SECRET: Cookie secret for session. Default: Auto generated.

Vendoring Dependencies

Vendoring is handled by a separate project: Glide.

Running in Vagrant

There are two potential gotchas you need to know when running in Vagrant:

  1. GOPATH is not defined when you ssh into Vagrant. To fix the problem, do export GOPATH=/go immediately after ssh.

  2. PostgreSQL is not installed inside Vagrant. You must connect to your host PostgreSQL. Here's an example on how to run your application inside vagrant while connecting to your host PostgreSQL:

GOPATH=/go DSN=postgres://$(whoami)@$(netstat -rn | grep "^0.0.0.0 " | cut -d " " -f10):5432/$PROJECT_NAME?sslmode=disable go run main.go