If you’re just getting started with DevOps, the first thing I’d recommend is to read the Phoenix Project and the DevOps Handbook. DevOps is, further and foremost, about culture and mindset. These two books are the foundation of DevOps thinking, and they should be included in every list of must-reads.
If you’re just getting started with DevOps in Azure, then the best place to start is the DevOps Starter feature. This is a resource you can find in Azure’s marketplace. Just search for DevOps Starter in the search field, and you’ll find it. DevOps Starter will set up everything for you to get started with CI/CD pipelines. It will create a sample app, a code repository, a CI/CD pipeline, and a monitoring tool. It even generates a super handy dashboard, from where you can see all the action. This is all you need to have lots of fun!
I’m on the Cloudskills Cloud Native DevOps Bootcamp, and I’ve been learning a lot! That’s where I learned about this awesome feature. Luke Orellana gave an incredible lecture this past week. And today there’s more! If you wanna learn with the pros, and participate in a thriving community, then I highly recommend joining Cloudskills!
As I mentioned in the previous article, I don’t wanna make these too long. But I don’t wanna leave holes either. I’ll try to pack as much information as I can in a single post, so you can hit the ground running right away. Then, in a next post, I’ll cover an aspect of what I mention here in more detail.
Creating the resource
From the Azure Portal, we’ll search for DevOps Starter in the search field. When we click on Create, the first thing we see is the image below. Here, we’ll choose the application language we’ll use for our app. In my case, I chose Node.js. For the workflow, GitHub Actions appears as the default setting, but you can also choose Azure DevOps. I left it as it was, and used GitHub Actions. Click on Next: Framework.
For the framework, I chose Express.js. Just click Next: Service to move on to the next step. Here, we’ll choose the service in which to deploy our application. According to the language and framework you choose, a different range of services will appear in this step. If you choose .Net for instance, you can choose Azure Functions for the service.
The last step is the actual creation of the resource. You’ll have to authorize the access to your GitHub account, by clicking on Authorize. Now, you have to choose the name of the new GitHub repository and the name of your web app. By default, the App Service plan is set to Standard S1, but I changed to the free tier. It works the same for this purpose.
After a very short while, we’re ready to go. This is how it looks from the beginning. A super handy dashboard, with all the information you need. The tile on the left displays your workflow. Every change you commit to your remote repository will appear here. The Azure resources tile shows your resources in Azure and the third tile is for the Application Insights graphs, where you can monitor your web app.
And this is the sample app, alive and running on the web, bare bones, just as it came from the factory.
This here is the essence of DevOps in one place! Very clever service! Each day that passes I love Azure more and more. Now a question for those with experience in AWS: is there something similar over there?
Now let’s see our workflow in action!
Let’s head to our newly create GitHub repository and clone it to our local machine. From the dashboard, there’s a link that takes you directly to your repo. To clone the repo, click on the green button where it says CODE, copy the URL, and from your terminal, run the following command:
git clone https://github.com/yourusername/your_repo.git
We’ll move into the newly created directory and start playing with the code.
I updated the
index.pug file with a few lines of new text, saved it, staged it, committed it, and pushed it to the remote repo. The push event to our main branch triggers the GitHub Action, and this is where the magic begins!
There are 3 jobs in this Action: the Build, Deploy and Functional Tests jobs. I’ll break down this Action in a later post. For now, let’s just marvel at the beauty of the CI/CD pipeline!
This is our dashboard, showing the new jobs that just executed.
And the new app is alive! Everything happened seamlessly, and with little effort. Automation is sweet!
It’s easy, isn’t it? How did you like it? I’d love to see your own results. There’s a lot to explore, but this is a great starting point.
I’ll write an article about GitHub Actions, where I’ll explain the YAML file, and what each part does. I hope to see you soon!
Enjoy the rest of the week!