### Bash Script for PostgreSQL Schema Setup Source: https://context7.com/render-examples/temporal/llms.txt A bash script to automate the setup and migration of PostgreSQL schemas for Temporal. It includes functions to create the database if necessary and apply versioned schema updates using the temporal-sql-tool. ```bash #!/bin/bash # From auto-setup-override.sh setup_postgres_schema() { export SQL_PASSWORD=${POSTGRES_PWD} SCHEMA_DIR=${TEMPORAL_HOME}/schema/postgresql/v96/temporal/versioned # Create database if needed if [[ "${DBNAME}" != "${POSTGRES_USER}" && "${SKIP_POSTGRES_DB_CREATION}" != true ]]; then temporal-sql-tool --plugin postgres \ --ep "${POSTGRES_SEEDS}" \ -u "${POSTGRES_USER}" \ -p "${DB_PORT}" \ create --db "${DBNAME}" fi # Setup schema temporal-sql-tool --plugin postgres \ --ep "${POSTGRES_SEEDS}" \ -u "${POSTGRES_USER}" \ -p "${DB_PORT}" \ --db "${DBNAME}" \ setup-schema -v 0.0 # Apply migrations temporal-sql-tool --plugin postgres \ --ep "${POSTGRES_SEEDS}" \ -u "${POSTGRES_USER}" \ -p "${DB_PORT}" \ --db "${DBNAME}" \ update-schema -d "${SCHEMA_DIR}" } ``` -------------------------------- ### Temporal Server Dockerfile Configuration Source: https://context7.com/render-examples/temporal/llms.txt Defines the Docker image for the Temporal server, including configuration files for dynamic settings and cluster setup. It specifies the entrypoint for the server process. ```dockerfile FROM temporalio/server:1.14.3 COPY temporal-cluster/server/dynamicconfig.yaml /etc/temporal/dynamicconfig.yaml COPY temporal-cluster/server/dynamicconfig_es.yaml /etc/temporal/dynamicconfig_es.yaml COPY temporal-cluster/server/config_template.yaml /etc/temporal/config/config_template.yaml ENTRYPOINT ["bash", "-c", "PUBLIC_FRONTEND_ADDRESS=$TEMPORAL_FRONTEND_HOST:7233 /etc/temporal/entrypoint.sh"] ``` -------------------------------- ### Render Configuration for Sample Temporal App Workflow Trigger Source: https://context7.com/render-examples/temporal/llms.txt Deploys a sample Temporal application as a web service on Render. It specifies the repository, build and start commands, and environment variables, including the connection to the Temporal cluster host. ```yaml # Workflow trigger web service - type: web repo: https://github.com/render-examples/sample-temporal-app name: app-workflow-trigger env: go buildCommand: go build start/main.go startCommand: ./main envVars: - key: TEMPORAL_CLUSTER_HOST fromService: name: temporal-frontend property: host ``` -------------------------------- ### Temporal Web UI Dockerfile Configuration Source: https://context7.com/render-examples/temporal/llms.txt Defines the Docker image for the Temporal Web UI. It specifies the base image and the entrypoint command to start the Node.js server, connecting to the Temporal gRPC endpoint. ```dockerfile # temporal-cluster/web/Dockerfile FROM temporalio/web:1.13.0 ENTRYPOINT ["/bin/sh", "-c", "TEMPORAL_GRPC_ENDPOINT=$TEMPORAL_GRPC_HOST:7233 node server.js"] ``` -------------------------------- ### Setup Elasticsearch Index for Temporal Visibility (Bash) Source: https://context7.com/render-examples/temporal/llms.txt This script configures Elasticsearch for Temporal's visibility features. It sets up cluster settings, registers a Temporal visibility index template, and creates the index itself using provided credentials and version-specific schema files. It requires Elasticsearch connection details and Temporal home path as environment variables. ```bash setup_es_index() { ES_SERVER="${ES_SCHEME}://${ES_SEEDS%%,*}:${ES_PORT}" SETTINGS_FILE=${TEMPORAL_HOME}/schema/elasticsearch/visibility/cluster_settings_${ES_VERSION}.json TEMPLATE_URL="${ES_SERVER}/_template/temporal_visibility_v1_template" SCHEMA_FILE=${TEMPORAL_HOME}/schema/elasticsearch/visibility/index_template_${ES_VERSION}.json INDEX_URL="${ES_SERVER}/${ES_VIS_INDEX}" curl --fail --user "${ES_USER}":"${ES_PWD}" \ -X PUT "${SETTINGS_URL}" \ -H "Content-Type: application/json" \ --data-binary "@${SETTINGS_FILE}" curl --fail --user "${ES_USER}":"${ES_PWD}" \ -X PUT "${TEMPLATE_URL}" \ -H 'Content-Type: application/json' \ --data-binary "@${SCHEMA_FILE}" curl --user "${ES_USER}":"${ES_PWD}" \ -X PUT "${INDEX_URL}" } ``` -------------------------------- ### Elasticsearch Configuration File Source: https://context7.com/render-examples/temporal/llms.txt Configuration settings for an Elasticsearch cluster, specifying the cluster name, network host, and essential parameters for a single-node setup. ```yaml # temporal-cluster/elasticsearch/elasticsearch.yml cluster.name: "elastic" network.host: 0.0.0.0 ``` -------------------------------- ### Deploy Temporal via Git Clone Source: https://context7.com/render-examples/temporal/llms.txt Instructions for deploying the Temporal cluster using Git. This involves cloning the repository, customizing the `render.yaml` file as needed, and then pushing the changes to trigger a deployment via the Render Dashboard. ```bash git clone https://github.com/render-examples/temporal cd temporal # Customize render.yaml as needed git push origin main # Deploy via Render Dashboard -> New -> Blueprint ``` -------------------------------- ### Temporal Frontend Dockerfile Source: https://context7.com/render-examples/temporal/llms.txt Defines the Docker image for the Temporal frontend service. It uses the `temporalio/auto-setup` base image and copies necessary configuration files, including dynamic configuration and persistence templates, along with a custom auto-setup script. ```dockerfile # temporal-cluster/server/auto-setup/Dockerfile FROM temporalio/auto-setup:1.14.3 COPY temporal-cluster/server/dynamicconfig.yaml /etc/temporal/dynamicconfig.yaml COPY temporal-cluster/server/dynamicconfig_es.yaml /etc/temporal/dynamicconfig_es.yaml COPY temporal-cluster/server/config_template.yaml /etc/temporal/config/config_template.yaml COPY temporal-cluster/server/auto-setup/auto-setup-override.sh /etc/temporal/auto-setup.sh ``` -------------------------------- ### Initialize Temporal Server and Register Namespace (Bash) Source: https://context7.com/render-examples/temporal/llms.txt This script automates the initialization of the Temporal server, waits for it to become available, and registers the default namespace. It configures the Temporal CLI address based on Render environment variables and optionally skips default namespace creation and custom search attribute addition. ```bash # Render-specific configuration TEMPORAL_CLI_ADDRESS="${RENDER_SERVICE_NAME}:${FRONTEND_GRPC_PORT:-7233}" # Wait for server startup and configure setup_server(){ echo "Temporal CLI address: ${TEMPORAL_CLI_ADDRESS}." until tctl cluster health | grep SERVING; do echo "Waiting for Temporal server to start..." sleep 1 done echo "Temporal server started." # Register default namespace if [ "${SKIP_DEFAULT_NAMESPACE_CREATION}" != true ]; then tctl --ns "${DEFAULT_NAMESPACE}" namespace register \ --rd "${DEFAULT_NAMESPACE_RETENTION}" \ --desc "Default namespace for Temporal Server." fi # Add custom search attributes for Elasticsearch if [ "${SKIP_ADD_CUSTOM_SEARCH_ATTRIBUTES}" != true ]; then tctl --auto_confirm admin cluster add-search-attributes \ --name CustomKeywordField --type Keyword \ --name CustomTextField --type Text \ --name CustomIntField --type Int \ --name CustomDatetimeField --type Datetime \ --name CustomDoubleField --type Double \ --name CustomBoolField --type Bool fi } ``` -------------------------------- ### Render Configuration for Temporal Matching Service Source: https://context7.com/render-examples/temporal/llms.txt Sets up the Temporal matching service as a private service (pserv) on Render. This configuration utilizes the same Dockerfile as the Temporal server and defines environment variables, including a dependency on the Temporal frontend. ```yaml - type: pserv name: temporal-matching dockerfilePath: ./temporal-cluster/server/Dockerfile envVars: - key: SERVICES value: matching - key: TEMPORAL_FRONTEND_HOST fromService: name: temporal-frontend property: host ``` -------------------------------- ### Render Service Configuration for Temporal Web UI Source: https://context7.com/render-examples/temporal/llms.txt Configures the Temporal Web UI as a private service (pserv) on Render. It specifies the Dockerfile, plan, environment, and environment variables, including the port and connection details for the Temporal gRPC host. ```yaml - type: pserv name: temporal-ui plan: Starter env: docker dockerfilePath: ./temporal-cluster/web/Dockerfile envVars: - key: PORT value: 8088 - key: TEMPORAL_PERMIT_WRITE_API value: true - key: TEMPORAL_GRPC_HOST fromService: name: temporal-frontend property: host ``` -------------------------------- ### Render Blueprint Configuration (render.yaml) Source: https://context7.com/render-examples/temporal/llms.txt Defines the infrastructure for the Temporal cluster on Render, including databases, environment variables, and service components like frontend, matching, history, and worker services. It specifies scaling policies and resource allocation for each service. ```yaml databases: - name: temporal-db databaseName: temporal user: temporal plan: basic-256mb diskSizeGB: 1 region: oregon envVarGroups: - name: temporal-shared envVars: - key: DYNAMIC_CONFIG_FILE_PATH value: /etc/temporal/dynamicconfig_es.yaml - key: ENABLE_ES value: true - key: DB value: postgresql services: - type: pserv name: temporal-frontend plan: Starter region: oregon env: docker dockerfilePath: ./temporal-cluster/server/auto-setup/Dockerfile scaling: minInstances: 1 maxInstances: 3 targetMemoryPercent: 80 targetCPUPercent: 80 envVars: - fromGroup: temporal-shared - key: SERVICES value: frontend - key: POSTGRES_SEEDS fromDatabase: name: temporal-db property: host ``` -------------------------------- ### Dynamic Configuration Settings (dynamicconfig_es.yaml) Source: https://context7.com/render-examples/temporal/llms.txt Controls Temporal server behavior at runtime without requiring redeployment. This file enables Elasticsearch visibility features, sets persistence QPS limits, and configures default activity retry policies. ```yaml # Enable Elasticsearch advanced visibility system.advancedVisibilityWritingMode: - value: "on" constraints: {} system.enableReadVisibilityFromES: - value: true constraints: {} # Configure persistence QPS limits history.persistenceMaxQPS: - value: 3000 constraints: {} # Set retry policies history.defaultActivityRetryPolicy: - value: InitialIntervalInSeconds: 1 MaximumIntervalCoefficient: 100.0 BackoffCoefficient: 2.0 MaximumAttempts: 0 ``` -------------------------------- ### Elasticsearch Dockerfile Configuration Source: https://context7.com/render-examples/temporal/llms.txt Defines the Docker image for a single-node Elasticsearch cluster. It specifies the base image, copies the Elasticsearch configuration file, and sets the user for running the process. ```dockerfile # temporal-cluster/elasticsearch/Dockerfile FROM docker.elastic.co/elasticsearch/elasticsearch:7.16.2 COPY --chown=1000:0 temporal-cluster/elasticsearch/elasticsearch.yml /usr/share/elasticsearch/config/elasticsearch.yml RUN chmod g+ws /usr/share/elasticsearch/config USER 1000:0 ``` -------------------------------- ### Elasticsearch Visibility Configuration (config_template.yaml) Source: https://context7.com/render-examples/temporal/llms.txt Sets up Elasticsearch for advanced workflow visibility, enabling search and filtering capabilities. This configuration defines the Elasticsearch version, connection URL, credentials, and index names for visibility data. ```yaml datastores: es-visibility: elasticsearch: version: "v7" url: scheme: "http" host: "elasticsearch-host:9200" username: "elastic" password: "secret" indices: visibility: "temporal_visibility_v1_dev" ``` -------------------------------- ### Render Configuration for Temporal History Service Source: https://context7.com/render-examples/temporal/llms.txt Configures the Temporal history service as a private service (pserv) on Render. It specifies the Dockerfile, scaling parameters, and environment variables, including a dependency on the Temporal frontend service. ```yaml - type: pserv name: temporal-history dockerfilePath: ./temporal-cluster/server/Dockerfile scaling: minInstances: 1 maxInstances: 3 targetMemoryPercent: 80 targetCPUPercent: 80 envVars: - key: SERVICES value: history - key: TEMPORAL_FRONTEND_HOST fromService: name: temporal-frontend type: pserv property: host ``` -------------------------------- ### Render Service Definition for Elasticsearch Source: https://context7.com/render-examples/temporal/llms.txt Configures the Elasticsearch service on Render, including plan, environment, Dockerfile, disk allocation, and environment variables. It sets up disk watermarks and security configurations for a single-node cluster. ```yaml - type: pserv name: temporal-elasticsearch plan: Starter env: docker dockerfilePath: ./temporal-cluster/elasticsearch/Dockerfile disk: name: esdata mountPath: /usr/share/elasticsearch/data sizeGB: 10 envVars: - key: ES_JAVA_OPTS value: "-Xms100m -Xmx100m" - key: xpack.security.enabled value: true - key: ELASTIC_PASSWORD generateValue: true - key: cluster.routing.allocation.disk.watermark.low value: 512mb - key: cluster.routing.allocation.disk.watermark.high value: 256mb - key: discovery.type value: single-node ``` -------------------------------- ### PostgreSQL Persistence Configuration (config_template.yaml) Source: https://context7.com/render-examples/temporal/llms.txt Configures PostgreSQL as the persistence layer for Temporal. It specifies settings for the default and visibility stores, including connection details, pooling, and schema management. This ensures reliable data storage for workflow states. ```yaml persistence: numHistoryShards: 4 defaultStore: default advancedVisibilityStore: es-visibility datastores: default: sql: pluginName: "postgres" databaseName: "temporal" connectAddr: "postgres-host:5432" connectProtocol: "tcp" user: "temporal" password: "secret" maxConns: 20 maxIdleConns: 20 maxConnLifetime: "1h" ``` -------------------------------- ### Temporal Frontend Service Environment Variables Source: https://context7.com/render-examples/temporal/llms.txt Specifies the environment variables required for the Temporal frontend service. These variables configure the service type, database connection, Elasticsearch seeds, and control aspects like database creation skipping. ```yaml envVars: - key: SERVICES value: frontend - key: SKIP_POSTGRES_DB_CREATION value: true - key: DB value: postgresql - key: DBNAME value: temporal - key: POSTGRES_SEEDS value: postgres-host - key: ES_SEEDS value: elasticsearch-host ``` -------------------------------- ### Render Configuration for Temporal Worker Service Source: https://context7.com/render-examples/temporal/llms.txt Configures the Temporal worker service as a private service (pserv) on Render. It uses the Temporal server's Dockerfile and sets environment variables, including a dependency on the Temporal history service for background processing. ```yaml - type: pserv name: temporal-worker dockerfilePath: ./temporal-cluster/server/Dockerfile envVars: - key: SERVICES value: worker - key: DEPENDS_ON_HISTORY fromService: name: temporal-history property: host ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.