Build DevOps CI/CD pipeline for Containerised Go app with VSTS and deploy to Azure in 5 minutes

In this exercise we shall build Continuous Integration and Continuous Delivery pipeline with VSTS and deploy sample Go App to Azure Web App through Azure DevOps Project

Pre-requisites

Azure account – https://portal.azure.com

Continuous Integration: Integrate early and often – Jez Humble

Steps to build CI/CD for sample app

  1. Login to https://portal.azure.com
  2. Search for DevOps Project and select DevOps Project resource. Click on Create to create new DevOps ProjectScreenshot_2.png
  3. Select your preferred language, Azure support multiple languages like Go, .Net Core, Node.js, Python, PHP, Java, Static Website. For this Demo lets Select Go and click on NextScreenshot_1.png
  4. Choose Go application framework. select Simple Go app and hit NextScreenshot_3
  5. Select Azure service to Deploy either Containers and Web App. For this Demo we will Web App for Containers. The sample app is containerised with Docker. We will take at the code in the next steps.Screenshot_4.png
  6. Its time to create Microsoft VSTS account for CI/CD pipeline. If you already have VSTS account then select use existing account, otherwise select Create NewScreenshot_5
  7. If you don’t have VSTS account then select Create new, enter Project Name as FirstGoProject and click Done Screenshot_6
  8. If you already have VSTS account then select existing account,  enter Project Name as FirstGoProject and click Done Screenshot_7
  9. It will take 1 or 2 minutes to create the Resources, Click on the Notifications to see the status. Once deployment is complete open the resource. Azure has done lot of things for us in the background. It has uploaded sample code into Git, created CI build and Release Definition in VSTS and deployed Go app to Azure web app. Navigate the each of the to see the pipeline and deployed application.Screenshot_8.png
  10. Sample application is deployed successfully Screenshot_9.png
  11. Lets dig into Build pipeline, click on the Repository Code button from DevOps project resource we have created. This will take you to VSTS. VSTS is an Microsoft platform to manage work, build and manage CI/CD pipeline. In this below slide we can see the sample Go App code is being uploaded to Git in VSTSScreenshot_10.png
  12. Click on Build and Release tab to look into Build & Release Pipeline. Here you can see out last build was success, which was initiated by Azure DevOps Project resource. Now click on Build Definition i.e FirstGoProject – CI. Select Edit to see the Build definition steps.Screenshot_11
  13. Here we can see VSTS had added 2 steps One to Build an Image of our sample Go containerised application and other to Push an Image to Azure Registry.Screenshot_12.png
  14.  Lets look into our Release Pipeline, Green box shows the status of the recent release. Click Releases tab and select Release Defintion. Green box with check marks shows the status of our release. In this exercise Azure DevOps Project has run this first release. Screenshot_14.png
  15. In this view we can configure Deployment to Cloud/On-prem Servers. You can click on Add to configure QA, Stg, Prd environments through which you can deploy to Azure, AWS or even other cloud providers. Select 1 phase, 1 task to see the Deployment tasks.Screenshot_15.png
  16. Release has just one task to deploy to Azure. This task picks App image from Azure registry and deploys to Azure Web AppScreenshot_16

We have successfully create CI/CD pipeline and Deployed sample app to Azure.

VSTS gives lot of flexibility and extend-ability. please check out VSTS documentation.

 

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s