Learn how to deploy database changes and updates using DevOps patterns and practices with MySQL, Terraform, and Azure in this hands-on project focused course:
DevOps for Databases
To kick off the DevOps for Databases project-focused course, we're going to talk about why practicing DevOps for databases is very-much the same as practicing DevOps with developer or infrastructure code.
Source control with MySQL queries
CI/CD and MySQL queries
DevOps workflow
Creating a MySQL Database in Azure with Terraform
When you're creating a database, the best way to do it is with code. That way, you aren't manually clicking through a UI. The best place to start is with Terraform, an infrastructure-as-code language. You use Hashicorp Configuration Language (HCL) to write the code to create a MySQL database in Azure and a firewall rule.
Resources to use in Terraform for Azure
Create a MySQL database
Create a firewall rule for the MySQL database
Clean up your environment
Running the Terraform Creation in Azure DevOps
Taking the code that you wrote in video 2, you'll follow the same practices, but with a twist using CI/CD in Azure DevOps. The Terraform config files will be deployed via Azure DevOps to create a fully-functional pipeline that creates a database.
Set up a YAML pipeline
Use specific Terraform tasks
Create variables and secrets
Run the pipeline
Storing SQL Code in GitHub
No code is ready to be used until you store it in source control. Once code is stored in source control, others can collaborate on it and see it so they understand what's happening in the environment. This same workflow is no different with SQL code.
Write a SQL query to create a database, table, and users
Store the code in GitHub
Running a SQL Query in Azure DevOps
Once code is committed to source control, which you learned about in video 4, you can take the same approach as developers take to run their code in a CI/CD pipeline. Using Azure DevOps, you will create a pipeline that will be used to deploy a MySQL query.
Set up a YAML pipeline to run MySQL code
Use specific MySQL tasks
Create variables and secrets
Run the MySQL query via a CI/CD pipeline
Testing the SQL Query in Azure DevOps
Code should always be tested, regardless of if it's application code, automation code, or even SQL code. The last video in this project-focused course shows you how to create a test using Python. Once the test is created, you use an Azure DevOps pipeline to run the test.
Create a MySQL test using Python
Create a pipeline for the test
Run the test in CI/CD