Skip to content
Merged
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ go.work.sum
*.key
build/
bins/
**/tmp/

# Claude Code settings
.claude/
30 changes: 30 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -144,3 +144,33 @@ 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)

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: generate-configs
$(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
15 changes: 14 additions & 1 deletion develop/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,20 @@

# 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`

### Logs

- To view container logs, run `docker logs <container name>`. 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
| Service | port | Connected to |
Expand Down
138 changes: 138 additions & 0 deletions develop/docker-compose/develop.docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
x-volumes: &x-volumes
- ./..:/etc/develop:ro

services:
temporal-left:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I followed existing semantics of some examples calling these "proxyLeft" and "proxyRight" - I'm not sure if this is our preferred semantic, especially when we introduce more than 2 proxy nodes.

Copy link
Collaborator

Choose a reason for hiding this comment

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

can we use temporal-a and temporal-b instead of left/right? a, b is normally we used to name clusters. same for proxy naming.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I agree, A/B is a better naming than right/left, and will scale out better. There's nothing special about the existing right/left naming.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed. There's a mismatch in the package between a/b and left/right - I saw left/right was used most-recently, so copied that.

I'll add consolidation of naming semantics as a follow-up PR.

image: temporalio/temporal:1.5.0
command:
- server
- start-dev
- --port
- "${TEMPORAL_INTERNAL_PORT}"
- --ip
- "0.0.0.0"
- --headless
- --namespace
- default
- --log-level
- warn
ports:
- "${TEMPORAL_LEFT_EXTERNAL_PORT}:${TEMPORAL_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-right:
image: temporalio/temporal:1.5.0
Copy link
Contributor Author

@liam-lowe liam-lowe Feb 19, 2026

Choose a reason for hiding this comment

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

For proper testing, will need to use a full temporal server setup - I don't believe cli development tool is sufficient, because I believe the server version is pinned.

command:
- server
- start-dev
- --port
- "${TEMPORAL_INTERNAL_PORT}"
- --ip
- "0.0.0.0"
- --headless
- --namespace
- default
- --log-level
- warn
ports:
- "${TEMPORAL_RIGHT_EXTERNAL_PORT}:${TEMPORAL_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-right:
build:
context: ../..
dockerfile: Dockerfile
environment:
CONFIG_YML: /etc/develop/docker-compose/tmp/develop.proxy-right.yaml
volumes: *x-volumes
ports:
- "${PROXY_RIGHT_EXTERNAL_PORT}:${PROXY_RIGHT_INTERNAL_PORT}"
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"
Comment on lines +83 to +86
Copy link
Contributor Author

Choose a reason for hiding this comment

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

As a followup - I'll add a more robust /healthcheck endpoint to proxy - this is a placeholder, and admittedly, not very useful

interval: 5s
timeout: 5s
retries: 30
start_period: 10s

proxy-left:
build:
context: ../..
dockerfile: Dockerfile
environment:
CONFIG_YML: /etc/develop/docker-compose/tmp/develop.proxy-left.yaml
volumes: *x-volumes
ports:
- "${PROXY_LEFT_EXTERNAL_PORT}:${PROXY_LEFT_INTERNAL_PORT}"
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
entrypoint: /bin/sh
networks:
- develop
depends_on:
proxy-left:
condition: service_healthy
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:
- /etc/develop/docker-compose/smoke-test.sh

networks:
develop:
driver: bridge
11 changes: 11 additions & 0 deletions develop/docker-compose/develop.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# 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
15 changes: 15 additions & 0 deletions develop/docker-compose/develop.proxy-left.tmpl.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
clusterConnections:
- name: "cluster-left"
local:
connectionType: "tcp"
tcpClient:
address: "temporal-left:${TEMPORAL_INTERNAL_PORT}"
tcpServer:
address: "0.0.0.0:${PROXY_LEFT_INTERNAL_PORT}"
remote:
connectionType: "mux-client"
muxCount: 1
muxAddressInfo:
address: "proxy-right:${PROXY_MUX_INTERNAL_PORT}"
profiling:
pprofAddress: "0.0.0.0:6060"
15 changes: 15 additions & 0 deletions develop/docker-compose/develop.proxy-right.tmpl.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
clusterConnections:
- name: "cluster-right"
local:
connectionType: "tcp"
tcpClient:
address: "temporal-right:${TEMPORAL_INTERNAL_PORT}"
tcpServer:
address: "0.0.0.0:${PROXY_RIGHT_INTERNAL_PORT}"
remote:
connectionType: "mux-server"
muxCount: 1
muxAddressInfo:
address: "0.0.0.0:${PROXY_MUX_INTERNAL_PORT}"
profiling:
pprofAddress: "0.0.0.0:6060"
25 changes: 25 additions & 0 deletions develop/docker-compose/smoke-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/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_INBOUND"
temporal operator cluster health --address "$TEMPORAL_RIGHT_INBOUND"

# cross-server proxy-left routes to temporal-right
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="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. 🚬"