Blog

The latest expert opinions, articles, and guides for the Java professional.

Release Management for Enterprises

5. Automate Deployments with LiveRebel

If you made it here, you have successfully set up a Continuous Integration server that pulls from version control, generates builds and comprehensively tests your application. Congratulations, you’re almost done, and are a soon-to-be owner of a sweet continuous delivery pipeline!

You release pipeline is now streamlined and will enable you to rapidly generate releases. The challenge now is rolling out these new versions to your end users just as rapidly without disrupting their user experiences with maintenance windows.

Ideally, you want to be able to get your thoroughly-tested, latest version to your end users as soon as it is ready. This way, you don’t have shelfware and delight your users with a steady stream of awesome features.

Here is where we use LiveRebel from ZeroTurnaround to automatically deploy or update your application – code, database, configuration, without downtime or interrupting users. To further preserve end user experience, it also rolls back changes if smoke tests fail, before users are impacted.

Let’s get started with setting up LiveRebel and your deployment environment, including servers:

  1. Download LiveRebel from ZeroTurnaround’s website: /software/liverebel/download/

  2. Unzip it and start it:

    • unzip <LiveRebel ZIP file>

    • run liverebel/bin/lr-command-center.sh start

  3. Set up your app / web servers using the LiveRebel wizard

  4. Restart your app / web servers with the LiveRebel agent

 


Let’s focus more on the last 2 bullet points from the instructions above: Setting up a server to connect to the LiveRebel Command Center. So if you do not already have your application servers provisioned for this exercise, that’s ok. We’ll do that now, using JBoss AS 7, an app server that we like.

JBoss AS 7.1.1.Final was released on March 9, 2012, but is still the latest community edition version (archive is 127MB).

  1. Download the installation package

  2. Extract the archive

  3. You are ready to goL: Running ./bin/stadalone.sh will start a JBoss server listening on port 8080

To start, Red Hat has made it simple as well with the bin/standalone.sh script, unless you want to run a clustered environment. Also there are several default configuration files in “standalone/configuration” directory, which allow to turn on and off default clustering and choose between web or full EE profiles, so one can pick the closest to what is needed and tweak it minimally.

Now server itself is ready, let’s instrument it with LiveRebel agent.

  1. Download a lr-agent-installer.jar file from a running LiveRebel instance: wget -O lr-agent-installer.jar  --no-check-certificate https://127.0.0.1:9001/public/lr-agent-installer.jar

  2. Run this installer: java -jar -Dliverebel.agent.token=myjboss lr-agent-installer.jar

  3. Run the server with LiveRebel agent: lr-agent/bin/run.sh bin/standalone.sh

Now your JBoss server will start with LiveRebel agent, locate and connect to the Command Center. This will be shown on the Servers tab, like in the image above.

Now, let’s hook up LiveRebel with your Bamboo plan.

  1. Download and install the LiveRebel plugin for Bamboo from the Atlassian Marketplace

  2. Then point it to the LiveRebel Command Center and LiveRebel Tasks will become available to you during job creation process:

  3. Next, create a stage called “Deploy” with a job for the LiveRebel deploy task

You can configure it either to upload artifact to LiveRebel for later deployment, or have it automatically update your target servers. Now your users get the latest releases as soon as they are tested and available. And all without any application downtime or user interruption.

Automating Database migrations, configuration changes and property injection

You can have LiveRebel update databases, configuration and insert environment specific properties during application deployments. This way, the entire application deploys, updates, or rolls back code, database and configuration as a single unit.

To do so, include a “liverebel” directory in your application artifact. Then include:

  • Database scripts: Within the “liverebel/db” directory

  • Configuration scripts: Within the scripts directory. Scripts can include Chef, Puppet or bash scripts for infrastructure configuration, etc. You can control when (init, appHidden, appDown, serverDown, serverUp, appUp, appVisible, finally) and where scripts execute (perUpdate, perServer).

  • Environment properties: Within the expand directory. Place the property file with $LR{} placeholders within the directory structure you’d like the property file to deploy to. Then specify values for each environment from within the LiveRebel Command Center. Values will be applied based on which environment the application is deployed to.

Read more about packaging artifacts for LiveRebel here.



DOWNLOAD THE PDF

Responses (2)

  1. Avatar  

    jennifer

    August 22, 2013 @ 1:58 pm

    Was there a reason behind using GitHub, instead of Atlassian’s Stash product?

  2. Avatar  

    Oliver White

    August 26, 2013 @ 7:02 am

    Not in particular, we just wanted to experiment with other tools out there and expose our readers to as many different technology companies as possible. We also produced a similar report last year with free or OSS tools entitled “Pragmatic Continuous Delivery with Jenkins, Nexus and LiveRebel” — check it out: http://zeroturnaround.com/rebellabs/zt-labs-tutorial-pragmatic-continuous-delivery-with-jenkins-nexus-and-liverebel/

RSS feed for comments on this post.

Leave a comment