From 02e28294e94d0eb6c744a0803e33f26bb10a5a66 Mon Sep 17 00:00:00 2001 From: Viktor Barzin Date: Sat, 9 May 2026 09:16:07 +0000 Subject: [PATCH] =?UTF-8?q?postiz:=20idempotent=20Job=20to=20drop=20defaul?= =?UTF-8?q?t=20Text=20search=20attributes=20(Temporal=20SQL=20visibility?= =?UTF-8?q?=20caps=20at=203=20Text=20attrs;=20auto-setup=20ships=20with=20?= =?UTF-8?q?2,=20Postiz=20adds=202=20more=20=E2=80=94=20gitroomhq/postiz-ap?= =?UTF-8?q?p#1504)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- stacks/postiz/modules/postiz/main.tf | 49 ++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/stacks/postiz/modules/postiz/main.tf b/stacks/postiz/modules/postiz/main.tf index 96e19555..e628bad3 100644 --- a/stacks/postiz/modules/postiz/main.tf +++ b/stacks/postiz/modules/postiz/main.tf @@ -377,3 +377,52 @@ resource "kubernetes_service" "temporal" { } } } + +# One-shot Job: remove the two default Text-typed search attributes +# (CustomTextField, CustomStringField) that temporalio/auto-setup ships +# with. Postiz needs to register `organizationId` + `postId`, and SQL +# visibility caps at 3 Text attributes total — without this, Postiz's +# NestJS bootstrap crashes with "cannot have more than 3 search attribute +# of type Text" and the backend never starts. +# Upstream issue: https://github.com/gitroomhq/postiz-app/issues/1504 +resource "kubernetes_job" "temporal_search_attr_cleanup" { + metadata { + name = "temporal-search-attr-cleanup" + namespace = kubernetes_namespace.postiz.metadata[0].name + } + spec { + backoff_limit = 30 + ttl_seconds_after_finished = 300 + template { + metadata {} + spec { + restart_policy = "OnFailure" + container { + name = "cleanup" + image = "temporalio/auto-setup:1.28.1" + command = ["/bin/sh", "-c"] + args = [ + <<-EOT + set -e + # Wait for Temporal to be reachable (auto-setup may take 30s). + for i in $(seq 1 60); do + if temporal --address temporal:7233 operator search-attribute list >/dev/null 2>&1; then break; fi + sleep 5 + done + for attr in CustomTextField CustomStringField; do + if temporal --address temporal:7233 operator search-attribute list 2>/dev/null | grep -q "$attr"; then + temporal --address temporal:7233 operator search-attribute remove --name "$attr" --yes + fi + done + EOT + ] + } + } + } + } + wait_for_completion = false + lifecycle { + ignore_changes = [spec[0].template[0].spec[0].dns_config] # KYVERNO_LIFECYCLE_V1 + } + depends_on = [kubernetes_deployment.temporal] +}