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

Jfrog: Migrate pgsql to flex server #2034

Open
6 tasks
Souheil-Yazji opened this issue Mar 4, 2025 · 2 comments
Open
6 tasks

Jfrog: Migrate pgsql to flex server #2034

Souheil-Yazji opened this issue Mar 4, 2025 · 2 comments
Assignees
Labels
kind/feature New feature or request

Comments

@Souheil-Yazji
Copy link
Contributor

Souheil-Yazji commented Mar 4, 2025

cc. @Karivenu

We need to migrate the Jfrog pgSQL server from single to flex server before march 28.

To Do

  • Create new pgsql flex server resource using Azurerm
  • Migrate the data from the old pgsql server to the new one
  • Configure Jfrog to correctly use this resource (Since this will be live migration, create an announcement for possible service disruption)
  • Verify that Jfrog works as intended (both Artifactory and X-ray don't have problems)
  • Document work done
  • Update Github Ticket

Resources

You can find the new modules for flexible servers here https://gitlab.k8s.cloud.statcan.ca/managed-databases/flexible-server/terraform-azurerm-flex-postgresql

Once you have one created, you can follow one of the following mechanisms to migrate data.

https://learn.microsoft.com/en-us/azure/postgresql/migrate/migration-service/tutorial-migration-service-single-to-flexible?tabs=portal%2Coffline

https://learn.microsoft.com/en-us/azure/postgresql/migrate/how-to-migrate-using-dump-and-restore?tabs=psql

@Souheil-Yazji Souheil-Yazji added the kind/feature New feature or request label Mar 4, 2025
@EveningStarlight EveningStarlight self-assigned this Mar 5, 2025
@EveningStarlight
Copy link
Contributor

Changes between our current single module and the new flexible module

They build off of azurerm_postgresql_server and azurerm_postgresql_flexible_server respectively.

source:
source = "./modules/terraform-azurerm-postgresql" ->
source = "git::https://gitlab.k8s.cloud.statcan.ca/managed-databases/flexible-server/terraform-azurerm-flex-postgresql.git?ref=v0.5.0"

Remapped

administrator_login_password -> administrator_password
keyvault_enable -> kv_pointer_enable

Reformatted

database_names(list) -> databases(map(map(string)))

Administrator Group:
active_directory_administrator_object_id(string) and active_directory_administrator_tenant_id(string) ->
active_directory_administrator(list(object({}))

client_min_messages part of postgresql_configurations(map)

Removed items

Hard coded as part of key_vault.tf
key_type = "RSA-HSM"
key_size = 2048

ssl_enforcement_enabled and ssl_minimal_tls_version_enforced are not inputs for azurerm_postgresql_flexible_server and are removed.
min_tls_version -> hard coded in source module
threat_detection_policy isn't an input for azurerm_postgresql_flexible_server, this originally contained emails

Storage Account

The new terraform module handles the creation of it's own Storage account. So some things are moved there

All settings moved to codeblock in module

  # Storage Account Settings
  storage_account_name = "${var.prefix}-sa-jfrog"
  ip_rules             = var.infrastructure_authorized_ip_ranges
  sa_subnet_ids        = concat([data.azurerm_subnet.aks_system.id], var.infrastructure_pipeline_subnet_ids)
  sa_create_log        = true

Conflicts:
The redundancy is hard coded and cannot be changed.
account_replication_type = "ZRS" -> account_replication_type = "LRS"

Cannot create container named artifactory" in SA. Can set sa_create_log = true` to create a container for diagnostic logging, currently I've enabled this feature.

Key Vault Key

The new terraform module handles the creation of it's own Key Vault Key. So some things are moved there

Conflicts:
Name changed: "${var.prefix}-key-jfrog-storage" -> "${var.name}-key-cmk"
Key Size: key_size = "4096" -> key_size = "2048"

Customer Managed Key

Breaking
azurerm_storage_account_customer_managed_key isn't defined in the module, and the module outputs are not enough to create it.
If needed, we might need to look into fetching ids off names.

resource "azurerm_storage_account_customer_managed_key" "jfrog" {
  storage_account_id = module.jfrog_storage_account.id
  key_vault_id       = azurerm_key_vault.keys.id
  key_name           = azurerm_key_vault_key.jfrog_storage.name
}

Key Vault Access Policy

azurerm_key_vault_access_policy is included in the module.

Conflicts:
Additional permission: "List"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants