Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 33 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -146,24 +146,31 @@ helm-example:
@echo "Example written to charts/s2s-proxy/example.yaml"

# Local development environment
DEVELOP_ENV_FILE = develop/docker-compose/develop.env
DOCKER_COMPOSE_FILE ?= ./develop/docker-compose/develop.docker-compose.yaml
DOCKER_COMPOSE = docker compose --file $(DOCKER_COMPOSE_FILE) --env-file $(DEVELOP_ENV_FILE)

PROXY_A_CONFIG_TMPL = develop/docker-compose/develop.proxy-a.tmpl.yaml
PROXY_B_CONFIG_TMPL = develop/docker-compose/develop.proxy-b.tmpl.yaml
PROMETHEUS_CONFIG_TMPL = develop/docker-compose/develop.prometheus.tmpl.yaml
PROXY_A_CONFIG = develop/docker-compose/tmp/develop.proxy-a.yaml
PROXY_B_CONFIG = develop/docker-compose/tmp/develop.proxy-b.yaml
PROMETHEUS_CONFIG = develop/docker-compose/tmp/develop.prometheus.yaml
DEVELOP_ENV_FILE = develop/docker-compose/develop.env
CORE_COMPOSE_FILE = develop/docker-compose/core.docker-compose.yaml
TEMPORAL_A_COMPOSE = develop/docker-compose/temporal-a.docker-compose.yaml
TEMPORAL_B_COMPOSE = develop/docker-compose/temporal-b.docker-compose.yaml

DOCKER_COMPOSE = docker compose \
--file $(CORE_COMPOSE_FILE) \
--file $(TEMPORAL_A_COMPOSE) \
--file $(TEMPORAL_B_COMPOSE) \
--env-file $(DEVELOP_ENV_FILE)

PROXY_A_CONFIG_TMPL = develop/docker-compose/develop.proxy-a.tmpl.yaml
PROXY_B_CONFIG_TMPL = develop/docker-compose/develop.proxy-b.tmpl.yaml
PROMETHEUS_CONFIG_TMPL = develop/docker-compose/develop.prometheus.tmpl.yaml
PROXY_A_CONFIG = develop/docker-compose/tmp/develop.proxy-a.yaml
PROXY_B_CONFIG = develop/docker-compose/tmp/develop.proxy-b.yaml
PROMETHEUS_CONFIG = develop/docker-compose/tmp/develop.prometheus.yaml

.PHONY: generate-configs
generate-configs:
mkdir -p develop/docker-compose/tmp
set -a && . $(DEVELOP_ENV_FILE) && set +a && \
envsubst < $(PROXY_A_CONFIG_TMPL) > $(PROXY_A_CONFIG) && \
envsubst < $(PROXY_B_CONFIG_TMPL) > $(PROXY_B_CONFIG) && \
envsubst < $(PROMETHEUS_CONFIG_TMPL) > $(PROMETHEUS_CONFIG)
envsubst < $(PROXY_B_CONFIG_TMPL) > $(PROXY_B_CONFIG) && \
envsubst < $(PROMETHEUS_CONFIG_TMPL) > $(PROMETHEUS_CONFIG)

.PHONY: show-dependencies-ports
show-dependencies-ports:
Expand All @@ -176,10 +183,23 @@ show-dependencies-ports:
printf " %-34s http://localhost:%s\n", tolower(name), $$2; \
}'

.PHONY: show-server-configuration
show-server-configuration:
@echo 'Temporal server versions:'
@printf ' %-16s' 'temporal-a:' && \
$(DOCKER_COMPOSE) exec -T temporal-a \
sh -c 'temporal operator cluster describe --address $$(hostname -i):7233 -o json 2>/dev/null | awk -F\" "/(serverVersion|server_version)/{print \$$4}"' \
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

serverVersion|server_version

For Temporal Server compatibility.

2>/dev/null || printf '(not running)\n'
@printf ' %-16s' 'temporal-b:' && \
$(DOCKER_COMPOSE) exec -T temporal-b \
sh -c 'temporal operator cluster describe --address $$(hostname -i):7233 -o json 2>/dev/null | awk -F\" "/(serverVersion|server_version)/{print \$$4}"' \
2>/dev/null || printf '(not running)\n'

.PHONY: start-dependencies
start-dependencies: generate-configs
$(DOCKER_COMPOSE) up --detach --build --wait --wait-timeout 120
$(DOCKER_COMPOSE) up --detach --build --wait --wait-timeout 300
@echo >&2 'Dependencies ready!'
@$(MAKE) --no-print-directory show-server-configuration
@$(MAKE) --no-print-directory show-dependencies-ports

.PHONY: stop-dependencies
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,74 +2,6 @@ x-volumes: &x-volumes
- ./..:/etc/develop:ro

services:
temporal-a:
image: temporalio/temporal:1.5.0
command:
- server
- start-dev
- --port
- "${TEMPORAL_INTERNAL_PORT}"
- --ip
- "0.0.0.0"
- --ui-port
- "${TEMPORAL_UI_INTERNAL_PORT}"
- --namespace
- default
- --log-level
- warn
ports:
- "${TEMPORAL_A_EXTERNAL_PORT}:${TEMPORAL_INTERNAL_PORT}"
- "${TEMPORAL_A_UI_EXTERNAL_PORT}:${TEMPORAL_UI_INTERNAL_PORT}"
networks:
- develop
healthcheck:
test:
- CMD
- temporal
- operator
- cluster
- health
- --address
- "localhost:${TEMPORAL_INTERNAL_PORT}"
interval: 5s
timeout: 5s
retries: 30
start_period: 5s

temporal-b:
image: temporalio/temporal:1.5.0
command:
- server
- start-dev
- --port
- "${TEMPORAL_INTERNAL_PORT}"
- --ip
- "0.0.0.0"
- --ui-port
- "${TEMPORAL_UI_INTERNAL_PORT}"
- --namespace
- default
- --log-level
- warn
ports:
- "${TEMPORAL_B_EXTERNAL_PORT}:${TEMPORAL_INTERNAL_PORT}"
- "${TEMPORAL_B_UI_EXTERNAL_PORT}:${TEMPORAL_UI_INTERNAL_PORT}"
networks:
- develop
healthcheck:
test:
- CMD
- temporal
- operator
- cluster
- health
- --address
- "localhost:${TEMPORAL_INTERNAL_PORT}"
interval: 5s
timeout: 5s
retries: 30
start_period: 5s

proxy-b:
build:
context: ../..
Expand Down Expand Up @@ -136,7 +68,7 @@ services:
condition: service_healthy

smoke-test:
image: temporalio/temporal:1.5.0
image: temporalio/admin-tools:${TEMPORAL_CLI_VERSION}
entrypoint: /bin/sh
networks:
- develop
Expand Down
13 changes: 13 additions & 0 deletions develop/docker-compose/develop.env
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
# Use temporalio/auto-setup tags: https://hub.docker.com/r/temporalio/auto-setup/tags
TEMPORAL_A_VERSION=1.29.4
TEMPORAL_B_VERSION=1.22.7
Comment on lines +2 to +3
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

example values - but these can connect ! (didn't validate a full replica)


# Use temporalio/admin-tools tags: https://hub.docker.com/r/temporalio/admin-tools/tags
# In general : use max(TEMPORAL_A_VERSION, TEMPORAL_B_VERSION)
TEMPORAL_CLI_VERSION=1.29.4

# Infrastructure versions
# TODO: currently shared by both servers, this could be independent.
POSTGRESQL_VERSION=16
ELASTICSEARCH_VERSION=7.17.27
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In future - could make this more configurable.

I think I'm avoiding making this too comprehensive. We'll need a more-robust test harness for validating version connectivity - and I don't think docker compose and shell scripts are the solution for that.

As a followup, I'll look into adding a testcontainers harness which iterates through Temporal Server versions (and later backend configurations) to validate different functionality (connectivity, unidirectional replica, bidirectional replica, etc)


# External Ports (exposed via localhost)
TEMPORAL_A_EXTERNAL_PORT=4000
TEMPORAL_B_EXTERNAL_PORT=5000
Expand Down
61 changes: 61 additions & 0 deletions develop/docker-compose/temporal-a.docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
services:
postgres-a:
image: postgres:${POSTGRESQL_VERSION}
environment:
POSTGRES_USER: temporal
POSTGRES_PASSWORD: temporal
networks:
- develop
healthcheck:
test: [CMD, pg_isready, -U, temporal]
interval: 5s
timeout: 5s
retries: 10

elasticsearch-a:
image: elasticsearch:${ELASTICSEARCH_VERSION}
environment:
discovery.type: single-node
xpack.security.enabled: "false"
ES_JAVA_OPTS: "-Xms256m -Xmx256m"
networks:
- develop
healthcheck:
test:
- CMD-SHELL
- "curl -s http://localhost:9200/_cluster/health | grep -qv '\"status\":\"red\"'"
interval: 10s
timeout: 5s
retries: 12

temporal-a:
image: temporalio/auto-setup:${TEMPORAL_A_VERSION}
environment:
DB: postgres12
DB_PORT: 5432
POSTGRES_SEEDS: postgres-a
POSTGRES_USER: temporal
POSTGRES_PWD: temporal
ENABLE_ES: "true"
ES_SEEDS: elasticsearch-a
ES_PORT: 9200
ES_VERSION: v7
VISIBILITY_TYPE: elasticsearch
ports:
- "${TEMPORAL_A_EXTERNAL_PORT}:${TEMPORAL_INTERNAL_PORT}"
- "${TEMPORAL_A_UI_EXTERNAL_PORT}:${TEMPORAL_UI_INTERNAL_PORT}"
networks:
- develop
depends_on:
postgres-a:
condition: service_healthy
elasticsearch-a:
condition: service_healthy
healthcheck:
test:
- CMD-SHELL
- "temporal operator cluster health --address $(hostname -i):${TEMPORAL_INTERNAL_PORT}"
interval: 5s
timeout: 5s
retries: 30
start_period: 30s
61 changes: 61 additions & 0 deletions develop/docker-compose/temporal-b.docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
services:
postgres-b:
image: postgres:${POSTGRESQL_VERSION}
environment:
POSTGRES_USER: temporal
POSTGRES_PASSWORD: temporal
networks:
- develop
healthcheck:
test: [CMD, pg_isready, -U, temporal]
interval: 5s
timeout: 5s
retries: 10

elasticsearch-b:
image: elasticsearch:${ELASTICSEARCH_VERSION}
environment:
discovery.type: single-node
xpack.security.enabled: "false"
ES_JAVA_OPTS: "-Xms256m -Xmx256m"
networks:
- develop
healthcheck:
test:
- CMD-SHELL
- "curl -s http://localhost:9200/_cluster/health | grep -qv '\"status\":\"red\"'"
interval: 10s
timeout: 5s
retries: 12

temporal-b:
image: temporalio/auto-setup:${TEMPORAL_B_VERSION}
environment:
DB: postgres12
DB_PORT: 5432
POSTGRES_SEEDS: postgres-b
POSTGRES_USER: temporal
POSTGRES_PWD: temporal
ENABLE_ES: "true"
ES_SEEDS: elasticsearch-b
ES_PORT: 9200
ES_VERSION: v7
VISIBILITY_TYPE: elasticsearch
ports:
- "${TEMPORAL_B_EXTERNAL_PORT}:${TEMPORAL_INTERNAL_PORT}"
- "${TEMPORAL_B_UI_EXTERNAL_PORT}:${TEMPORAL_UI_INTERNAL_PORT}"
networks:
- develop
depends_on:
postgres-b:
condition: service_healthy
elasticsearch-b:
condition: service_healthy
healthcheck:
test:
- CMD-SHELL
- "temporal operator cluster health --address $(hostname -i):${TEMPORAL_INTERNAL_PORT}"
interval: 5s
timeout: 5s
retries: 30
start_period: 30s