AusDTO / nudger

Nudger is a New Relic metrics importer for StatusPage.
MIT License
3 stars 3 forks source link

cloud foundry + circleci integration #5

Open m-richo opened 8 years ago

m-richo commented 8 years ago

Shall we add a manifest.yml and circle.yml to the repo to allow automated deployments using ausDTO tooling?

auxesis commented 8 years ago

@m-richo what buildpack are you using to launch the app on PWS?

The simplest way to make this work is to build a binary on CircleCI, and launch it with the binary buildpack.

m-richo commented 8 years ago

I could build and run it locally just fine. 👍

I tried out the golang buildpack, but it struggled to find dependencies (see below). I managed to get it deployed only once i'd renamed the _vendor dir to vendor and removed the src dir layer. vendor/src/gopkg.in/alecthomas/ -> vendor/gopkg.in/alecthomas/. I don't know vendoring of golang dependencies well enough to understand how it should be done.

I think your suggestion of using the binary buildpack makes more sense. I'll wrap the nudge.json config file as a build environment variable and try that out.

Starting app nudger in org DTO / space staging as x@y.z.au...
Creating container
Successfully created container
Downloading app package...
Downloaded app package (38.1K)
Staging...
-------> Buildpack version 1.7.12
https://buildpacks.cloudfoundry.org/concourse-binaries/godep/godep-v74-linux-x64.tgz
https://buildpacks.cloudfoundry.org/concourse-binaries/glide/glide-v0.11.1-linux-x64.tgz
-----> Installing go1.6.3... done
Downloaded [https://buildpacks.cloudfoundry.org/concourse-binaries/go/go1.6.3.linux-amd64.tar.gz]
 !!    Installing package '.' (default)
nudger.go:6:2: cannot find package "gopkg.in/alecthomas/kingpin.v1" in any of:
    /tmp/app/.heroku/go/src/github.com/AusDTO/nudger/vendor/gopkg.in/alecthomas/kingpin.v1 (vendor tree)
    /tmp/cache/go1.6.3/go/src/gopkg.in/alecthomas/kingpin.v1 (from $GOROOT)
    /tmp/app/.heroku/go/src/gopkg.in/alecthomas/kingpin.v1 (from $GOPATH)
Failed to compile droplet
Exit status 223
Staging failed: Exited with status 223
Destroying container
-----> Running: go install -v -tags cloudfoundry .
Successfully destroyed container

FAILED
BuildpackCompileFailed

TIP: use 'cf logs nudger --recent' for more information
auxesis commented 8 years ago

OK nice, I'm just hooking up the circle.yml bits now.

auxesis commented 8 years ago

Per #7 we're have a circle.yml that's testing the project in a fully self contained way on Circle (no pulling of deps with go get).

Per #8, we're building and storing the artifact, for later use.

I believe the steps required now are:

auxesis commented 8 years ago

This might be a decent way of storing the config.

aussielunix commented 8 years ago

I had some thoughts on this but need to understand what the solution is for handling config in a cloud native way.

If your app has no config file and expects config from environment variables then how do you manage these variables across CI, staging and production and amongst the team ?

Example manifest for deploying to cloud.gov.au. This expects you have copied the config file to bin/ alongside the binary.

---

applications:
- name: nudger
  memory: 32M
  disk_quota: 64M
  health-check-type: none
  buildpack: binary_buildpack
  path: bin/
  command: /home/vcap/app/nudger --config="/home/vcap/app/nudger.json"
  no-route: true
auxesis commented 8 years ago

I can think of a couple of ways to do this: