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