Saturday, May 26, 2018

Migrate Java App from Bitbucket to Azure Cloud - How to migrate Java application to Azure Cloud from Bitbucket using VSTS

Let's say you have a Java application that is setup already in Bitbucket. Your organization have decided to migrate to Azure Cloud. Let us see how we can migrate the application to Azure:

Pre-requistes:
1. Java application set up in Bitbucket.
2. VSTS project setup.

Let us create WebApp in Azure Portal First. WebApp is a App service provide by Azure for hosting your web application. It supports .NET, Java, PHP,  Python and NodeJS. We will be deploying our Java Web App which is available in bitbucket repo.

Create App service on Azure portal
Now to login portal.azure.com
click on App services

Click on + Add
Click on Web App.
Create
Enter App service name(it should be unique)
Create a new resource group(for first time if you create an app service, otherwise you can use existing group name)

Select azure free subscription

Leave the rest default click save/create

This will take bit time to create the app service.
Now click on app service tab on left. You will see the newly created app service.
Select it, go to application settings. Choose Java 8 instead of .Net
And also web container as Tomcat.


Save and try to access the app service url by going to overview section of app service.

You should see the app service home page.

Steps to migrate java applications from Bitbucket to Azure Cloud using VSTS:

1. Login to VSTS. Click on your project.
2. Go to build and release
3. Click on builds
4. Click on New.
5. Select Bitbucket Cloud as Source. Select service connection.
6. Select use Username and password to authorize.
7. Click on three dots ... repository
8. Now choose a template by entering Java in the search textbook. Choose Azure WebApp for Java.
9. Click on Apply. VSTS already have Java Azure WebApp template.

10. Now Click on Maven pom.xml and make sure you have right goal - clean install
11. Leave the value as it is for Copy Files to staging folder

12. Publish Artifact: Drop 

13. Click on Stop azure web app
Enter Azure subscription.

Select Free trial subscription from the drop down.
14. Click on authorize(remove popup blocker)
15. do the same steps for Deploy Azure App and Start Azure App.
16. After done, click on Save and Queue.

Now you will see that VSTS would have started build.

After successful build, you can check the output by accessing below URL:

http://myAzureWebAppUrl/MyWebApp

1 comment:

  1. I am glad to be a visitor of this thoroughgoing website ! , appreciate it for this rare information! . programar en java

    ReplyDelete