simplify(infra): use temporalio/auto-setup instead of full server
Single container that auto-creates and migrates the schema against CNPG PostgreSQL. Built-in Web UI on 8233. No separate schema job, ConfigMap, or UI deployment needed. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -16,148 +16,7 @@ spec:
|
||||
postInitSQL:
|
||||
- CREATE DATABASE temporal_visibility OWNER temporal;
|
||||
---
|
||||
# Temporal server configuration
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: hightower-temporal-config
|
||||
namespace: hightower
|
||||
data:
|
||||
config.yaml: |
|
||||
log:
|
||||
stdout: true
|
||||
level: info
|
||||
persistence:
|
||||
defaultStore: default
|
||||
visibilityStore: visibility
|
||||
numHistoryShards: 4
|
||||
datastores:
|
||||
default:
|
||||
sql:
|
||||
pluginName: postgres12
|
||||
databaseName: temporal
|
||||
connectAddr: hightower-temporal-db-rw:5432
|
||||
connectProtocol: tcp
|
||||
user: temporal
|
||||
maxConns: 20
|
||||
maxIdleConns: 20
|
||||
visibility:
|
||||
sql:
|
||||
pluginName: postgres12
|
||||
databaseName: temporal_visibility
|
||||
connectAddr: hightower-temporal-db-rw:5432
|
||||
connectProtocol: tcp
|
||||
user: temporal
|
||||
maxConns: 10
|
||||
maxIdleConns: 10
|
||||
global:
|
||||
membership:
|
||||
maxJoinDuration: 30s
|
||||
broadcastAddress: "0.0.0.0"
|
||||
pprof:
|
||||
port: 7936
|
||||
services:
|
||||
frontend:
|
||||
rpc:
|
||||
grpcPort: 7233
|
||||
membershipPort: 6933
|
||||
bindOnIP: "0.0.0.0"
|
||||
history:
|
||||
rpc:
|
||||
grpcPort: 7234
|
||||
membershipPort: 6934
|
||||
bindOnIP: "0.0.0.0"
|
||||
matching:
|
||||
rpc:
|
||||
grpcPort: 7235
|
||||
membershipPort: 6935
|
||||
bindOnIP: "0.0.0.0"
|
||||
worker:
|
||||
rpc:
|
||||
grpcPort: 7239
|
||||
membershipPort: 6939
|
||||
bindOnIP: "0.0.0.0"
|
||||
clusterMetadata:
|
||||
enableGlobalNamespace: false
|
||||
failoverVersionIncrement: 10
|
||||
masterClusterName: active
|
||||
currentClusterName: active
|
||||
clusterInformation:
|
||||
active:
|
||||
enabled: true
|
||||
initialFailoverVersion: 1
|
||||
rpcName: frontend
|
||||
rpcAddress: "localhost:7233"
|
||||
dcRedirectionPolicy:
|
||||
policy: noop
|
||||
archival:
|
||||
status: disabled
|
||||
---
|
||||
# Schema init job — runs once to set up Temporal's database tables
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
name: hightower-temporal-schema-init
|
||||
namespace: hightower
|
||||
spec:
|
||||
backoffLimit: 10
|
||||
ttlSecondsAfterFinished: 300
|
||||
template:
|
||||
spec:
|
||||
restartPolicy: OnFailure
|
||||
initContainers:
|
||||
# Wait for CNPG database to be ready
|
||||
- name: wait-for-db
|
||||
image: busybox:1.37
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- |
|
||||
until nc -z hightower-temporal-db-rw 5432; do
|
||||
echo "Waiting for PostgreSQL..."
|
||||
sleep 2
|
||||
done
|
||||
echo "PostgreSQL is ready"
|
||||
containers:
|
||||
- name: schema-default
|
||||
image: temporalio/admin-tools:latest
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- |
|
||||
temporal-sql-tool \
|
||||
--plugin postgres12 \
|
||||
--ep hightower-temporal-db-rw \
|
||||
--port 5432 \
|
||||
--db temporal \
|
||||
--user temporal \
|
||||
setup-schema -v 0.0 && \
|
||||
temporal-sql-tool \
|
||||
--plugin postgres12 \
|
||||
--ep hightower-temporal-db-rw \
|
||||
--port 5432 \
|
||||
--db temporal \
|
||||
--user temporal \
|
||||
update-schema -d /etc/temporal/schema/postgresql/v12/temporal/versioned && \
|
||||
temporal-sql-tool \
|
||||
--plugin postgres12 \
|
||||
--ep hightower-temporal-db-rw \
|
||||
--port 5432 \
|
||||
--db temporal_visibility \
|
||||
--user temporal \
|
||||
setup-schema -v 0.0 && \
|
||||
temporal-sql-tool \
|
||||
--plugin postgres12 \
|
||||
--ep hightower-temporal-db-rw \
|
||||
--port 5432 \
|
||||
--db temporal_visibility \
|
||||
--user temporal \
|
||||
update-schema -d /etc/temporal/schema/postgresql/v12/visibility/versioned
|
||||
envFrom:
|
||||
- secretRef:
|
||||
name: hightower-temporal-db-app
|
||||
---
|
||||
# Temporal server deployment
|
||||
# Temporal auto-setup — handles schema creation/migration automatically
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
@@ -177,52 +36,49 @@ spec:
|
||||
spec:
|
||||
containers:
|
||||
- name: temporal
|
||||
image: temporalio/server:latest
|
||||
image: temporalio/auto-setup:latest
|
||||
ports:
|
||||
- containerPort: 7233
|
||||
name: grpc
|
||||
- containerPort: 8233
|
||||
name: web-ui
|
||||
env:
|
||||
- name: SERVICES
|
||||
value: frontend,history,matching,worker
|
||||
- name: TEMPORAL_STORE_PASSWORD
|
||||
- name: DB
|
||||
value: postgres12
|
||||
- name: DB_PORT
|
||||
value: "5432"
|
||||
- name: POSTGRES_SEEDS
|
||||
value: hightower-temporal-db-rw
|
||||
- name: DBNAME
|
||||
value: temporal
|
||||
- name: VISIBILITY_DBNAME
|
||||
value: temporal_visibility
|
||||
- name: POSTGRES_USER
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: hightower-temporal-db-app
|
||||
key: username
|
||||
- name: POSTGRES_PWD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: hightower-temporal-db-app
|
||||
key: password
|
||||
- name: TEMPORAL_VISIBILITY_STORE_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: hightower-temporal-db-app
|
||||
key: password
|
||||
volumeMounts:
|
||||
- name: config
|
||||
mountPath: /etc/temporal/config/dynamicconfig
|
||||
readOnly: true
|
||||
- name: server-config
|
||||
mountPath: /etc/temporal/config/config_template.yaml
|
||||
subPath: config.yaml
|
||||
readOnly: true
|
||||
- name: NUM_HISTORY_SHARDS
|
||||
value: "4"
|
||||
readinessProbe:
|
||||
tcpSocket:
|
||||
port: 7233
|
||||
initialDelaySeconds: 15
|
||||
initialDelaySeconds: 30
|
||||
periodSeconds: 10
|
||||
timeoutSeconds: 5
|
||||
failureThreshold: 10
|
||||
failureThreshold: 15
|
||||
resources:
|
||||
requests:
|
||||
memory: 512Mi
|
||||
cpu: 250m
|
||||
limits:
|
||||
memory: 1Gi
|
||||
volumes:
|
||||
- name: config
|
||||
emptyDir: {}
|
||||
- name: server-config
|
||||
configMap:
|
||||
name: hightower-temporal-config
|
||||
---
|
||||
# Temporal gRPC service
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
@@ -235,52 +91,6 @@ spec:
|
||||
- name: grpc
|
||||
port: 7233
|
||||
targetPort: 7233
|
||||
---
|
||||
# Temporal Web UI (optional)
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: hightower-temporal-ui
|
||||
namespace: hightower
|
||||
labels:
|
||||
app: hightower-temporal-ui
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: hightower-temporal-ui
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: hightower-temporal-ui
|
||||
spec:
|
||||
containers:
|
||||
- name: ui
|
||||
image: temporalio/ui:latest
|
||||
ports:
|
||||
- containerPort: 8233
|
||||
name: http
|
||||
env:
|
||||
- name: TEMPORAL_ADDRESS
|
||||
value: hightower-temporal:7233
|
||||
- name: TEMPORAL_UI_PORT
|
||||
value: "8233"
|
||||
resources:
|
||||
requests:
|
||||
memory: 64Mi
|
||||
cpu: 50m
|
||||
limits:
|
||||
memory: 128Mi
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: hightower-temporal-ui
|
||||
namespace: hightower
|
||||
spec:
|
||||
selector:
|
||||
app: hightower-temporal-ui
|
||||
ports:
|
||||
- name: http
|
||||
- name: web-ui
|
||||
port: 8233
|
||||
targetPort: 8233
|
||||
|
||||
Reference in New Issue
Block a user