IntroductionMy original blog showed how to seperate maven unit and integration tests when doing continuous integration.
This example builds on this to provide a platform to run the example. We use a free Amazon EC2 cloud based solution to show how to deploy Jenkins and Sonar. This is a low power server but it is useful for infrequent use.
The steps are very simple
- Sign up for a 1 year free account from Amazon
- Create a new server from an existing image with Hudson and Sonar.
Viewing The Final PlatformYou can see an example of the finished platform by clicking on the links below.
Jenkins : http://ec2-75-101-221-43.compute-1.amazonaws.com:8080/
Sonar : http://ec2-75-101-221-43.compute-1.amazonaws.com:9000/
Creating A Free Amazon AccountAmazon offer a free account for new customers. First sign up for the account at the following link.
Creating A Free ServerThe free account only allows you to use a restricted set of images and a micro server.
Follow the steps below to create the server.
The first step is to log into the main Amazon console. https://console.aws.amazon.com/s3/home
Go to the EC2 Tab and Click 'Launch Instance'
Next we have to choose the correct image. Go to the community tab and look for the following image.
Notice the 'Star' which shows it is free tier eligible if chosen with a Micro Instance.
This brings up the screen below. Notice the type 'Micro (t1.micro, 613MB).
Leave the defaults and click on 'Continue'
Again leave the defaults and click on continue.
Once again leave the defaults and click on continue.
Create Key Pair
This key pair is important because it is needed to connect to your server. Click on the 'Create & Download your key pair'. Keep the file safe.
Creating A Security Group
The next screen allows you to define the firewall rules for your server.
We are going to allow all of the following rules below. You can make it more restrictive if you like once everything is running.
The details of your new server will then be summarised.
Click on 'Launch' to start the server.
Tools to connect to your ServerYou will need to connect to your server to install the applications. To do this download and install putty.
This will give you all the tools you need to connect to the server.
Converting Your Security KeyBefore you can use putty to login you need to convert the .pem key from step 1 to a .ppk key.
Go to your installation of putty and run puttygen.
Select load and choose your downloaded .pem file. You should see the dialog below.
Next click on 'Save Private key' and save the file somewhere safe.
Connecting To your Serverrun putty
- First fill in the in the server name
Next click on the SSH -> Auth property. Browse to the new .ppk file and select it.
Then click open.
This should give you a terminal window as follows showing you connected to your ec2 instance.