top of page

How To: Deploy Application to Cloudbees

Cloudbees is a SaaS platform that let you handle one of many best practices of software development known as CI. Wait a minute do not you know about SaaS or CI or both. Let me tell you about them a bit first.

SaaS is a software distribution model in which application is hosted by some vendor or application provider and made available to customers over a network, typically the internet. In other words we can say that SaaS is a software delivery method that provides access to software and its functions remotely as a Web-based service.

CI means Continuous Integration is one of many best practices of software development that are rarely followed. It is 1) Keeping code in a central repo and available to all the concern persons 2) Having a single command to build the code 3) Having a single command to execute all the test cases. CI is like “do me now or do me more later” kind of activity. Bigger the change and bigger is issue to merge it to central repository.

Cloudbees gives you an easy way to this process. You don't have to do any hard work in setting up continuous integration in your project, and its easy to keep it up.

Now you must be thinking how to do it. That's we are here; right? In next lines we will be running our project on cloudbees. First you have to make an account on cloudbees by signing up to (it is very easy and you will not have any difficulty doing it) or login to your existing account and follow the steps given below and let the magic begin.


Before you go further remember that we are using

  • Maven as a build tool.

  • Git as source code management system

  • Project is JVM Web Application (WAR)

Pushing code:

First of all we have to push our code to cloudbees. Follow below steps to accomplish it.

  • Click on repositories among the other buttons given above (if it's your first time, it will take you to services page and will ask for your plan. Click Sign up under Free plan to select the free plan. This will redirect to main page again).

  • Now click on repositories again, that will take you to new page.

  • Click on Create new code repository and provide some Name for repository, select permission level of your repository and enter some description. Set Repository Type to Git and click OK.

  • Click on Committing an existing project to git, It will expand and give you some instructions on how to push existing code to your repository. Copy down those instructions for now.

  • Click on account settings-> Security Keys. A new page will open that will ask for Public Key. Open terminal and generate SSH key using below instructions and copy that key to Public Key Box, Give it a name and click add.

[sourcecode language="xml"] $ ssh-keygen -t rsa -C "provide-your-cloudbees-email-id"[/sourcecode]

Enter file in which to save the key (/home/aurora/.ssh/id_rsa): /home/aurora/.ssh/cloudbees

Enter passphrase (empty for no passphrase):

Enter same passphrase again:

You will get Key generated message

Below command will print the public key in the screen

[sourcecode language="xml"]$ cat /home/aurora/.ssh/[/sourcecode]

Now test connectivty with CloudBees Git:

[sourcecode language="xml"]$ ssh[/sourcecode]

you will get any of the below messages(both signifies success)

PTY allocation request failed on channel 0

You have successfully authenticated as <username> - however CloudBees does not provide shell access

Connection to closed.


PTY allocation request failed on channel 0

CloudBees Forge: Need SSH_ORIGINAL_COMMAND in environment.

Connection to closed.

  • You remember those commands that you copied before registering the key. Good! Now you have to follow those commands and push your cod to cloudbees. But hang on a minute. Do you have any database? Yes! Okay. Don't push the code yet if you have a database in your project and follow below lines, if you do not have a database push the code and relax for a while.

Creating Database:

So mate you have a database in your project, do not worry we are going to sort it out.

  • Click on DBs button near repositories and it will ask you for plan if its your first time. You would definitely like to go for a free plan unless you do not like free things. I like them though ;). Now click again on DBs.

  • Click Create Database, provide database name, username and password and click Finish, and database will be created. Click View database.

  • All the details like server, port, database name, user name and password are given here. Copy them and use them in appropriate places. Like replace database server name, database name, port, user name and password with these new ones.

  • Now you can push your code. Wait a minute, you have pushed your code in excitement before and read later that you have to follow these steps before pushing the code if you have a databae. Do not worry. Just commit and push the code again and you will be good to go.

Creating Application:

Now we have to create an application to which our application will be deployed to. Do you need to see your application running? I bet you do.

  • Click on Apps, this button is also in the same row as other two, (Select free plan if you are using it first time and then click again on Apps ).

  • Click Create Application, provide name for application and click Finish. You will get a URL at which this application is running.

  • Click configure and copy the id given there and save it some place safe. By safe I mean where you could find it when needed.

Now Stage is set for application. Every piece is ready. We just have to put those pieces at their proper place to make the application running.

Creating a Build:

  • Click Build (You should have been master to find buttons by now, aren't you?).

  • Click New Job. Give job some name, select Build a maven 2/3 project and click Ok. A scary page will show up asking for a lot of things. Take up your sleeves. We are going to beat it.

  • Under Source Code Management click Git and paste your project's git URL here. Wait a minute, please tell me you copied that url. No! Okay take it easy. Right click on your repositories button and open it in new tab (You do not want your page to hide somewhere, do you?). Select your repository, copy authenticated access URL and paste it in the URL field. And in Branches to build enter master.

  • Click on Add pre build step -> Invoke top level maven target, select a maven version and enter goal clean.

  • Under Build, Root Pom is pom.xml and Goals and options are install.

  • Now in click Add post-build actions -> Deploy artifact to my private cloudbees repository and select repository Snapshot

  • Now again click Add post-build actions -> Deploy to cloudbees, select credentials as jenkins and account as <youraccount>,

  • Now we have to specify where to deploy this application. Click Add Applications -> Maven artifact id selection - and provide Application ID : <name of application that we made at start>,atifactid:see from pom.xml ,groupid:see from pom.xml

  • Click apply and save. Click Build Now to build the project and deploy. On left below corner you will see an icon blinking telling that project is now built. Hover your mouse over it and click Console output. You will be able to see whole build process and at the end it will provide you with URL to access your application.

Looking forward to have your comments. Please let me know if you face any issue and I will provide assistance...

29 views0 comments


bottom of page