From 404e78cbcd9e4fb9587b6214791c9b9b0ef73853 Mon Sep 17 00:00:00 2001 From: Liam Lowe Date: Wed, 18 Feb 2026 13:54:27 -0800 Subject: [PATCH 1/2] Add development docker-compose environment --- Makefile | 18 +++ develop/README.md | 10 +- .../develop.docker-compose.yaml | 133 ++++++++++++++++++ develop/docker-compose/develop.env | 4 + .../docker-compose/develop.proxy-left.yaml | 15 ++ .../docker-compose/develop.proxy-right.yaml | 15 ++ develop/docker-compose/smoke-test.sh | 20 +++ 7 files changed, 214 insertions(+), 1 deletion(-) create mode 100644 develop/docker-compose/develop.docker-compose.yaml create mode 100644 develop/docker-compose/develop.env create mode 100644 develop/docker-compose/develop.proxy-left.yaml create mode 100644 develop/docker-compose/develop.proxy-right.yaml create mode 100755 develop/docker-compose/smoke-test.sh diff --git a/Makefile b/Makefile index 4e5a870..8b2c4a4 100644 --- a/Makefile +++ b/Makefile @@ -144,3 +144,21 @@ helm-test: helm-example: cd charts; helm template example ./s2s-proxy -f ./s2s-proxy/values.example.yaml > s2s-proxy/example.yaml @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) + +.PHONY: start-dependencies +start-dependencies: + $(DOCKER_COMPOSE) up --detach --build --wait --wait-timeout 120 + @echo >&2 'Dependencies ready!' + +.PHONY: stop-dependencies +stop-dependencies: + $(DOCKER_COMPOSE) down --timeout 60 + +.PHONY: nuke-dependencies +nuke-dependencies: + $(DOCKER_COMPOSE) down --timeout 60 --volumes --remove-orphans diff --git a/develop/README.md b/develop/README.md index 28548af..2154b03 100644 --- a/develop/README.md +++ b/develop/README.md @@ -10,7 +10,15 @@ # How-Tos -## Setup a local proxy pair with two Temporal clusters +## Setup a local proxy pair with two Temporal clusters (docker compose) + +### Steps + +1. To start the development environment: `make start-dependencies` +2. Done! Run tests against these services. The default ports are specified in an [environment file](docker-compose/develop.env) +3. To stop the development environment: `make stop-dependencies` + +## Setup a local proxy pair with two Temporal clusters (manual) ### Ports | Service | port | Connected to | diff --git a/develop/docker-compose/develop.docker-compose.yaml b/develop/docker-compose/develop.docker-compose.yaml new file mode 100644 index 0000000..292d5c5 --- /dev/null +++ b/develop/docker-compose/develop.docker-compose.yaml @@ -0,0 +1,133 @@ +x-volumes: &x-volumes + - ./..:/etc/develop:ro + +services: + temporal-left: + image: temporalio/temporal:1.5.0 + command: + - server + - start-dev + - --port + - "7233" + - --ip + - "0.0.0.0" + - --headless + - --namespace + - default + - --log-level + - warn + ports: + - "${TEMPORAL_LEFT_PORT}:7233" + networks: + - develop + healthcheck: + test: + - CMD + - temporal + - operator + - cluster + - health + - --address + - "localhost:7233" + interval: 5s + timeout: 5s + retries: 30 + start_period: 5s + + temporal-right: + image: temporalio/temporal:1.5.0 + command: + - server + - start-dev + - --port + - "7233" + - --ip + - "0.0.0.0" + - --headless + - --namespace + - default + - --log-level + - warn + ports: + - "${TEMPORAL_RIGHT_PORT}:7233" + networks: + - develop + healthcheck: + test: + - CMD + - temporal + - operator + - cluster + - health + - --address + - "localhost:7233" + interval: 5s + timeout: 5s + retries: 30 + start_period: 5s + + proxy-right: + build: + context: ../.. + dockerfile: Dockerfile + environment: + CONFIG_YML: /etc/develop/docker-compose/develop.proxy-right.yaml + volumes: *x-volumes + ports: + - "${PROXY_RIGHT_PORT}:6333" + networks: + - develop + depends_on: + temporal-right: + condition: service_healthy + healthcheck: # TODO: Replace with healthcheck endpoint. + test: + - CMD-SHELL + - "wget -q -O /dev/null -T 3 http://localhost:6060/debug/pprof/ || exit 1" + interval: 5s + timeout: 5s + retries: 30 + start_period: 10s + + proxy-left: + build: + context: ../.. + dockerfile: Dockerfile + environment: + CONFIG_YML: /etc/develop/docker-compose/develop.proxy-left.yaml + volumes: *x-volumes + ports: + - "${PROXY_LEFT_PORT}:6233" + networks: + - develop + depends_on: + temporal-left: + condition: service_healthy + proxy-right: + condition: service_healthy + healthcheck: # TODO: Replace with healthcheck endpoint. + test: + - CMD-SHELL + - "wget -q -O /dev/null -T 3 http://localhost:6060/debug/pprof/ || exit 1" + interval: 5s + timeout: 5s + retries: 30 + start_period: 10s + + smoke-test: + image: temporalio/temporal:1.5.0 + networks: + - develop + depends_on: + proxy-left: + condition: service_healthy + proxy-right: + condition: service_healthy + volumes: *x-volumes + command: + - sh + - /etc/develop/docker-compose/smoke-test.sh + +networks: + develop: + driver: bridge diff --git a/develop/docker-compose/develop.env b/develop/docker-compose/develop.env new file mode 100644 index 0000000..e52f35b --- /dev/null +++ b/develop/docker-compose/develop.env @@ -0,0 +1,4 @@ +TEMPORAL_LEFT_PORT=4000 +TEMPORAL_RIGHT_PORT=5000 +PROXY_LEFT_PORT=4001 +PROXY_RIGHT_PORT=5001 diff --git a/develop/docker-compose/develop.proxy-left.yaml b/develop/docker-compose/develop.proxy-left.yaml new file mode 100644 index 0000000..ac6d37d --- /dev/null +++ b/develop/docker-compose/develop.proxy-left.yaml @@ -0,0 +1,15 @@ +clusterConnections: + - name: "cluster-left" + local: + connectionType: "tcp" + tcpClient: + address: "temporal-left:7233" + tcpServer: + address: "0.0.0.0:6233" + remote: + connectionType: "mux-client" + muxCount: 1 + muxAddressInfo: + address: "proxy-right:6334" +profiling: + pprofAddress: "0.0.0.0:6060" diff --git a/develop/docker-compose/develop.proxy-right.yaml b/develop/docker-compose/develop.proxy-right.yaml new file mode 100644 index 0000000..1626f4d --- /dev/null +++ b/develop/docker-compose/develop.proxy-right.yaml @@ -0,0 +1,15 @@ +clusterConnections: + - name: "cluster-right" + local: + connectionType: "tcp" + tcpClient: + address: "temporal-right:7233" + tcpServer: + address: "0.0.0.0:6333" + remote: + connectionType: "mux-server" + muxCount: 1 + muxAddressInfo: + address: "0.0.0.0:6334" +profiling: + pprofAddress: "0.0.0.0:6060" diff --git a/develop/docker-compose/smoke-test.sh b/develop/docker-compose/smoke-test.sh new file mode 100755 index 0000000..11a8341 --- /dev/null +++ b/develop/docker-compose/smoke-test.sh @@ -0,0 +1,20 @@ +#!/bin/sh +set -e + +sleep 20 # TODO: remove after addition of reliable s2s-proxy healthcheck endpoint. + +# connectivity (also covered by docker-compose healthcheck) +temporal operator cluster health --address temporal-left:7233 +temporal operator cluster health --address temporal-right:7233 + +# cross-server proxy-left routes to temporal-right +NS_L="proxy-left-$$" +temporal operator namespace create "$NS_L" --retention 24h --address temporal-right:7233 +temporal operator namespace describe "$NS_L" --address proxy-left:6233 + +# cross-server proxy-right routes to temporal-left +NS_R="proxy-right-$$" +temporal operator namespace create "$NS_R" --retention 24h --address temporal-left:7233 +temporal operator namespace describe "$NS_R" --address proxy-right:6333 + +echo "smoke tests succeeded. 🚬" From 939f234e781b880cfff85f4ca9dd100012a486b1 Mon Sep 17 00:00:00 2001 From: Liam Lowe Date: Thu, 19 Feb 2026 14:13:47 -0800 Subject: [PATCH 2/2] Add outbound route test, and inbound port variable cleanup --- .gitignore | 1 + Makefile | 14 +++++++++- develop/README.md | 5 ++++ .../develop.docker-compose.yaml | 27 +++++++++++-------- develop/docker-compose/develop.env | 15 ++++++++--- ...left.yaml => develop.proxy-left.tmpl.yaml} | 6 ++--- ...ght.yaml => develop.proxy-right.tmpl.yaml} | 6 ++--- develop/docker-compose/smoke-test.sh | 21 +++++++++------ 8 files changed, 65 insertions(+), 30 deletions(-) rename develop/docker-compose/{develop.proxy-left.yaml => develop.proxy-left.tmpl.yaml} (58%) rename develop/docker-compose/{develop.proxy-right.yaml => develop.proxy-right.tmpl.yaml} (59%) diff --git a/.gitignore b/.gitignore index 92da579..2d6a65b 100644 --- a/.gitignore +++ b/.gitignore @@ -32,6 +32,7 @@ go.work.sum *.key build/ bins/ +**/tmp/ # Claude Code settings .claude/ diff --git a/Makefile b/Makefile index 8b2c4a4..e320b73 100644 --- a/Makefile +++ b/Makefile @@ -150,8 +150,20 @@ 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_LEFT_CONFIG_TMPL = develop/docker-compose/develop.proxy-left.tmpl.yaml +PROXY_RIGHT_CONFIG_TMPL = develop/docker-compose/develop.proxy-right.tmpl.yaml +PROXY_LEFT_CONFIG = develop/docker-compose/tmp/develop.proxy-left.yaml +PROXY_RIGHT_CONFIG = develop/docker-compose/tmp/develop.proxy-right.yaml + +.PHONY: generate-configs +generate-configs: + mkdir -p develop/docker-compose/tmp + set -a && . $(DEVELOP_ENV_FILE) && set +a && \ + envsubst < $(PROXY_LEFT_CONFIG_TMPL) > $(PROXY_LEFT_CONFIG) && \ + envsubst < $(PROXY_RIGHT_CONFIG_TMPL) > $(PROXY_RIGHT_CONFIG) + .PHONY: start-dependencies -start-dependencies: +start-dependencies: generate-configs $(DOCKER_COMPOSE) up --detach --build --wait --wait-timeout 120 @echo >&2 'Dependencies ready!' diff --git a/develop/README.md b/develop/README.md index 2154b03..194f2dc 100644 --- a/develop/README.md +++ b/develop/README.md @@ -18,6 +18,11 @@ 2. Done! Run tests against these services. The default ports are specified in an [environment file](docker-compose/develop.env) 3. To stop the development environment: `make stop-dependencies` +### Logs + +- To view container logs, run `docker logs `. For example `docker logs docker-compose-smoke-test-1`. +- To find container name, run `docker ps -a`, or grep for specific compose service name, e.g. `docker ps -a | grep smoke-test` + ## Setup a local proxy pair with two Temporal clusters (manual) ### Ports diff --git a/develop/docker-compose/develop.docker-compose.yaml b/develop/docker-compose/develop.docker-compose.yaml index 292d5c5..38bf814 100644 --- a/develop/docker-compose/develop.docker-compose.yaml +++ b/develop/docker-compose/develop.docker-compose.yaml @@ -8,7 +8,7 @@ services: - server - start-dev - --port - - "7233" + - "${TEMPORAL_INTERNAL_PORT}" - --ip - "0.0.0.0" - --headless @@ -17,7 +17,7 @@ services: - --log-level - warn ports: - - "${TEMPORAL_LEFT_PORT}:7233" + - "${TEMPORAL_LEFT_EXTERNAL_PORT}:${TEMPORAL_INTERNAL_PORT}" networks: - develop healthcheck: @@ -28,7 +28,7 @@ services: - cluster - health - --address - - "localhost:7233" + - "localhost:${TEMPORAL_INTERNAL_PORT}" interval: 5s timeout: 5s retries: 30 @@ -40,7 +40,7 @@ services: - server - start-dev - --port - - "7233" + - "${TEMPORAL_INTERNAL_PORT}" - --ip - "0.0.0.0" - --headless @@ -49,7 +49,7 @@ services: - --log-level - warn ports: - - "${TEMPORAL_RIGHT_PORT}:7233" + - "${TEMPORAL_RIGHT_EXTERNAL_PORT}:${TEMPORAL_INTERNAL_PORT}" networks: - develop healthcheck: @@ -60,7 +60,7 @@ services: - cluster - health - --address - - "localhost:7233" + - "localhost:${TEMPORAL_INTERNAL_PORT}" interval: 5s timeout: 5s retries: 30 @@ -71,10 +71,10 @@ services: context: ../.. dockerfile: Dockerfile environment: - CONFIG_YML: /etc/develop/docker-compose/develop.proxy-right.yaml + CONFIG_YML: /etc/develop/docker-compose/tmp/develop.proxy-right.yaml volumes: *x-volumes ports: - - "${PROXY_RIGHT_PORT}:6333" + - "${PROXY_RIGHT_EXTERNAL_PORT}:${PROXY_RIGHT_INTERNAL_PORT}" networks: - develop depends_on: @@ -94,10 +94,10 @@ services: context: ../.. dockerfile: Dockerfile environment: - CONFIG_YML: /etc/develop/docker-compose/develop.proxy-left.yaml + CONFIG_YML: /etc/develop/docker-compose/tmp/develop.proxy-left.yaml volumes: *x-volumes ports: - - "${PROXY_LEFT_PORT}:6233" + - "${PROXY_LEFT_EXTERNAL_PORT}:${PROXY_LEFT_INTERNAL_PORT}" networks: - develop depends_on: @@ -116,6 +116,7 @@ services: smoke-test: image: temporalio/temporal:1.5.0 + entrypoint: /bin/sh networks: - develop depends_on: @@ -124,8 +125,12 @@ services: proxy-right: condition: service_healthy volumes: *x-volumes + environment: + TEMPORAL_LEFT_INBOUND: "temporal-left:${TEMPORAL_INTERNAL_PORT}" + TEMPORAL_RIGHT_INBOUND: "temporal-right:${TEMPORAL_INTERNAL_PORT}" + PROXY_LEFT_OUTBOUND: "proxy-left:${PROXY_LEFT_INTERNAL_PORT}" + PROXY_RIGHT_OUTBOUND: "proxy-right:${PROXY_RIGHT_INTERNAL_PORT}" command: - - sh - /etc/develop/docker-compose/smoke-test.sh networks: diff --git a/develop/docker-compose/develop.env b/develop/docker-compose/develop.env index e52f35b..4d2655a 100644 --- a/develop/docker-compose/develop.env +++ b/develop/docker-compose/develop.env @@ -1,4 +1,11 @@ -TEMPORAL_LEFT_PORT=4000 -TEMPORAL_RIGHT_PORT=5000 -PROXY_LEFT_PORT=4001 -PROXY_RIGHT_PORT=5001 +# External Ports (exposed via localhost) +TEMPORAL_LEFT_EXTERNAL_PORT=4000 +TEMPORAL_RIGHT_EXTERNAL_PORT=5000 +PROXY_LEFT_EXTERNAL_PORT=4001 +PROXY_RIGHT_EXTERNAL_PORT=5001 + +# Internal Ports (exposed on containers in docker network) +TEMPORAL_INTERNAL_PORT=7233 +PROXY_LEFT_INTERNAL_PORT=6233 +PROXY_RIGHT_INTERNAL_PORT=6333 +PROXY_MUX_INTERNAL_PORT=6334 diff --git a/develop/docker-compose/develop.proxy-left.yaml b/develop/docker-compose/develop.proxy-left.tmpl.yaml similarity index 58% rename from develop/docker-compose/develop.proxy-left.yaml rename to develop/docker-compose/develop.proxy-left.tmpl.yaml index ac6d37d..c235578 100644 --- a/develop/docker-compose/develop.proxy-left.yaml +++ b/develop/docker-compose/develop.proxy-left.tmpl.yaml @@ -3,13 +3,13 @@ clusterConnections: local: connectionType: "tcp" tcpClient: - address: "temporal-left:7233" + address: "temporal-left:${TEMPORAL_INTERNAL_PORT}" tcpServer: - address: "0.0.0.0:6233" + address: "0.0.0.0:${PROXY_LEFT_INTERNAL_PORT}" remote: connectionType: "mux-client" muxCount: 1 muxAddressInfo: - address: "proxy-right:6334" + address: "proxy-right:${PROXY_MUX_INTERNAL_PORT}" profiling: pprofAddress: "0.0.0.0:6060" diff --git a/develop/docker-compose/develop.proxy-right.yaml b/develop/docker-compose/develop.proxy-right.tmpl.yaml similarity index 59% rename from develop/docker-compose/develop.proxy-right.yaml rename to develop/docker-compose/develop.proxy-right.tmpl.yaml index 1626f4d..d723078 100644 --- a/develop/docker-compose/develop.proxy-right.yaml +++ b/develop/docker-compose/develop.proxy-right.tmpl.yaml @@ -3,13 +3,13 @@ clusterConnections: local: connectionType: "tcp" tcpClient: - address: "temporal-right:7233" + address: "temporal-right:${TEMPORAL_INTERNAL_PORT}" tcpServer: - address: "0.0.0.0:6333" + address: "0.0.0.0:${PROXY_RIGHT_INTERNAL_PORT}" remote: connectionType: "mux-server" muxCount: 1 muxAddressInfo: - address: "0.0.0.0:6334" + address: "0.0.0.0:${PROXY_MUX_INTERNAL_PORT}" profiling: pprofAddress: "0.0.0.0:6060" diff --git a/develop/docker-compose/smoke-test.sh b/develop/docker-compose/smoke-test.sh index 11a8341..f94ef21 100755 --- a/develop/docker-compose/smoke-test.sh +++ b/develop/docker-compose/smoke-test.sh @@ -4,17 +4,22 @@ set -e sleep 20 # TODO: remove after addition of reliable s2s-proxy healthcheck endpoint. # connectivity (also covered by docker-compose healthcheck) -temporal operator cluster health --address temporal-left:7233 -temporal operator cluster health --address temporal-right:7233 +temporal operator cluster health --address "$TEMPORAL_LEFT_INBOUND" +temporal operator cluster health --address "$TEMPORAL_RIGHT_INBOUND" # cross-server proxy-left routes to temporal-right -NS_L="proxy-left-$$" -temporal operator namespace create "$NS_L" --retention 24h --address temporal-right:7233 -temporal operator namespace describe "$NS_L" --address proxy-left:6233 +NS_L="smoketest-left-$$" +temporal operator namespace create "$NS_L" --retention 24h --address "$TEMPORAL_RIGHT_INBOUND" +temporal operator namespace describe "$NS_L" --address "$PROXY_LEFT_OUTBOUND" # cross-server proxy-right routes to temporal-left -NS_R="proxy-right-$$" -temporal operator namespace create "$NS_R" --retention 24h --address temporal-left:7233 -temporal operator namespace describe "$NS_R" --address proxy-right:6333 +NS_R="smoketest-right-$$" +temporal operator namespace create "$NS_R" --retention 24h --address "$TEMPORAL_LEFT_INBOUND" +temporal operator namespace describe "$NS_R" --address "$PROXY_RIGHT_OUTBOUND" + +# outbound route is routed through each proxy +# TODO: for strong validation - after migrating off of temporal cli dev server, we can override and check the cluster name (currently both are named 'active') +temporal operator cluster describe --address "$PROXY_LEFT_OUTBOUND" +temporal operator cluster describe --address "$PROXY_RIGHT_OUTBOUND" echo "smoke tests succeeded. 🚬"