move wrongmove to use db and set redis parameters [ci skip]

This commit is contained in:
Viktor Barzin 2025-06-30 20:43:07 +00:00
parent 31d0c084f4
commit a73e28eb4b
3 changed files with 46 additions and 8 deletions

View file

@ -101,6 +101,7 @@ variable "dawarich_database_password" {}
variable "geoapify_api_key" {} variable "geoapify_api_key" {}
variable "tandoor_database_password" {} variable "tandoor_database_password" {}
variable "n8n_postgresql_password" {} variable "n8n_postgresql_password" {}
variable "realestate_crawler_db_password" {}
# data "terraform_remote_state" "foo" { # data "terraform_remote_state" "foo" {
# backend = "kubernetes" # backend = "kubernetes"
@ -415,6 +416,8 @@ module "kubernetes_cluster" {
tandoor_email_password = var.mailserver_accounts["info@viktorbarzin.me"] tandoor_email_password = var.mailserver_accounts["info@viktorbarzin.me"]
n8n_postgresql_password = var.n8n_postgresql_password n8n_postgresql_password = var.n8n_postgresql_password
realestate_crawler_db_password = var.realestate_crawler_db_password
} }

View file

@ -81,6 +81,7 @@ variable "geoapify_api_key" {}
variable "tandoor_database_password" {} variable "tandoor_database_password" {}
variable "tandoor_email_password" {} variable "tandoor_email_password" {}
variable "n8n_postgresql_password" {} variable "n8n_postgresql_password" {}
variable "realestate_crawler_db_password" {}
variable "defcon_level" { variable "defcon_level" {
type = number type = number
@ -619,9 +620,15 @@ module "n8n" {
module "real-estate-crawler" { module "real-estate-crawler" {
source = "./real-estate-crawler" source = "./real-estate-crawler"
tls_secret_name = var.tls_secret_name tls_secret_name = var.tls_secret_name
db_password = var.realestate_crawler_db_password
} }
module "tor-proxy" { module "tor-proxy" {
source = "./tor-proxy" source = "./tor-proxy"
tls_secret_name = var.tls_secret_name tls_secret_name = var.tls_secret_name
} }
# module "onlyoffice" {
# source = "./onlyoffice"
# tls_secret_name = var.tls_secret_name
# }

View file

@ -1,4 +1,5 @@
variable "tls_secret_name" {} variable "tls_secret_name" {}
variable "db_password" {}
resource "kubernetes_namespace" "realestate-crawler" { resource "kubernetes_namespace" "realestate-crawler" {
metadata { metadata {
@ -115,9 +116,32 @@ resource "kubernetes_deployment" "realestate-crawler-api" {
container { container {
name = "realestate-crawler-ui" name = "realestate-crawler-ui"
image = "viktorbarzin/realestatecrawler:latest" image = "viktorbarzin/realestatecrawler:latest"
env {
name = "ENV"
value = "prod"
}
env {
name = "DB_CONNECTION_STRING"
value = "mysql://wrongmove:${var.db_password}@mysql.dbaas.svc.cluster.local:3306/wrongmove"
}
env {
name = "CELERY_BROKER_URL"
value = "redis://redis.redis.svc.cluster.local:6379/0"
}
env {
name = "CELERY_RESULT_BACKEND"
value = "redis://redis.redis.svc.cluster.local:6379/1"
}
env {
name = "UVICORN_LOG_LEVEL"
value = "debug"
}
port { port {
name = "http" name = "http"
container_port = 8000 container_port = 5001
protocol = "TCP" protocol = "TCP"
} }
volume_mount { volume_mount {
@ -151,7 +175,7 @@ resource "kubernetes_service" "realestate-crawler-api" {
} }
port { port {
port = 80 port = 80
target_port = 8000 target_port = 5001
} }
} }
} }
@ -242,13 +266,17 @@ resource "kubernetes_cron_job_v1" "scrape-rightmove" {
EOT EOT
] ]
env { env {
name = "HTTP_PROXY" name = "DB_CONNECTION_STRING"
value = "http://tor-proxy.tor-proxy:8118" value = "mysql://wrongmove:wrongmove@mysql.dbaas.svc.cluster.local:3306/wrongmove"
}
env {
name = "HTTPS_PROXY"
value = "http://tor-proxy.tor-proxy:8118"
} }
# env {
# name = "HTTP_PROXY"
# value = "http://tor-proxy.tor-proxy:8118"
# }
# env {
# name = "HTTPS_PROXY"
# value = "http://tor-proxy.tor-proxy:8118"
# }
volume_mount { volume_mount {
name = "data" name = "data"
mount_path = "/app/data" mount_path = "/app/data"