Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

770 adjust db monitoring #3783

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions terraform/aks/application.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ module "web_application" {
kubernetes_config_map_name = module.application_configuration.kubernetes_config_map_name
kubernetes_secret_name = module.application_configuration.kubernetes_secret_name

docker_image = var.paas_app_docker_image
command = each.value.startup_command
max_memory = each.value.memory_max
replicas = each.value.replicas
docker_image = var.paas_app_docker_image
command = each.value.startup_command
max_memory = each.value.memory_max
replicas = each.value.replicas
web_external_hostnames = var.gov_uk_host_names
probe_path = each.value.probe_path
probe_path = each.value.probe_path
}

module "worker_application" {
Expand All @@ -39,10 +39,10 @@ module "worker_application" {
kubernetes_config_map_name = module.application_configuration.kubernetes_config_map_name
kubernetes_secret_name = module.application_configuration.kubernetes_secret_name

docker_image = var.paas_app_docker_image
command = each.value.startup_command
max_memory = each.value.memory_max
replicas = each.value.replicas
docker_image = var.paas_app_docker_image
command = each.value.startup_command
max_memory = each.value.memory_max
replicas = each.value.replicas
probe_command = each.value.probe_command
}

Expand Down
16 changes: 9 additions & 7 deletions terraform/aks/databases.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ module "redis-cache" {
cluster_configuration_map = module.cluster_data.configuration_map

use_azure = var.deploy_azure_backing_services
alert_window_size = var.alert_window_size
azure_enable_monitoring = var.enable_monitoring
azure_patch_schedule = [{ "day_of_week": "Sunday", "start_hour_utc": 01 }]
azure_patch_schedule = [{ "day_of_week" : "Sunday", "start_hour_utc" : 01 }]
}

module "redis-queue" {
Expand All @@ -32,7 +33,7 @@ module "redis-queue" {
use_azure = var.deploy_azure_backing_services
azure_enable_monitoring = var.enable_monitoring
azure_maxmemory_policy = "noeviction"
azure_patch_schedule = [{ "day_of_week": "Sunday", "start_hour_utc": 01 }]
azure_patch_schedule = [{ "day_of_week" : "Sunday", "start_hour_utc" : 01 }]
}

module "postgres" {
Expand All @@ -49,7 +50,7 @@ module "postgres" {

use_azure = var.deploy_azure_backing_services
azure_enable_monitoring = var.enable_monitoring
azure_extensions = ["PGCRYPTO","BTREE_GIST","CITEXT","PG_TRGM"]
azure_extensions = ["PGCRYPTO", "BTREE_GIST", "CITEXT", "PG_TRGM"]
server_version = var.postgres_version
azure_sku_name = var.postgres_flexible_server_sku

Expand All @@ -75,11 +76,12 @@ module "postgres_snapshot" {

use_azure = true
azure_enable_monitoring = var.enable_monitoring
azure_extensions = ["PGCRYPTO","BTREE_GIST","CITEXT","PG_TRGM"]
alert_window_size = var.alert_window_size
azure_extensions = ["PGCRYPTO", "BTREE_GIST", "CITEXT", "PG_TRGM"]
server_version = var.postgres_version
azure_sku_name = var.postgres_flexible_server_sku

azure_enable_high_availability = false
azure_maintenance_window = var.azure_maintenance_window
azure_enable_backup_storage = false
azure_enable_high_availability = false
azure_maintenance_window = var.azure_maintenance_window
azure_enable_backup_storage = false
}
2 changes: 1 addition & 1 deletion terraform/aks/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
output "url" {
value = { for k,v in module.web_application : k => "https://${v["hostname"]}/" }
value = { for k, v in module.web_application : k => "https://${v["hostname"]}/" }
}
2 changes: 1 addition & 1 deletion terraform/aks/provider.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ terraform {
version = "2.1.0"
}
kubernetes = {
source = "hashicorp/kubernetes"
source = "hashicorp/kubernetes"
version = "2.20.0"
}
}
Expand Down
16 changes: 8 additions & 8 deletions terraform/aks/terraform.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
# in Terraform for when we migrate the service away from GOV.UK PaaS

module "azure" {
source = "../modules/azure"
source = "../modules/azure"

environment_name = var.paas_app_environment
resource_group_name = var.azure_resource_group_name
tempdata_storage_account_name = var.azure_tempdata_storage_account_name
storage_account_replication_type = var.azure_storage_account_replication_type
region_name = var.azure_region_name
backend_resource_group_name = var.azure_resource_group_name
deploy_temp_data_storage_account = var.deploy_temp_data_storage_account
environment_name = var.paas_app_environment
resource_group_name = var.azure_resource_group_name
tempdata_storage_account_name = var.azure_tempdata_storage_account_name
storage_account_replication_type = var.azure_storage_account_replication_type
region_name = var.azure_region_name
backend_resource_group_name = var.azure_resource_group_name
deploy_temp_data_storage_account = var.deploy_temp_data_storage_account
}
34 changes: 18 additions & 16 deletions terraform/aks/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ variable "deploy_azure_backing_services" { default = true }

variable "enable_monitoring" { default = true }

variable "alert_window_size" { default = "PT5M" }

variable "db_sslmode" { default = "require" }

variable "azure_resource_prefix" {}
Expand All @@ -65,12 +67,12 @@ variable "pdb_min_available" { default = null }
variable "config_short" {}
variable "service_short" {}

variable paas_app_config_file { default = "workspace-variables/app_config.yml" }
variable env_config {}
variable "paas_app_config_file" { default = "workspace-variables/app_config.yml" }
variable "env_config" {}

variable "service_name" {}
variable "worker_apps" {
type = map(
type = map(
object({
startup_command = optional(list(string), [])
probe_command = optional(list(string), [])
Expand All @@ -81,7 +83,7 @@ variable "worker_apps" {
default = {}
}
variable "main_app" {
type = map(
type = map(
object({
startup_command = optional(list(string), [])
probe_path = optional(string, null)
Expand All @@ -98,7 +100,7 @@ variable "postgres_enable_high_availability" { default = false }
variable "azure_enable_backup_storage" { default = true }

locals {
app_name_suffix = var.app_name == null ? var.paas_app_environment : var.app_name
app_name_suffix = var.app_name == null ? var.paas_app_environment : var.app_name

cf_api_url = "https://api.london.cloud.service.gov.uk"
azure_credentials = try(jsondecode(var.azure_credentials), null)
Expand All @@ -110,23 +112,23 @@ locals {
app_env_values = merge(
local.base_url_env_var,
local.app_config,
# var.app_name_suffix != null ? local.review_url_vars : {},
# sslmode not defined in register database.yml?
# var.app_name_suffix != null ? local.review_url_vars : {},
# sslmode not defined in register database.yml?
{ DB_SSLMODE = var.db_sslmode }
)

cluster_name = "${module.cluster_data.configuration_map.resource_prefix}-aks"
cluster_name = "${module.cluster_data.configuration_map.resource_prefix}-aks"
app_resource_group_name = "${var.azure_resource_prefix}-${var.service_short}-${var.config_short}-rg"

# added for app module

app_secrets = merge(
local.kv_app_secrets,
{
DATABASE_URL = module.postgres.url
SETTINGS__BLAZER_DATABASE_URL = module.postgres.url
REDIS_QUEUE_URL = module.redis-queue.url
REDIS_CACHE_URL = module.redis-cache.url
DATABASE_URL = module.postgres.url
SETTINGS__BLAZER_DATABASE_URL = module.postgres.url
REDIS_QUEUE_URL = module.redis-queue.url
REDIS_CACHE_URL = module.redis-cache.url
},
var.snapshot_databases_to_deploy == 1 ? { ANALYSIS_DATABASE_URL = module.postgres_snapshot[0].url } : {}
)
Expand Down Expand Up @@ -163,12 +165,12 @@ locals {

### variable resource_group_name {}

variable azure_resource_group_name { default = null }
variable "azure_resource_group_name" { default = null }

variable azure_tempdata_storage_account_name { default = null }
variable "azure_tempdata_storage_account_name" { default = null }

variable azure_storage_account_replication_type { default = "LRS" }
variable "azure_storage_account_replication_type" { default = "LRS" }

variable azure_region_name { default = "uk south" }
variable "azure_region_name" { default = "uk south" }

variable "deploy_temp_data_storage_account" { default = true }
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"azure_tempdata_storage_account_name": "s189p01registerpdtmp",
"azure_resource_group_name": "s189p01-rtt-pd-rg",
"azure_storage_account_replication_type": "RAGRS",
"alert_window_size": "PT30M",
"gov_uk_host_names": [
"www.register-trainee-teachers.service.gov.uk",
"www.register-trainee-teachers.education.gov.uk"
Expand Down