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

Add schedule for daily DB backup #910

Merged
merged 2 commits into from
Sep 18, 2023
Merged
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: 18 additions & 0 deletions .github/workflows/database-copy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Copy PAAS databases to AKS

on:
workflow_dispatch:
schedule:
- cron: "0 2 * * *" # 02:00 UTC

jobs:
restore_db:
name: Restore DB
strategy:
matrix:
environment: [dev]
max-parallel: 1
uses: ./.github/workflows/restore-paas-db-to-aks.yml
johnake marked this conversation as resolved.
Show resolved Hide resolved
with:
environment: ${{ matrix.environment }}
secrets: inherit
4 changes: 4 additions & 0 deletions .github/workflows/restore-paas-db-to-aks.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: Backup and restore Postgres DB from PAAS to AKS

on:
workflow_call:
inputs:
environment:
type: string
workflow_dispatch:
inputs:
environment:
Expand Down
21 changes: 19 additions & 2 deletions terraform/aks/application.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module "web_application" {
is_web = true

namespace = var.namespace
environment = var.app_environment
environment = local.environment
service_name = local.service_name

cluster_configuration_map = module.cluster_data.configuration_map
Expand All @@ -33,11 +33,28 @@ module "application_configuration" {
source = "./vendor/modules/aks//aks/application_configuration"

namespace = var.namespace
environment = var.app_environment
environment = local.environment
azure_resource_prefix = var.azure_resource_prefix
service_short = var.service_short
config_short = var.config_short
config_variables = { AKS_ENV_NAME = var.file_environment, EnableMetrics = false }
secret_variables = local.app_secrets
secret_key_vault_short = "app"
}

module "worker_application" {
source = "./vendor/modules/aks//aks/application"
name = "worker"
is_web = false
namespace = var.namespace
environment = local.environment
service_name = local.service_name
cluster_configuration_map = module.cluster_data.configuration_map
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 = ["bundle", "exec", "sidekiq", "-C", "./config/sidekiq.yml"]
probe_command = ["pgrep", "-f", "sidekiq"]
max_memory = var.worker_memory_max
replicas = var.worker_replicas
}
11 changes: 11 additions & 0 deletions terraform/aks/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,17 @@ variable "memory_max" {
description = "Max memory size"
}

variable "worker_replicas" {
default = 1
type = number
}

variable "worker_memory_max" {
default = "1Gi"
type = string
description = "Max memory size of worker"
}

variable "gov_uk_host_names" {
default = []
type = list(any)
Expand Down
Loading