1 min read

Staging Infrastructure

Prerequisites

Steps

  1. Clone https://github.com/poqcommerce/Poq.Terraform.git repo
  2. Go to [your client name]/staging folder
  3. 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_staging_westeurope" {
source = "../../modules/bfc/bfc_platform2"
client = "Your Client Name"
env = "staging"
location = "westeurope"
time_zone = "GMT Standard Time"
# Everything goes to a single RG
rg = {
name = "poq-yourclientname-staging-weu-rg"
}
# Single managed identity with AAD group to add it to
msi = {
name = "poq-yourclientname-staging-weu-id"
aad_group_name = "poq-yourclientname-staging-app"
}
# A list of app insights to create.
app_insights = [
{
name = "poq-yourclientname-staging-weu-appi"
}
]
# A list of app service plans to create.
app_service_plans = [
{
name = "poq-yourclientname-staging-weu-plan"
sku = {
tier = "Standard"
size = "S1"
}
auto_scaling = {
capacity_min = 1
capacity_default = 1
capacity_max = 2
ruleset_name = "staging_standard"
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-staging-weu-availability-ag"
action_group_short_name = "StagingP3" # this will show in SMS
slack_logic_app_name = "poq-yourclientname-staging-weu-availability-ag-slack-logic"
profile_name = "staging_standard"
enabled = true
}
]
app_alert_action_groups = [
{
action_group_name = "poq-yourclientname-staging-weu-app-ag"
action_group_short_name = "StgApp" # this will show in SMS
profile_name = "staging_standard"
enabled = true
},
{
action_group_name = "poq-yourclientname-staging-weu-app-info-ag"
action_group_short_name = "StagingInfo" # this will show in SMS
profile_name = "staging_standard_info"
enabled = true
},
]
app_services = [
{
name = "poq-yourclientname-staging-weu-app"
app_service_plan_name = "poq-yourclientname-staging-weu-plan"
app_insights_name = "poq-yourclientname-staging-weu-appi"
ASPNETCORE_ENVIRONMENT = "Staging"
# Required.
availability_alert = {
# Required.
enabled = true
# Required if enabled = true
action_group_name = "poq-yourclientname-staging-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-staging-weu-app-info-ag"
severity = 3
ignore_data_before = "2021-06-01T00:00:00Z"
}
alert_response_time = {
enabled = true
action_group_name = "poq-yourclientname-staging-weu-app-info-ag"
severity = 3
ignore_data_before = "2021-06-01T00:00:00Z"
}
alert_http_5xx = {
enabled = true
action_group_name = "poq-yourclientname-staging-weu-app-info-ag"
severity = 3
ignore_data_before = "2021-06-01T00:00:00Z"
}
},
]
}
# REDIS
resource "azurerm_redis_cache" "yourclientname_staging_westeurope" {
depends_on = [
module.yourclientname_staging_westeurope
]
name = "poq-yourclientname-staging-weu-redis"
location = module.yourclientname_staging_westeurope.location
resource_group_name = module.yourclientname_staging_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 {
}
}
  1. Replace yourClientName with proper client name everywhere in the file following the same naming convention, for ex: yourclientname -> amazingclient; Your Client Name -> Amazing Client
  2. Create PR
  3. Merge the PR
  4. 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.

See Next