Dev kumar
Dev kumar

Reputation: 7

Binding database to app in cloudbees when deploying via jenkins

I have now managed to deploy a web app on run@cloud. I do have the cloudbees deployer plugin on jenkins, however, i am looking for a way to use the bees sdk to bind a database to the deployed app. I was wondering how do i go about it.

Currently, I deploy it via jenkins as a postbuild action.

Upvotes: 0

Views: 212

Answers (1)

Mark Prichard
Mark Prichard

Reputation: 91

You can configure the Bees SDK in DEV@cloud with a script like this (assuming that you have uploaded a build secret zip file containing your ~/.bees/bees.config using the environment variable ${SECRET} - please see Build Secret Plugin

Run this as an "Execute Shell" task within Jenkins, and then you can use the Bees SDK in the normal way to bind the database (or any resource) to your app, e.g. bees app:bind -a acme/test -db mydb

See the Database Guide for more details.

Jenkins Execute Shell Script:

if [[ ! -d "${WORKSPACE}/bees-sdks" ]] then mkdir ${WORKSPACE}/bees-sdks fi

cd ${WORKSPACE}/bees-sdks; curl -o cloudbees-sdk-1.5.0-bin.zip http://cloudbees-downloads.s3.amazonaws.com/sdk/cloudbees-sdk-1.5.0-bin.zip; unzip -o cloudbees-sdk-1.5.0-bin.zip rm cloudbees-sdk-1.5.0-bin.zip

PATH=${WORKSPACE}/bees-sdks/cloudbees-sdk-1.5.0:$PATH; export PATH

if [[ ! -d ~/.bees ]] then mkdir ~/.bees fi

cp ${SECRET}/bees.config ~/.bees/bees.config

I've done an online example here that illustrates how this all works. Sorry this is a little more complicated than we would like: we are working to make it smoother and I will update this answer shortly once the changes go live.

Upvotes: 1

Related Questions