Skip to content

Commit

Permalink
Merge pull request #99 from serlo/db-layer-remove
Browse files Browse the repository at this point in the history
feat!(staging): remove database layer
  • Loading branch information
hugotiburtino authored Jul 12, 2024
2 parents 0202ac4 + 616b374 commit f42e315
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 311 deletions.
14 changes: 3 additions & 11 deletions envs/staging/api.tf
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
locals {
api = {
image_tags = {
database_layer = "0.3.80-staging.0"
server = "staging"
api_db_migration = "1.2.0-staging.0"
api_db_migration = "1.2.0-staging.1"
}
}
}
Expand All @@ -27,6 +26,8 @@ module "api" {

environment = "staging"

serlo_org_database_url = "mysql://serlo:${var.athene2_database_password_default}@${module.mysql.database_private_ip_address}:3306/serlo?timezone=+00:00"

google_spreadsheet_api = {
active_donors = var.api_active_donors_google_spreadsheet_id
motivation = var.api_motivation_google_spreadsheet_id
Expand All @@ -43,15 +44,6 @@ module "api" {
redis_url = "redis://redis-master:6379"
slack_token = var.slack_token

database_layer = {
image_tag = local.api.image_tags.database_layer

database_url = "mysql://serlo:${var.athene2_database_password_default}@${module.mysql.database_private_ip_address}:3306/serlo"
database_max_connections = 25
sentry_dsn = "https://[email protected]/5649015"
metadata_api_last_changes_date = "2023-06-19T12:00:00Z"
}

db_migration = {
image_tag = local.api.image_tags.api_db_migration

Expand Down
22 changes: 0 additions & 22 deletions modules/api/database-layer/.terraform.lock.hcl

This file was deleted.

189 changes: 0 additions & 189 deletions modules/api/database-layer/main.tf

This file was deleted.

9 changes: 0 additions & 9 deletions modules/api/database-layer/versions.tf

This file was deleted.

97 changes: 36 additions & 61 deletions modules/api/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ variable "redis_url" {
type = string
}

variable "serlo_org_database_url" {
type = string
}

variable "server" {
description = "Configuration for server"
type = object({
Expand Down Expand Up @@ -91,17 +95,6 @@ variable "swr_queue_worker" {
})
}

variable "database_layer" {
type = object({
image_tag = string

database_url = string
database_max_connections = number
sentry_dsn = string
metadata_api_last_changes_date = string
})
}

variable "db_migration" {
type = object({
image_tag = string
Expand All @@ -113,21 +106,6 @@ module "secrets" {
source = "./secrets"
}

module "database_layer" {
source = "./database-layer"

namespace = var.namespace
image_tag = var.database_layer.image_tag
image_pull_policy = var.image_pull_policy
node_pool = var.node_pool

environment = var.environment
sentry_dsn = var.database_layer.sentry_dsn
serlo_org_database_url = var.database_layer.database_url
database_max_connections = var.database_layer.database_max_connections
metadata_api_last_changes_date = var.database_layer.metadata_api_last_changes_date
}

module "server" {
source = "./server"

Expand All @@ -136,29 +114,27 @@ module "server" {
image_pull_policy = var.image_pull_policy
node_pool = var.node_pool

environment = var.environment
log_level = var.log_level
redis_url = var.redis_url
secrets = module.secrets
sentry_dsn = var.server.sentry_dsn
# TODO: move the timezone query to the declaration of the variable after removing db layer, see #50
serlo_org_database_url = "${var.database_layer.database_url}?timezone=+00:00"
google_service_account = var.server.google_service_account
google_spreadsheet_api = var.google_spreadsheet_api
rocket_chat_api = var.rocket_chat_api
mailchimp_api = var.mailchimp_api
hydra_host = var.server.hydra_host
kratos_public_host = var.server.kratos_public_host
kratos_admin_host = var.server.kratos_admin_host
kratos_secret = var.server.kratos_secret
kratos_db_uri = var.server.kratos_db_uri
serlo_org_database_layer_host = module.database_layer.host
openai_api_key = var.server.openai_api_key
swr_queue_dashboard = var.server.swr_queue_dashboard
enmeshed_server_host = var.server.enmeshed_server_host
enmeshed_server_secret = var.server.enmeshed_server_secret
enmeshed_webhook_secret = var.server.enmeshed_webhook_secret
serlo_editor_testing_secret = var.server.serlo_editor_testing_secret
environment = var.environment
log_level = var.log_level
redis_url = var.redis_url
secrets = module.secrets
sentry_dsn = var.server.sentry_dsn
serlo_org_database_url = var.serlo_org_database_url
google_service_account = var.server.google_service_account
google_spreadsheet_api = var.google_spreadsheet_api
rocket_chat_api = var.rocket_chat_api
mailchimp_api = var.mailchimp_api
hydra_host = var.server.hydra_host
kratos_public_host = var.server.kratos_public_host
kratos_admin_host = var.server.kratos_admin_host
kratos_secret = var.server.kratos_secret
kratos_db_uri = var.server.kratos_db_uri
openai_api_key = var.server.openai_api_key
swr_queue_dashboard = var.server.swr_queue_dashboard
enmeshed_server_host = var.server.enmeshed_server_host
enmeshed_server_secret = var.server.enmeshed_server_secret
enmeshed_webhook_secret = var.server.enmeshed_webhook_secret
serlo_editor_testing_secret = var.server.serlo_editor_testing_secret
}

module "swr_queue_worker" {
Expand All @@ -169,18 +145,17 @@ module "swr_queue_worker" {
image_pull_policy = var.image_pull_policy
node_pool = var.node_pool

environment = var.environment
log_level = var.log_level
redis_url = var.redis_url
secrets = module.secrets
sentry_dsn = var.server.sentry_dsn
google_spreadsheet_api = var.google_spreadsheet_api
rocket_chat_api = var.rocket_chat_api
mailchimp_api = var.mailchimp_api
serlo_org_database_layer_host = module.database_layer.host
concurrency = var.swr_queue_worker.concurrency
# TODO: move the timezone query to the declaration of the variable after removing db layer, see #50
serlo_org_database_url = "${var.database_layer.database_url}?timezone=+00:00"
environment = var.environment
log_level = var.log_level
redis_url = var.redis_url
secrets = module.secrets
sentry_dsn = var.server.sentry_dsn
google_spreadsheet_api = var.google_spreadsheet_api
rocket_chat_api = var.rocket_chat_api
mailchimp_api = var.mailchimp_api
concurrency = var.swr_queue_worker.concurrency
serlo_org_database_url = var.serlo_org_database_url

}

module "api_db_migration" {
Expand Down
Loading

0 comments on commit f42e315

Please sign in to comment.