1 min read
Production Infrastructure
Please note that in this tutorial we only create production infrastructure for the West EU region. Cross region infrastructure should be applied in the same manner.
Prerequisites
- Access to https://github.com/poqcommerce/Poq.Terraform.git repo
Steps
- Clone https://github.com/poqcommerce/Poq.Terraform.git repo
- Go to [your client name]/production folder
- Create loc-westeurope.tf file with following information:
# Naming conventions are per this doc: https://docs.google.com/document/d/1MaxlO83-sTT01tBHSoyxMm_rB0iKSa0_xzJ8Mm3rzE8/edit#heading=h.seqf5unbk7w3# # poq-purpose-env-location-resourceKind[instanceNumber]
module "yourclientname_prod_westeurope" { source = "../../modules/bfc/bfc_platform2"
client = "Your Client Name" env = "prod" location = "westeurope" time_zone = "GMT Standard Time"
# Everything goes to a single RG rg = { name = "poq-yourclientname-prod-weu-rg" }
# Single managed identity with AAD group to add it to msi = { name = "poq-yourclientname-prod-weu-id" aad_group_name = "poq-yourclientname-prod-app" }
# A list of app insights to create. app_insights = [ { name = "poq-yourclientname-prod-weu-appi" } ]
# A list of app service plans to create. app_service_plans = [ { name = "poq-yourclientname-prod-weu-plan" sku = { tier = "Standard" size = "S1" } auto_scaling = { capacity_min = 1 capacity_default = 1 capacity_max = 2 ruleset_name = "prod_standard_small" recurrence_profiles = [ { name = "Scheduled scale down" start_time = "22:00" end_time = "06:59" capacity_min = 1 capacity_max = 1 }, ] } } ]
# Option 1: Add to the BFC Platform module, and use like this. availability_alert_action_groups = [ { action_group_name = "poq-yourclientname-prod-weu-availability-ag" action_group_short_name = "ProdP3" # this will show in SMS slack_logic_app_name = "poq-yourclientname-prod-weu-availability-ag-slack-logic" profile_name = "prod_standard" enabled = true } ]
app_alert_action_groups = [ { action_group_name = "poq-yourclientname-prod-weu-app-ag" action_group_short_name = "ProdApp" # this will show in SMS profile_name = "prod_standard" enabled = true }, { action_group_name = "poq-yourclientname-prod-weu-app-info-ag" action_group_short_name = "ProdInfo" # this will show in SMS profile_name = "prod_standard_info" enabled = true }, ]
app_services = [ { name = "poq-yourclientname-prod-weu-app"
app_service_plan_name = "poq-yourclientname-prod-weu-plan" app_insights_name = "poq-yourclientname-prod-weu-appi" ASPNETCORE_ENVIRONMENT = "WestEurope" # Required. availability_alert = { # Required. enabled = true # Required if enabled = true action_group_name = "poq-yourclientname-prod-weu-availability-ag" # Optional, default is "" url_path = "" }
# For now set as informational and see how it goes. alert_failed_requests = { enabled = true action_group_name = "poq-yourclientname-prod-weu-app-info-ag" severity = 3 ignore_data_before = "2021-06-01T00:00:00Z" }
alert_response_time = { enabled = true action_group_name = "poq-yourclientname-prod-weu-app-info-ag" severity = 3 ignore_data_before = "2021-06-01T00:00:00Z" }
alert_http_5xx = { enabled = true action_group_name = "poq-yourclientname-prod-weu-app-info-ag" severity = 3 ignore_data_before = "2021-06-01T00:00:00Z" } }, ]}# REDISresource "azurerm_redis_cache" "yourclientname_prod_westeurope" { depends_on = [ module.yourclientname_prod_westeurope ] name = "poq-yourclientname-prod-weu-redis" location = module.yourclientname_prod_westeurope.location resource_group_name = module.yourclientname_prod_westeurope.rg.name capacity = 0 #Basic/Standard: 0-6, Premium: 1-5. Basic/Standard Capacity Sizes: 0 = 0.25GB, 1 = 1GB, 2 = 2.5GB, 3 = 6GB, 4 = 13GB, 5 = 26GB, 6 = 53GB. family = "C" #Basic/Standard: C, Premium: P. sku_name = "Basic" #Basic, Standard, Premium. enable_non_ssl_port = false minimum_tls_version = "1.2"
redis_configuration { }}
- Replace yourClientName with proper client name everywhere in the file following the same naming convention, for ex: yourclientname -> amazingclient; Your Client Name -> Amazing Client
- Create PR
- Merge the PR
- Apply terraform scripts. In order for terraform scripts to take action they need to be applied. We are still in the process of defining how to better setup this process. If you have access to terraform console you can apply scripts by yourself, if you do not have access you should reach out to your Poq contact to apply scripts for you.
Congratulations, you have successfully created infrastructure for the Staging environment.