# Temporal Worker - Remaining Deployment Tasks This document outlines the remaining tasks needed to complete the temporal worker deployment to production. ## Phase 1: Infrastructure Preparation and Secret Setup (Partial) ### Vault Secrets Creation These secrets need to be created in Vault before deployment: 1. **INTERNAL_API_SHARED_SECRET** ```bash # Generate a secure 32+ character secret openssl rand -base64 32 # Store in Vault vault kv put secret/alga-psa/temporal-worker \ internal_api_shared_secret="" ``` 2. **ALGA_AUTH_KEY** ```bash # Verify this exists in shared secrets vault kv get secret/alga-psa/shared # If not present, generate and store openssl rand -base64 32 vault kv put secret/alga-psa/shared \ alga_auth_key="" ``` ### Vault Policy Creation Create the temporal-worker policy: ```hcl # temporal-worker-policy.hcl path "secret/data/alga-psa/temporal-worker" { capabilities = ["read"] } path "secret/data/alga-psa/shared" { capabilities = ["read"] } # Apply the policy vault policy write temporal-worker temporal-worker-policy.hcl ``` ### Kubernetes Service Account Configuration ```bash # The service account is created by Helm, but needs Vault annotation kubectl annotate serviceaccount alga-psa-temporal-worker \ -n msp \ vault.hashicorp.com/role=temporal-worker ``` ## Phase 3: Build and Registry Setup (Final Step) ### Initial Image Build Before first deployment, build and push the temporal worker image: ```bash # Submit the build workflow kubectl create -n argo -f - < 0.05 for: 10m annotations: summary: "High temporal workflow error rate" - alert: TemporalWorkerMemoryHigh expr: container_memory_usage_bytes{pod=~"alga-psa-temporal-worker.*"} / container_spec_memory_limit_bytes > 0.8 for: 5m annotations: summary: "Temporal worker memory usage is high" ``` ## Post-Deployment Verification After successful deployment: 1. **Check Logs** ```bash kubectl logs -n msp -l app.kubernetes.io/component=temporal-worker --tail=100 ``` 2. **Verify Workflows** - Test tenant provisioning workflow - Test email sending - Test checkout session handling 3. **Monitor Metrics** - CPU and memory usage should stabilize - No error logs should appear - Health checks should pass consistently ## Rollback Plan If issues occur: 1. **Automatic Rollback**: The deployment workflow includes automatic rollback on health check failure 2. **Manual Rollback**: ```bash helm rollback alga-psa -n msp ``` 3. **Disable Temporal Worker**: ```bash helm upgrade alga-psa ./helm \ -n msp \ -f hosted.values.yaml \ --set temporalWorker.enabled=false ```