Cloud based deployment pipeline

Cloud based development tools are continuing to improve thanks to the power of new browser technologies and cloud services such as github and Amazon Web Services. The full deployment life-cycle can now be based entirely in the cloud by using various SaaS and PaaS offerings. As each service offered is provided by a different entity the challenge is to integrated those services together to form a seamless continuous development process.

By choosing carefully, it should be possible to create an effective and efficient combination of services that allows smooth movement from code base, through version control, testing and to deployment on to production.

Following on from my previous article in which I reviewed seven cloud based IDEs from the perspective of Java web application development, I now take one of these services through its paces. The IDE by codenvy.com promises a no-fuss set-up for a large range of technologies such as Java and Spring. It integrates with Git Hub code repository and a selection of PaaS including Amazon Web Services.

Development Environment

Setting up a development environment is a 1-2-3 step process. As can be seen from the screen shot below you can easily choose the technology or framework in which you wish to develop your application and the PaaS Service as its target deployment.

Setting up development environment

Choosing the Java Web Application technology option and the AWS Elastic Beanstalk PaaS deployment target a default workspace was created with Java source directories, a webapp directory and a web.xml file already created.

Default web application directories

A simple hello world type web application is automatically created. I decided to use this application to test run the development and deployment process before developing any code. The example web application created by default should be sufficient for such a test. I started by connecting the source code in the newly created codenvy.com workspace to a newly created Github repository.

Source control

Git Hub is well know as a reliable cloud based source code control system. Choosing it as a source control was a no-brainer for Codenvy.

To connect Git Hub you must first create a new repository (if not using an existing one). It is necessary to generate SSH keys in Codenvy which you then configure in Git Hub.

Once this is done the workspace is ready to synchronise with the code repository at Git Hub. The repository must first be pulled from Git Hub before any changes are made to the source code. Then for each file or directory that you wish to add or update to the code repository you firstly add it to the index and commit it, then to send it to Git Hub you must do a remote push.

It mimics the desktop process and smoothly fits in with the development cycle. Once you are happy that you code is nice and safely tucked away in the repository it can be deployed onto the web server.

Deployment

I choose to use AWS Elastic Beanstalk solution for the deployment target.

Amazon offers a bewildering range of services (about 25) and understanding how they all fit together is no small task. Each service exposes an area of functionality. Elastic Beanstalk is a collection of six services that comprise of EC2 (an instance of Linux and Tomcat 7), S3 (Storage), SNS (Notifications), CloudWatch (Health monitoring), Load Balancing and Auto Scaling.

I have been using AWS for about a year and I run a t1.micro instance of Linux and Tomcat 7 on EC2 so I was familiar with these services.

Set up of a target environment can be done from within Codenvy but I preferred to set it up partially via the AWS console. I set up an S3 instance and generated some access keys. With these in hand I went back to Codenvy and selected Create Application from the Elastic Beanstalk menu option and followed the instructions on their website. It took sometime for the environment to be created (about 4 minutes), but once created I returned to the AWS console to check the instance that was created and the environment. All had been created and were running without problems.

With the environment set up I was ready to deploy the application. Again it was a simple process, I created a new version and hit the deploy button.

Deploy the application

The application was deployed and I could access it via the myapp.elasicbeanstalk.com.

Conclusions

Overall it was a simple enough process of setting up and testing each part of the deployment pipeline. The integration is smooth and the different providers are seamlessly made part of codenvy.com’s IDE. The combination of Git Hub, AWS and codenvy makes it clear that a fairly sophisticated development process of coding, building, versioning and deploying can be achieved with codenvy’s IDE and the integrated cloud services from Git Hub and Amazon.

You might be interested in these articles

Amazon Free Usage Tier: Installing Tomcat 7 on an EC2 Linux instance

Cloud IDE for Java EE development

Step by step guide to setting up a Java EE web application

Java EE project from remote Git repository

Advertisements
Cloud based deployment pipeline

Java EE project from remote Git repository

This article shows how to create a new Eclipse project from a remote Git Hub repository. You will learn:

  1. how to download and install eGit for eclipse,
  2. how to checkout a Git Hub repository from a remote site and
  3. how to import a Marven project.

This article assumes that you have the Java EE Kepler version of Eclipse, a Git Hub account that contains a repository that you want to checkout and that the project has a POM file (i.e. is a Marven project).

Download and install eGit for Eclipse.

To install eGit follow these steps:

  1. Navigate to Eclipse > Help > Install New Software. You will see a dialogue box like the one below.
    git step 0
  2. In the work with drop down select the Kepler site.
  3. Then expand the option Collaboration and tick the three option name as follows
    1. Eclipse EGit
    2. Eclipse EGit Mylyn GitHub Feature
    3. Eclipse JGit
  4. If these options are not available it is because they are already installed
  5. Click through the rest of the wizard and agree with the licenses. The eGit plug-ins will now be downloaded and installed.
  6. If you are asked to restart Eclipse do so.

Checkout a Git Hub repository from a remote site

Now we will check out a project from the Git Hub remote server. It is assumed that you have a Git Hub account and a project ready to be checked out. For this part of the article you will need you user name and password for you Git Hub account and the URL of the repository.

  1. You will need to open the Git Repository Exploring perspective. Navigate to Eclipse > Window > Open Perspective > Others and select the Git Repository Exploring perspective.
  2. The Git Repository Exploring perspective tab should appear on toolbar next to the Java EE perspective tab.
  3. Click on the Git Repository Exploring perspective tab. You should see the three options as follows:
    1. Add an existing local Git repository
    2. Clone a Git repository
    3. Create a new local Git repository
  4. Click the Clone a Git repository to reveal the Source Git Repository dialogue box
    git step 1
  5. In this dialogue box enter the URL of the repository. This can be found on the home page of the project in your Git Hub account. At the time of writing it was located to the right of the page under the title HTTPS clone URL.
  6. Copy this URL to the clipboard and paste it into the URI.
  7. In the authentication section enter you Git Hub username and password and click the Store in Secure Store tick box. Click Next.
  8. On the this screen we select the master branch (or another branch if appropriate). Click Next.
    git step 2
  9. Next we select the local destination for the repository. Click Finish.
    git step 3
  10. Now the repository is checking out to your local computer. This will take a few minutes depending on the size of the project. Once it has finished you will see your repository displayed in the list of Git Repositories.
    git step 4

Import a Marven project.

Now we need to import the project.

  1. Navigate to Eclipse > File > Import and from the dialogue box that pops up select Existing Marven Project.
    git step 6
  2. Now you need to select your Marven project. Navigate to the location given above step Local Destination. In the projects section you should see your project. Select it and click Finish.
    git step 7
  3. The browser will create a new project and import all of the it dependencies. This may take some time. You may see the following dialogue box on the screen while it is preparing the project.
    git step 8
  4. Once all the dependencies have been imported you can build your project.

This has been a very quick guide to checking out a remote Git Hub project in Eclipse.

Other articles that may be interesting:

Java EE project from remote Git repository