add wrongmove api endpoint and temporarily disable cronjob [ci skip]

This commit is contained in:
Viktor Barzin 2025-06-11 21:39:05 +00:00
parent 102984c7bf
commit 4f12df98e7
3 changed files with 68 additions and 10 deletions

View file

@ -79,8 +79,71 @@ module "ingress" {
name = "wrongmove"
service_name = "realestate-crawler-ui"
tls_secret_name = var.tls_secret_name
protected = true
}
resource "kubernetes_deployment" "realestate-crawler-api" {
metadata {
name = "realestate-crawler-api"
namespace = "realestate-crawler"
labels = {
app = "realestate-crawler-api"
}
}
spec {
replicas = 1
selector {
match_labels = {
app = "realestate-crawler-api"
}
}
template {
metadata {
labels = {
app = "realestate-crawler-api"
"kubernetes.io/cluster-service" = "true"
}
}
spec {
container {
name = "realestate-crawler-ui"
image = "viktorbarzin/realestatecrawler:latest"
port {
name = "http"
container_port = 8000
protocol = "TCP"
}
}
}
}
}
}
resource "kubernetes_service" "realestate-crawler-api" {
metadata {
name = "realestate-crawler-api"
namespace = "realestate-crawler"
labels = {
"app" = "realestate-crawler-api"
}
}
spec {
selector = {
app = "realestate-crawler-api"
}
port {
port = "80"
target_port = 8000
}
}
}
module "ingress-api" {
source = "../ingress_factory"
namespace = "realestate-crawler"
name = "wrongmove-api"
service_name = "realestate-crawler-api"
tls_secret_name = var.tls_secret_name
}
resource "kubernetes_cron_job_v1" "scrape-rightmove" {
@ -91,7 +154,7 @@ resource "kubernetes_cron_job_v1" "scrape-rightmove" {
spec {
concurrency_policy = "Replace"
failed_jobs_history_limit = 5
schedule = "0 0 * * *"
schedule = "0 0 1 * *"
starting_deadline_seconds = 10
successful_jobs_history_limit = 10
job_template {
@ -105,15 +168,10 @@ resource "kubernetes_cron_job_v1" "scrape-rightmove" {
container {
name = "scrape-rightmove"
image = "viktorbarzin/realestatecrawler:latest"
# command = ["/bin/sh", "-c", <<-EOT
# export now=$(date +"%Y_%m_%d_%H_%M")
# PGPASSWORD=${var.postgresql_password} pg_dumpall -h immich-postgresql -U immich > /backup/dump_$now.sql
# # Rotate - delete last log file
# cd /backup
# find . -name "dump_*.sql" -type f -mtime +14 -delete # 14 day retention of backups
# EOT
# ]
command = ["/bin/sh", "-c", <<-EOT
/app/runall.sh # Run the scrape script
EOT
]
env {
name = "HTTP_PROXY"
value = "http://tor-proxy.tor-proxy:8118"

Binary file not shown.

Binary file not shown.