Initial working config!
This commit is contained in:
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
.env
|
||||
24
README
Normal file
24
README
Normal file
@ -0,0 +1,24 @@
|
||||
# Temporal
|
||||
|
||||
Wiki Cafe's configuration for a Temporal deployment.
|
||||
|
||||
|
||||
## Deploying the app with Docker Swarm
|
||||
|
||||
Set the environment variables from the .env file during the shell session.
|
||||
|
||||
```
|
||||
set -a && source .env && set +a
|
||||
```
|
||||
|
||||
Set the secrets.
|
||||
|
||||
```
|
||||
printf "SECRET_HERE" | docker secret create SECRET_NAME -
|
||||
```
|
||||
|
||||
Deploy using the `-c` flag to specify one or multiple compose files.
|
||||
|
||||
```
|
||||
docker stack deploy temporal --detach=true -c compose.yaml
|
||||
```
|
||||
96
compose.yaml
Normal file
96
compose.yaml
Normal file
@ -0,0 +1,96 @@
|
||||
services:
|
||||
db:
|
||||
image: postgres:18.0
|
||||
environment:
|
||||
- POSTGRES_HOST_AUTH_METHOD=trust
|
||||
- POSTGRES_USER=temporal
|
||||
- POSTGRES_PASSWORD_FILE=/run/secrets/db_password
|
||||
- POSTGRES_DB=temporal
|
||||
networks:
|
||||
- internal
|
||||
volumes:
|
||||
- 'postgresql_data:/var/lib/postgresql/data'
|
||||
secrets:
|
||||
- db_password
|
||||
|
||||
temporal:
|
||||
image: temporalio/auto-setup:1.29.0
|
||||
depends_on:
|
||||
- db
|
||||
configs:
|
||||
- source: entrypoint
|
||||
target: /entrypoint.sh
|
||||
mode: 0555
|
||||
- source: dynamicconfig # This might be better as a volume
|
||||
target: /etc/temporal/config/dynamicconfig/development-sql.yaml
|
||||
entrypoint: /entrypoint.sh
|
||||
command: "autosetup"
|
||||
environment:
|
||||
- DB=postgres12
|
||||
- DB_PORT=5432
|
||||
- POSTGRES_USER=temporal
|
||||
- POSTGRES_PWD_FILE=/run/secrets/db_password # entrypoint.sh exports POSTGRES_PWD
|
||||
- POSTGRES_SEEDS=db
|
||||
- DYNAMIC_CONFIG_FILE_PATH=config/dynamicconfig/development-sql.yaml # What is this
|
||||
networks:
|
||||
- internal
|
||||
secrets:
|
||||
- db_password
|
||||
|
||||
admin-tools:
|
||||
image: temporalio/admin-tools:1.29
|
||||
depends_on:
|
||||
- temporal
|
||||
networks:
|
||||
- internal
|
||||
environment:
|
||||
- TEMPORAL_ADDRESS=temporal:7233
|
||||
- TEMPORAL_CLI_ADDRESS=temporal:7233
|
||||
|
||||
ui:
|
||||
image: temporalio/ui:2.41.0
|
||||
depends_on:
|
||||
- temporal
|
||||
networks:
|
||||
- internal
|
||||
- proxy
|
||||
# entrypoint: ["tail"]
|
||||
# command: ["-f", "/dev/null"]
|
||||
environment:
|
||||
- TEMPORAL_ADDRESS=temporal:7233
|
||||
- TEMPORAL_CORS_ORIGINS=https://${DOMAIN}
|
||||
- TEMPORAL_AUTH_ENABLED
|
||||
- TEMPORAL_AUTH_PROVIDER_URL
|
||||
- TEMPORAL_AUTH_ISSUER_URL
|
||||
- TEMPORAL_AUTH_CLIENT_ID
|
||||
- TEMPORAL_AUTH_CLIENT_SECRET
|
||||
- TEMPORAL_AUTH_CALLBACK_URL
|
||||
- TEMPORAL_AUTH_SCOPES
|
||||
- LOG_LEVEL=debug
|
||||
deploy:
|
||||
update_config:
|
||||
failure_action: rollback
|
||||
order: start-first
|
||||
labels:
|
||||
- "caddy=${DOMAIN}"
|
||||
- "caddy.reverse_proxy={{upstreams 8080}}"
|
||||
- "caddy.tls.on_demand="
|
||||
|
||||
secrets:
|
||||
db_password:
|
||||
external: true
|
||||
name: ${STACK_NAME}_db_password
|
||||
|
||||
volumes:
|
||||
postgresql_data:
|
||||
|
||||
networks:
|
||||
proxy:
|
||||
external: true
|
||||
internal:
|
||||
|
||||
configs:
|
||||
entrypoint:
|
||||
file: entrypoint.sh
|
||||
dynamicconfig:
|
||||
file: dynamicconfig/development-sql.yaml
|
||||
39
dynamicconfig/README.md
Normal file
39
dynamicconfig/README.md
Normal file
@ -0,0 +1,39 @@
|
||||
Use `docker.yaml` file to override the default dynamic config value (they are specified
|
||||
when creating the service config).
|
||||
|
||||
Each key can have zero or more values and each value can have zero or more
|
||||
constraints. There are only three types of constraint:
|
||||
1. `namespace`: `string`
|
||||
2. `taskQueueName`: `string`
|
||||
3. `taskType`: `int` (`1`:`Workflow`, `2`:`Activity`)
|
||||
A value will be selected and returned if all its has exactly the same constraints
|
||||
as the ones specified in query filters (including the number of constraints).
|
||||
|
||||
Please use the following format:
|
||||
```
|
||||
testGetBoolPropertyKey:
|
||||
- value: false
|
||||
- value: true
|
||||
constraints:
|
||||
namespace: "global-samples-namespace"
|
||||
- value: false
|
||||
constraints:
|
||||
namespace: "samples-namespace"
|
||||
testGetDurationPropertyKey:
|
||||
- value: "1m"
|
||||
constraints:
|
||||
namespace: "samples-namespace"
|
||||
taskQueueName: "longIdleTimeTaskqueue"
|
||||
testGetFloat64PropertyKey:
|
||||
- value: 12.0
|
||||
constraints:
|
||||
namespace: "samples-namespace"
|
||||
testGetMapPropertyKey:
|
||||
- value:
|
||||
key1: 1
|
||||
key2: "value 2"
|
||||
key3:
|
||||
- false
|
||||
- key4: true
|
||||
key5: 2.0
|
||||
```
|
||||
3
dynamicconfig/development-cass.yaml
Normal file
3
dynamicconfig/development-cass.yaml
Normal file
@ -0,0 +1,3 @@
|
||||
system.forceSearchAttributesCacheRefreshOnRead:
|
||||
- value: true # Dev setup only. Please don't turn this on in production.
|
||||
constraints: {}
|
||||
6
dynamicconfig/development-sql.yaml
Normal file
6
dynamicconfig/development-sql.yaml
Normal file
@ -0,0 +1,6 @@
|
||||
limit.maxIDLength:
|
||||
- value: 255
|
||||
constraints: {}
|
||||
system.forceSearchAttributesCacheRefreshOnRead:
|
||||
- value: true # Dev setup only. Please don't turn this on in production.
|
||||
constraints: {}
|
||||
0
dynamicconfig/docker.yaml
Normal file
0
dynamicconfig/docker.yaml
Normal file
27
entrypoint.sh
Normal file
27
entrypoint.sh
Normal file
@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
file_env() {
|
||||
local var="$1"
|
||||
local fileVar="${var}_FILE"
|
||||
|
||||
if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then
|
||||
echo >&2 "error: both $var and $fileVar are set (but are exclusive)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "${!var:-}" ]; then
|
||||
export "$var"="${!var}"
|
||||
elif [ "${!fileVar:-}" ]; then
|
||||
export "$var"="$(< "${!fileVar}")"
|
||||
else
|
||||
echo >&2 "error: neither $var nor $fileVar is set"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
unset "$fileVar"
|
||||
}
|
||||
|
||||
file_env POSTGRES_PWD
|
||||
|
||||
exec /etc/temporal/entrypoint.sh $@
|
||||
Reference in New Issue
Block a user