Bamboo Rails CI howto?
Asked by Kevin Ross:

Using Bamboo 5 rc1. Setting up 100% fresh. I've added rake-bamboo-plugin

Regarding plan configuration, setup, stages, tasks, cucumber, through to the deployment project capability:

Is there a howto? Best practices? Anything current? Everything I find is pretty old or lacking in one way or the other. Certainly I can configure Bamboo to execute the necessary steps, but I was hoping for a little enlightenment and best practices.

Any pointers or a new wiki page from Atlassian would be appreciated. I already upvoted the request for documentation issue.


Answers:
author: Kevin Ross
body: I had enough trials and tribulations that I ended up forking and creating the bamboozled-ruby-plugin.

a) [](https://marketplace.atlassian.com/plugins/com.alienfast.bamboozled.ruby.bamboozled-ruby-plugin)<https://marketplace.atlassian.com/plugins/com.alienfast.bamboozled.ruby.bamboozled-ruby-plugin>

and

b) elastic beanstalk gem: [](https://github.com/alienfast/elastic-beanstalk)<https://github.com/alienfast/elastic-beanstalk>

The elastic beanstalk has an eb:package command for creating artifacts that the bamboozled-ruby-plugin can use for deployment. If you are deploying elsewhere, you could look at using the capistrano task etc.


author: Ken Wong
body: Hi guys,

I'm currently setting up a Rails build and here is what I've done so far.

Note - I'm on Bamboo 5.5.1 and my Git repo is not publically accessible so I end up packaging up my RoR project as a .deb and sending to my servers.

**Details**:

- Setup a regular project with 5 tasks (all running in the Default Stage/Default Job)

a) Source code checkout (I'm also using the Plan branch feature so I can build branches as well)

b) Script task - cleanup of old .deb packages

c) Script task - generate a build.html file with Bamboo build #, Git branch, etc.

d) Script task - copy in any RoR "secrets" Yaml files (eg. custom files with API keys, etc).

e) Script task - package up RoR "build" as a Debian package using the FPM gem. It actually executes a shell script that I used to wrap FPM.

In this job, I'm also defining the .deb package as an "Artifact definition" to be shared later with the Deployment Project.

**Deployment Project**:

Defined a staging and QA environment each with the same set of tasks

a) Artifact download - this is using the .deb package I created in the build plan

b) SCP Task - sends .deb package to remote server

c) SSH Task - Here I'm just running a bunch of commands to unpack the .deb file, change ownership, and then run "bundle install, bundle exec rake db:migrate, bower install, and finally, restart nginx"

The one thing that I found is annoying is that there isn't an option to set a bunch of servers and then choose them from a list (like Jenkins).

In the deployment project, you need to re-specify the servers and their keys for every SCP task. So, if I were to send to 3 separate servers, I have to manually re-key in the same task (with a hostname change) each time. There isn't even an option to copy a task. If you manage more than a handful of servers, it will get tedious real fast. It makes more sense to allow you to list all of your servers \& keys, and then create some sort of group so that the deployment project can SCP/SSH to them in parallel.

I don't think this is the best way of doing this, but it at least works. NOTE that I never used the rake-bamboo plugin.

comments: author: amargautam
body: Hi Ken,

I almost have a same approach but I have been failing. The ssh task is great to run commands on a remote server but when I do bundle or rake, it just says command not found.

After further fix it says - /usr/bin/env: ruby_executable_hooks: No such file or directory

Any idea what is wrong?


author: Alex Soto
body: I'm in process of getting this going in the OnDemand version. It's even more restrictive since we can't use any ruby plugins.

I've ended up customizing an ec2 image to have rvm and various rubies installed. Next steps are to get deployment plans going.

Since ruby apps are typically deployed from source, there aren't any binary artifacts like a java build project will typically have. Best I can come up with is have the build process write a file containing the revision that was just built, and mark that file as an artifact. Then have the deployment plan copy that and have my deployment scripts read that revision as the one to deploy.


author: Kevin Ross
body: I just posted this, then I immediately ran into: <http://blogs.atlassian.com/2012/06/building-ruby-projects-with-bundler-and-the-bamboo-ruby-plugin/>

comments: author: Kevin Ross
body: So this link was a start, but not much mare than a walkthrough of the rake-bamboo-plugin. I'm still hoping for a best practices type of resource.


Tags: bamboo-administration

bitbucket-cloud

cloud