This is a test project written in Clojure. Its purpose is to test deployment on CloudFoundry, either local (BOSH Lite) or public cloud (run.pivotal.io).
A guide about installing BOSH Lite is available here. A more detailed guide is available here.
$ cf api
API endpoint: https://api.run.pivotal.io (API version: 2.44.0)
$ cf api https://api.eu-gb.bluemix.net
$ cf login
$ cf create-service elephantsql turtle postgresql
$ cf bind-service Green postgresql
$ cf api --skip-ssl-validation api.bosh-lite.com
$ cf login
Email> admin
Password> admin
$ cf create-org ulsa-local
$ cf create-space development
$ cf target -o "ulsa-local" -s "development"
Push app to prod as Blue:
$ cf push Blue -b https://github.com/heroku/heroku-buildpack-clojure.git -n testing-cloudfoundry
Push new version to temp as Green:
$ cf push Green -b https://github.com/heroku/heroku-buildpack-clojure.git -n testing-cloudfoundry-temp
Test Green at:
Map Green to same route as Blue:
$ cf map-route Green cfapps.io -n testing-cloudfoundry
$ cf map-route Green bosh-lite.com -n testing-cloudfoundry
Unmap Blue from prod route:
$ cf unmap-route Blue cfapps.io -n testing-cloudfoundry
$ cf unmap-route Blue bosh-lite.com -n testing-cloudfoundry
Unmap Green from temp route:
$ cf unmap-route Green cfapps.io -n testing-cloudfoundry-temp
$ cf unmap-route Green bosh-lite.com -n testing-cloudfoundry-temp
Delete orphaned routes:
$ cf routes
space host domain apps
development testing-cloudfoundry bosh-lite.com Green
development testing-cloudfoundry-temp bosh-lite.com
$ cf delete-orphaned-routes -f
$ cf routes
space host domain apps
development testing-cloudfoundry bosh-lite.com Green
Install spruce (replacement for spiff).
Run a Cloud Foundry service broker for PostgreSQL:
$ bosh upload release https://bosh.io/d/github.com/cf-platform-eng/docker-boshrelease
$ bosh upload release https://bosh.io/d/github.com/cloudfoundry-community/postgresql-docker-boshrelease
$ cd ~/Source/Git/cloudfoundry-community
$ git clone https://github.com/cloudfoundry-community/postgresql-docker-boshrelease.git
$ cd postgresql-docker-boshrelease
$ templates/make_manifest warden broker embedded
$ bosh -n deploy
$ bosh vms postgresql-docker-warden-broker-embedded
+------------------------+---------+---------------+-------------+
| Job/index | State | Resource Pool | IPs |
+------------------------+---------+---------------+-------------+
| postgresql_docker_z1/0 | running | small_z1 | 10.244.20.6 |
+------------------------+---------+---------------+-------------+
$ cf create-service-broker postgresql-docker containers containers http://10.244.20.6
$ cf enable-service-access postgresql94
$ cf marketplace
service plans description
postgresql94 free postgresql 9.4 service for application development and testing
$ cd ~/Source/Git/testing-cloudfoundry-clojure
$ cf create-service postgresql94 free postgresql
$ cf bind-service Blue postgresql
$ cf restage Blue
Before I settled on postgresql-docker-boshrelease
, I tried to deploy community
services. However, the deploy didn't work; something about gateways failing. Here
are the instructions anyway:
$ cd ~/Source/Git/cloudfoundry-community
$ git clone https://github.com/cloudfoundry-community/cf-services-contrib-release.git
$ cd cf-services-contrib-release
$ templates/make_manifest warden
$ bosh -n deploy
$ cf create-service-auth-token postgresql core c1oudc0w
You will need Leiningen 2.0.0 or above installed.
Start a database server:
postgres -D /usr/local/var/postgres
Start the web server:
lein ring server
Copyright © 2015-2016 Ulrik Sandberg