Wednesday, July 20, 2016

Darwino, and Java applications, on Microsoft Azure!


In a prior blog post, I showed how we deployed a Java based application to IBM BlueMix. But as you may know, the Darwino platform is pervasive and can run applications on many different applications servers, while connecting to many different relational databases.
So let's deploy a Darwino app to Azure, using TOMCAT and MS SQL Server.

Similarly to IBM Bluemix, Microsoft offers an Eclipse plugins but, unfortunately, I cannot get it to work with large Eclipse Workspaces (see issue: https://github.com/Microsoft/azure-tools-for-java/issues/15). Let's deploy the application manually, until this is fixed.

1- Create an account

My experience if you plan to keep your application running more than 30 days, then forget about the trial subscription. I initially used it but was not able to convert it to a pay-as-you-go subscription when the trial expired without involving Microsoft support. I gave up, deleted all the already deployed assets and redeployed them with the proper subscription...

2- Create your Java application

For a basic WAR deployment, then simply create an app and use the application settings, as explained here. Once done, you have an empty web site at http://xxxx.azurewebsites.net/, that you can already try:

3- Create a SQL Server database

Microsoft Azure features the latest SQL Server 2016, including the new JSON capabilities.
A database in Azure requires 2 resources:
  • A database server
  • A database instance, created within a server
The 2 resources can be created in a single step: when you create the database, it asks for a server or let you create one dynamically. 

You can test your new database from a remote machine using tools like DbVisualizer. To do so, you first need to enable access to your client IP address in the firewall. This is again an easy operation: from the database, click on the server URL then on Settings for the server and you have the firewall options. Finally, use the JDBC URL revealed by clicking 'Show database connection strings':


4- Accessing TOMCAT using FTP

Contrary to IBM Bluemix, Azure let you access your VM through FTP, which is very convenient. The connection URL and the user are available in your application information panel.
Now, this deployment model only exposes by default the TOMCAT HOME directory via FTP. But this is enough for deploying a WAR, or consult the log files.

Tip:a Darwino app is using some configuration files located outside of the WAR file. On Azure, we copy them to this home directory, and find the directory location in the code using:
String tomcat8 = System.getenv("AZURE_TOMCAT8_HOME");


5- Deploy your WAR file

Simply copy your WAR file to /site/wwwroot/webapps and TOMCAT will automatically deploy it in a handful of seconds







Now it is ready!

As you saw, deploying a Darwino application on Azure was easy. The whole steps took less than 15 mins. The Eclipse tools should make it even easier and faster, which will try when the bug mentioned earlier will be fixed.

Similarly to IBM Bluemix, I would advise developers to develop using a local TOMCAT environment and then deploy the app to Azure when ready: the developer experience is far better this way.

8 comments:

  1. This blog is having a wonderful talk. The technology are discussed and provide a great knowledge toall. This helps to learn more details about technology. All this details are important for this technology. Thank you for this blog.
    Digital Marketing Company in Chennai

    ReplyDelete
    Replies
    1. I have read your blog its very attractive and impressive. I like it your blog.

      Java Training in Chennai Core Java Training in Chennai Core Java Training in Chennai

      Java Online Training Java Online Training Core Java 8 Training in Chennai java 8 online training JavaEE Training in Chennai Java EE Training in Chennai

      Delete
  2. Wow it is really wonderful and awesome thus it is very much useful for me to understand many concepts and helped me a lot. it is really explainable very well and i got more information from your blog.


    Informatica Training in Chennai

    ReplyDelete
  3. Java Training Institutes Java Training Institutes Java EE Training in Chennai Java EE Training in Chennai Java Spring Hibernate Training Institutes in Chennai J2EE Training Institutes in Chennai J2EE Training Institutes in Chennai Core Java Training Institutes in Chennai Core Java Training Institutes in Chennai

    ReplyDelete
  4. Hibernate Online Training Hibernate Online Training Hibernate Training in Chennai Hibernate Training in Chennai Java Online Training Java Online Training

    Hibernate Training Institutes in ChennaiHibernate Training Institutes in Chennai Java Online Training Java Online Training

    ReplyDelete