How to Manage the Application Lifecycle in Apiqcloud

How to Manage the Application Lifecycle in Apiqcloud

Complex applications with highly customized logic and user interfaces 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.


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). 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, and both of environments will look at one database. Also we'll show how to use separate building environments to build all your projects with the embedded Maven tool.


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

  • Create the production environment
  • Create the build environment
  • Build and deploy the project
  • Create data environment
  • Configure the database
  • Create the test environment
  • Upgrade application


Also here is a video version of the same procedure:

Let's get started!

Create the Production Environment

Log into the Apiqcloud Manager.

Ask Apiqcloud to create a new environment.

            <im1>

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.

    <im2>

Wait just a minute for your environment to be created.

 <im3>

Create the Build Environment
You can build applications in the Apiqcloud 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. Apiqcloud 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.
Ask Apiqcloud 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.

<im4>
In just a couple of minutes your environment will be created.

<im5>
Build and Deploy the Project
Now we can easily build our first project and deploy it to the production environment.
Add your project to Maven.

<im6>
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.

<im7>
Click Buid and deploy button for your project.

<im8>
Create Data Environment
Let's create one more environment with the database without a compute node. This allows you to store all your applications' data there.
Click on Create environment and pick the database (for example MySQL) that you want to use.

<im9>
When your environment is successfully created, click the Open in browser button for MySQL. Apiqcloud sent you an email with credentials to the database. Create an account and the database with the application using these credentials.
 
Configure the Database
Click the button Config next to the application server of your production environment.

<im10>
In the opened tab create a mydb.cfg file in the /opt/glassfish3/temp directory and add there all necessary configurations:
host=jdbc:mysql://mysql{node_id}-{your_env_name}.{hoster_domain}/{db_name}
username={get in the email from Robot@Apiqcloud}
password={get in the email from Robot@Apiqcloud}
driver=com.mysql.jdbc.Drive

<im11>
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.
Upload MySQL connector to the /opt/glassfish3/glassfish/domains/domain1/lib directory of GlassFish.

<im12>
Restart GlassFish and open your app in a web browser.

<im13>
With Apiqcloud 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 you to 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 production.com.

<im14>
<im15>
Please note: in this example we use DNS names (production.com, test.com) 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.
Clone your production environment to get the exact copy of it for adding some new features and testing them.

<im16>
Let's call it testenv.

<im17>
You can open it in a browser just to ensure that everything is ok.

<im18>
 
  • 0 Users Found This Useful
這篇文章有幫助嗎?

相關文章

Container Firewall

Container Firewall Management   Apiqcloud Container Firewall feature provides a possibility to...

Auto-configuration

Smart Auto-Configuration of Containers In order to ensure efficient utilization of the...