Showing posts with label Cloudbees. Show all posts
Showing posts with label Cloudbees. Show all posts

Tuesday, September 25, 2012

Using Cloudbees behind a proxy

At work, we are sitting behind a proxy. This can be pretty annoying if you have to use services that require the internet, but don't rely on your internet settings. For example Maven, which can be configured using it's settings.xml file, or the Cloudbees SDK.

That last one is a bit trickier to use behind a proxy. There is no obvious settings.xml or properties file where you can define your proxy server. The solution, however, is very simple. Go to your Cloudbees SDK root folder, and edit the bees.bat file. Change the JAVA_OPTS to the following:
JAVA_OPTS=-Dbees.home=%BEES_HOME% -Dhttp.proxyHost=<your proxy host> -Dhttp.proxyPort=<your proxy port> -Xmx256m
Save the changes, and when you run the bees command from the console now, it will use your proxy settings. Easy as that!

Wednesday, July 18, 2012

Cloud IDE

Today, I stumbled upon somtehing I've been searching for quite a while: an online IDE in the Cloud! No more need to install stuff on your PC, just develop anytime, anywhere you are. I discovered Cloud IDE, where you can sign up for a free account. Moments later, your personal domain has been created and you can start developing!

There are some very interesting options once you are logged in. You can link (a.o.) your Cloudbees and Google App Engine accounts. That way, you can easily create and deploy applications. There is a sample GWT project that you can import to Cloud IDE, and when your Google App Engine account has been linked, the new project is deployed within seconds. A lot of nice functionalities, all out of the box.

Of course, there are also drawbacks. You need a relatively fast internet connection, but I guess that's not really an issue anymore these days. Further, the IDE isn't nearly as extended as Eclipse or IntelliJ. The 'develop in the cloud' concept is obviously still in its childhood, but it looks promising. There's GIT support, you can use Maven, create applications directly in your Cloud platforms, ... You can even collaborate on the same project with up to 5 users in the same domain.

More features will be added, while gathering feedback from developers. I like the idea, but it's yet another IDE to get used to. I'm looking forward to playing around with it, and the ease of integration with PaaS providers is a big advantage for me. The Cloud is ever expanding!

Friday, March 23, 2012

The Cloudbees cloud solution

A few weeks ago, I blogged about getting your app online with Google App Engine. While this is a very easy process, it is far from the only cloud solution available. I have tried another one, Cloudbees, and will tell you about my experience now.

Cloudbees offers more then just a deployment platform. It has Repositories, Continuous Itegration and an Application Server for you to play around with. It also offers database services, and has plugins for numerous other things (like Sonar, Sauce Labs and many others). For this next example, I used SVN as repository, Jenkins as CI and Tomcat as app server.

Signing up

Signing up for Cloudbees is easy. Fill in your name and e-mailaddress, and create an account. That's it! Now that your account has been created, you can select which services to use. There are both free and paying options. To get started, I added the following:
  • Repository
  • Jenkins
  • Applications
I chose the free version of each. The idea was to simulate a real world working environment. I know there are a SDK and plugins available to build and deploy from within Eclipse/STS, but I wanted to have a continuous integration build my SVN repository whenever I checked in changes.

Configuration

First, I created a new code repository (in the Repositories service). I named it 'blogtryouts'.

Then I created a new application, naming it, again, Blogtryouts.


You now can configure the application server, which is in fact a Tomcat instance. You can define JDBC-connections, or upload a WAR file to be deployed.

Continuous integration

But we don't just want to upload a WAR file. We want our newly created SVN repository to be checked out, the project to be built and the resulting WAR-file to be automatically deployed. Therefore, we'll create a Jenkins service in Cloudbees. I created a DEV@Cloud free instance.

The Jenkins instance is immediately available. I added a new job ('Blogtryouts', who'd have guessed?), and made it a Maven 2/3 project. Once created, we can start configuring our Jenkins build!

Checkout, build, deploy

The configuration is pretty easy as well. The first thing we want Jenkins to do, is checkout our SVN repository. Under Manage sourcecode, you can select Subversion and then specify a URL. That URL is the one Cloudbees gave you when you created your repository. You can find it by going to Services -> Repositories and selecting your repository.

Since we told Jenkins it's a Maven project, it'll automatically try to build the pom.xml. You can add parameters and specify when it should be built. Under Building Activators check Build when a change is pushed to CloudBees Forge. This will start a build when someone commits code to SVN.

Last but not least ,we want to deploy the built artifact. Therefore, check Deploy to CloudBees under Actions after build. You can now specify the site and application ID to deploy to. The site is normally your username, application ID is the name you gave your application, prefixed with yoursite/. Cloudbees helps a lot by providing a dropdown with sites, and by telling you an application ID can't be found. They can even tell you which application IDs are valid.

If you now click 'build now', There will be a warning that your account hasn't been validated. This is an extra step required. Just click the link and enter your phone number (make sure you're near the phone with that number!). Seconds later, you'll receive a phone call with a computer voice telling you a PIN code. Enter the pin code, and you're good to go.

The webapp

So, now that our cloud is fully setup, we of course need a webapp to deploy. For demonstration purposes, we'll just use a general Maven archetype. As in some of my prvious blogposts, we'll create a Wicket project. We can do this quickly by executing this Maven command:

mvn archetype:generate -DarchetypeGroupId=org.apache.wicket -DarchetypeArtifactId=wicket-archetype-quickstart -DarchetypeVersion=1.5.5 -DgroupId=com.mycompany -DartifactId=myproject -DarchetypeRepository=https://repository.apache.org/ -DinteractiveMode=false

The magic

Now that our application has been created, we just have to import it into our SVN repository. I used TortoiseSVN to do an Import to my Cloudbees repository. It doesn't matter how you do it, but once the import's been done, you can watch the magic happen.

Jenkins will notice a new commit and will start a new build. When that's done, it'll deploy the generated WAR-file. When you now go to Services -> Applications, and click your application, you'll notice a new deploy has been done, with a Jenkins build message. This means your app is up and running! The URL is found on top of this page as well. Mine is available here.