Accelerate Java Apps with CloudBees

Share this article

CloudBees platform: An Introduction

The world of Java development has changed drastically with Maven and Jenkins/Hudson. Maven has changed the way applications are built and dependencies are managed. While Jenkins has become a tool of choice for continuous integration (CI) and continuous delivery (CD). Exploring these topics in detail is not on agenda today, we will take a look at cloud platform where Java/JVM based developer would be very happy to find all he needs: Welcome to CloudBees. CloudBees provides you services from storing your code in cloud to building and deploying the code in cloud. Without changing the way you work, you can get your application up and running as soon as it is ready! Without further ado, let’s do some hands on!

Prerequisites and Scope

In this tutorial, we are going to use Maven and Jenkins for build and continuous integration respectively . Knowledge of these concepts and tools will help you play along with the tutorial well. Learn more on Jenkins here and more on Maven here For brevity of this tutorial, we will deploy our application directly to cloud and skip the local deployment part. Also to keep the application simple, we will not configure a database with application and use only in-memory database.

Setup CloudBees and Code Repository

Create CloudBees Account and setup code repository, go to Services –> Repositories and “Create a new code repository”.  I chose Git and named it CloudBeesClinic, but you can choose SVN too as your code repository. For purpose of this tutorial I am going to stick with Git.

You will also need a git client before we can push code to our repository.  I use GitHub command line client. Once you have setup the git client, generate SSH keys for communication with the code repository. If you are on windows, use git client you just installed and for Linux/Unix based systems directly run following command:
ssh-keygen
Once keys are generated, copy the public key from id_rsa.pub (That’s default file, if you chose defaults while generating the SSK key) and go to CloudBees Account –> SSH Keys. Add the public key from your machine to CloudBees. For more information on how to install Git client check here and to generate SSH keys check here

Bootstrap the project

We will create a project using a RAD tool: Spring Roo and you can get more details on project creation in this article
‘s first section. You should see src directory and other files like pom.xml. Let’s go ahead and push this code to our git repository on CloudBees.
git init // Initializing the Git repo locally
git remote add origin ssh://git@git.cloudbees.com/<strong><em>YOUR_CLOUDBEES_ID</em></strong>/CloudBeesClinic.git
//(Abve URL is “Authenticated access” field when you created repository in cloudbees)
git add -A  // Adding all files and subdirectories to repository.
git commit -m 'Initial checkin' // Committing to local repository.
git push origin master // Pushing the committed changes to server repository.

Setting up project build and deployment

CloudBees provides Jenkins as a tool for continuous integration and delivery. While Jenkins is a very versatile tool and I can write a book over it, let’s start using it in context of our project to better understand it. Go to your cloudbees account –> Services –> Jenkins and create a “New Job” and choose “Build a maven2/3 project” and a suitable job name. I am going to leave most of fields to default for now, and only configure what is needed. So here is our first bare minimum job, which will need following parameters Deploy now defaults – Checked: This will deploy our build as soon as it is successfully built. Source Code management: Provide the URL to the source code repository, in our case Git. This is same URL we provided earlier while committing the code. In Build triggers section, I am going to choose “Build periodically” and provide value “00 0-23 * * *” which is a syntax similar to one used in cron jobs. What it is going to do is fire a build 0th minute of every hour. In Post build actions select “Deploy to CloudBees” and provide an appropriate application ID and account you are using. After you have saved the project/job (Project as Jenkins calls it), do a “Build now” from left menu. Let’s see if our code gets built and can be deployed right away. While project is getting built, you will see a blinking blue signal on the job, and logs can be seen through “Console output”: Since we have chosen one click deploy, application will be deployed as seen at end of log: [cloudbees-deployer] 16 MB [cloudbees-deployer] 17 MB [cloudbees-deployer] Deployed to application id vishal-biyani/vishalbiyani-cbtest [cloudbees-deployer] Can be accessed at http://vishalbiyani-cbtest.vishal-biyani.cloudbees.net [cloudbees-deployer] Recorded deployment in fingerprint record Finished: SUCCESS
Hurray!! Application is live: a pet clinic to manage pets and doctors and appointments. It’s a tiny little application, but is good enough for testing basic stuff. Since the build is setup to run every hour, the trend of builds can be seen later. For example in below image, build #23 failed, but other builds have been healthy!

Exploring CloudBees

What we have covered in this tutorial is fairly simple, but we got an idea of how simple it is to deploy a Maven based Java project on CloudBees platform. What we have not covered of CloudBees platform is much more, following is a quick roundup of course not exhaustive:
  • Code quality tools like Sonar and other plugins for code coverage, test coverage can be installed within Jenkins, like any other Jenkins installation
  • Add relational databases like MySQL or non relational databases like MondoDB or CouchDB
  • Performance monitoring tools like NewRelic, Email Service like SendGrid etc and many more

Further reading on CI and CD

Continuous integration and delivery is a big topic, and a major differentiator between a good and not so good software project is how well CI and CD practices are set and followed. No discussion on CI and CD on this earth will be complete without following three IMHO:

Frequently Asked Questions (FAQs) about Accelerating Java Apps in Cloud with Cloudbees

What is Cloudbees and how does it help in accelerating Java apps in the cloud?

Cloudbees is a platform that provides end-to-end software delivery automation to accelerate the creation, deployment, and management of applications. It is particularly beneficial for Java applications as it offers a robust, cloud-based environment that supports the entire development lifecycle. Cloudbees integrates with popular tools like Jenkins, facilitating continuous integration and continuous delivery (CI/CD), which are crucial for rapid and reliable software releases.

How does Cloudbees integrate with Jenkins for Java app acceleration?

Jenkins is an open-source automation server that enables developers to build, test, and deploy their software. Cloudbees provides a Jenkins-based platform that enhances the capabilities of Jenkins, offering features like security, scalability, manageability, and expert support. This integration allows for seamless automation of Java app development processes, thereby accelerating the overall development cycle.

What are the key features of Cloudbees that make it suitable for Java app acceleration?

Cloudbees offers several features that make it ideal for accelerating Java apps. These include a cloud-native environment, support for CI/CD, integration with Jenkins, and a comprehensive suite of tools for software delivery automation. Additionally, Cloudbees provides robust security, scalability, and manageability, which are crucial for efficient and effective software development.

How does Cloudbees support continuous integration and continuous delivery (CI/CD)?

Cloudbees supports CI/CD by providing a platform that automates the entire software delivery process. It integrates with Jenkins, a popular tool for CI/CD, and enhances its capabilities. With Cloudbees, developers can automate the building, testing, and deployment of their software, thereby enabling rapid and reliable releases.

What are the benefits of using Cloudbees for Java app acceleration?

Using Cloudbees for Java app acceleration offers several benefits. It provides a robust, cloud-based environment that supports the entire development lifecycle. It integrates with Jenkins, facilitating CI/CD, which is crucial for rapid and reliable software releases. Additionally, Cloudbees offers features like security, scalability, manageability, and expert support, which enhance the overall efficiency and effectiveness of software development.

How does Cloudbees enhance the security of Java apps?

Cloudbees enhances the security of Java apps by providing a secure, cloud-based environment for software development. It offers features like role-based access control, security scanning, and compliance checks, which help in identifying and mitigating potential security risks. Additionally, Cloudbees provides expert support for security-related issues, ensuring that your Java apps are secure and reliable.

How does Cloudbees ensure the scalability of Java apps?

Cloudbees ensures the scalability of Java apps by providing a scalable, cloud-based environment for software development. It offers features like elastic resource allocation, load balancing, and auto-scaling, which enable your Java apps to scale as per the demand. Additionally, Cloudbees provides expert support for scalability-related issues, ensuring that your Java apps can handle varying loads efficiently.

How does Cloudbees enhance the manageability of Java apps?

Cloudbees enhances the manageability of Java apps by providing a platform that automates the entire software delivery process. It offers features like centralized management, automated workflows, and real-time monitoring, which simplify the management of Java apps. Additionally, Cloudbees provides expert support for management-related issues, ensuring that your Java apps are easy to manage and maintain.

How does Cloudbees support the entire development lifecycle of Java apps?

Cloudbees supports the entire development lifecycle of Java apps by providing a platform that automates the creation, deployment, and management of applications. It integrates with popular tools like Jenkins, facilitating CI/CD, which is crucial for rapid and reliable software releases. Additionally, Cloudbees offers features like security, scalability, manageability, and expert support, which enhance the overall efficiency and effectiveness of software development.

How does Cloudbees provide expert support for Java app acceleration?

Cloudbees provides expert support for Java app acceleration by offering a comprehensive suite of tools and services for software delivery automation. It provides guidance and assistance at every step of the development process, from creation to deployment. Additionally, Cloudbees offers expert support for issues related to security, scalability, and manageability, ensuring that your Java apps are developed, deployed, and managed efficiently and effectively.

Vishal BiyaniVishal Biyani
View Author

My name is Vishal Biyani! I am an avid developer and a cloud enthusiast! I am lucky enough to witness some very exciting changes in technology and data landscape.

cloudbeescontinuous deliverycontinuous integrationjavajenkins
Share this article
Read Next
Get the freshest news and resources for developers, designers and digital creators in your inbox each week