How to Manage the Application Lifecycle in Jelastic

| October 29, 2012

When you develop complex applications with highly customized logic and user interfaces, configuring them on the fly in a single environment does not make sense. Such applications take time to develop and require more formal practices to ensure that they work as intended and meet users' needs. Your project might not be so large, but you can still benefit from using development and test environments, where you can develop and test your code without affecting end users. Building your own applications requires a thorough understanding of the issues that can take place during the app lifecycle, from development to the production stage.

As a rule, the typical application lifecycle comprises development, testing, deployment and upgrades. During development, programmers use their tools to perform requirements analysis, design and model a solution and develop application code. This code can be tested on an iterative basis by quality assurance engineers. The production system changes on an ongoing basis. After testing, the release can be delivered to the production environment for use. Changes to the production system require a new development effort.

Jelastic Cloud PaaS supports several tools and features, which help you to improve and simplify application lifecycle management. You can use the Maven building tool to build your projects directly in the Cloud. Continuous Integration with Jenkins or Hudson can help you to identify issues along the way and fix them ASAP. You can easily clone or branch development, test and production environments so they all can have identical software stacks and topology. You also have the ability to set your own domain names and to swap them, whenever you want to. And beginning with our latest release you can create applications without compute node and much more.

Let’s look how Jelastic can simplify application lifecycle management for you. We'll create four environments (build, test, data and production), deploy our app and upgrade it using Jelastic's set of tools. One of the best practices is to make your test environment look like your production environment and to periodically synchronize the test database with the data from production. In our case, both of our environments will "look" at one database. Also we'll use separate building environments to build all our projects with the embedded Maven tool.

To realize the schema above we’ll come through the next steps:

1. Create the production environment.

2. Create the build environment.

3. Build and deploy the project.

4. Create data environment.

5. Configure the database.

6. Create the test environment.

7. Upgrade application.

Let's get started!

Create the production environment

First of all we'll create the environment for production.

1. Go to and sign up if you haven't done it yet or log in with your Jelastic credentials by clicking the Sign In link on the page.

2. Ask Jelastic to create a new environment.

3. Select the application server you want to use (for example GlassFish), set the cloudlets limit and type the name of your first environment, for example, prodenv. Then click Create.

Wait just a minute for your environment to be created.

Create the build environment

You can build applications in the Jelastic cloud instead of building your projects locally and uploading WAR archives. It is faster and takes less time and bandwidth, you get the efficiency of the cloud and can continue to use your computer without extra loads. Jelastic can take application source code directly from your version control repositories (via Git or SVN protocol).

The next step is to create a building environment.

1. Ask Jelastic to create a new environment, pick Maven as your building tool, set the cloudlets limit and type the environment name, for example: buildenv. You can create environment without a compute node. No need to have separate building tools for each of your environments.

2. In just a couple of minutes your environment will be created.

Build and deploy the project

Now we can easily build our first project and deploy it to the production environment.

1. Add your project to Maven.

In the dialog, navigate to the Git tab (or SVN) if you want to use Git as your revision control system. Specify your project name, Path to your project, Branch, Login and Password of your repository, name of your Environment, Context in which you will deploy your project, and click Add.

2. Click Buid and deploy button for your project.

Create data environment

We decided earlier that in this example we would use one database for both of our environments (production and test). Let's create one more environment with the database without a compute node. This allows you to store all your applications' data there.

1. Click on Create environment and pick the database (for example MySQL) that you want to use.

2. When your environment is successfully created, click the Open in browser button for MySQL. Jelastic sent you an email with credentials to the database. Create an account and the database with the application using these credentials.

Configure the database

We'll configure the database for our application needs.

1. Click the button Config next to the application server of your production environment.

2. In the opened tab create a mydb.cfg file in the home folder and add there all necessary configurations:

username={get in the email from Robot@jelastic}
password={get in the email from Robot@jelastic}

Note: You can mention all connection settings in your code (application). In the given example, we put all the settings in the file, which is read by our application.

3. Upload MySQL connector to the lib folder of GlassFish.

4. Restart GlassFish and open your app in a web browser.

6. With Jelastic you have the ability to set your own domain name for your URL instead of using your hoster domain name. So, buy a domain name for your production environment. In this case, we recommend that you set your own custom domain by adding a CNAME record. Click the Settings button (the wrench icon) for your environment and bind the domain. In our case the URL is

Please note: in this example we use DNS names (, that were previously added to local DNS-server (file hosts).

Create the test environment

It's time to create our test environment now. For this purposes you can easily clone your production environment. That lets you work with multiple versions of the same environment and branch your environments as needed. The cloned environment is identical to the original environment and includes all data in its databases, deployed *.WAR and *.JAR packages.

1. Clone your production environment to get the exact copy of it for adding some new features and testing them.

Let's call it testenv.

2. You can open it in a browser just to ensure that everything is ok.

Upgrade application

If, for example, you need to make some changes to your application:

1. Add your new project to Maven.

2. Click Buid and deploy button for the new project. Your project must appear in the context that you have specified.

3. Click the Settings button for your environment and bind the domain (e.g. that you have bought earlier.

4. Let's open our new application in a web browser to see the changes.

After you have tested your new features you can just swap domains. With this functionality, your application's end users will not experience downtime when you deploy a new application version. You can stage your new application version in a test environment and swap the URLs with the production environment in just a few clicks.

6. Open the settings for one of your environments and in the "Custom domains" section, choose the other environment for swapping and click Swap.

Now you can go to and you'll see that your application has been already updated.

Also here is a video version of the same procedure:


As you can see, application lifecycle management becomes a lot easier thanks to the automation of routine operations (creating environments, building and deploying projects, binding and swapping domains, etc). This was just a simple example. There are lots of variants how to realize application lifecycle management via our platform. If you manage your Jelastic application in any other way please share your experience with us and with other users in the comments below. This will be very useful and exemplarily. Thanks in advance!