Skip to main content

Overview

Here is a high level diagram of how Mage interacts with various Azure resources deployed using this Terraform template. Mage Azure architecture

Pre-requisites


1. Install Azure CLI

Follow these instructions to install the Azure CLI on your workstation.

2. Log into Azure from CLI

If you don’t already have an account in Azure, create one here. Once you created an account, from your terminal run the following command to log in:
Your browser will open and have you sign in with an existing Azure account. Once completed, your terminal will output something like this:

3. Customize Terraform settings

Storage account name (REQUIRED) The storage_account_name must be unique globally. Before running any Terraform commands, please change the default value of variable named storage_account_name in the ./azure/variables.tf file.
Key vault name (REQUIRED) The key_vault_name must be unique globally. Before running any Terraform commands, please change the default value of variable named key_vault_name in the ./azure/variables.tf file.
Virtual network name In the file ./azure/variables.tf, you can change the default value under app_name:
Docker image In the file ./azure/variables.tf, you can change the default value under docker_image:
Custom Docker imagesIf you previously tagged a Docker image you built when following this CI/CD guide, you must push that locally tagged Docker image to Azure Container Registry before deploying using Terraform.
Region In the file ./azure/main.tf, you can change the location value under resource_group:

More

Other variables defined in ./azure/variables.tf can also be customized to your needs.

Environment variables for application

Set your environment variables in your running cloud environment by adding the following under the resource named azurerm_container_group in the file ./azure/main.tf:

4. Deploy

  1. Change directory into scripts folder:
  2. Initialize Terraform
    A sample output could look like this:

    Terraform plan

    You can run the following command to see all the resources that will be created by Terraform: terraform plan By default, here are the resources that will be created.
  3. Deploy
    A sample output could look like this:
  4. In your browser, go to http://[IP_address]/.
    Change the IP_address to the IP address that was output in your terminal after successfully running terraform apply.

Updating Mage versions

After Mage is running in your cloud, you can update the Mage Docker image version by running the following command in your CLI tool:

Misc

Security

By default, terraform apply will attempt to add your current workstation’s IP address to the above mentioned security group. In order to access Mage on Azure from another local workstation, you must add that IP address to the security group named mage-data-prep-production-nsg-public.
Security group name Your security group might be named differently because you may have changed your virtual network name (e.g. app_name). The security group you must add the IP to will end with -nsg-public.

HTTPS enabling

TBD

Terminate all resources

If you want to delete all resources created from deploying, run the following command:
A sample output could look like this: