Skip to content

Commit 21ba633

Browse files
authored
Port Docker Compose examples (#119)
## What was changed - Ported Docker Compose examples from temporalio/docker-compose into new compose/ directory - Modified setup scripts to work with Temporal server versions before and after 1.30 - Added fallback from temporal-elasticsearch-tool (1.30+) to curl for ES/OpenSearch setup - Improved ES/OpenSearch readiness checks to wait for cluster health, not just port availability - Added CI workflow to test all compose configurations - Added validation container that verifies cluster health, namespace access, and workflow execution - Removed deprecated version tags from compose files ## Why? - Consolidates Docker Compose examples into this repo - Ensures compatibility across Temporal server versions (pre and post 1.30) - CI ensures compose examples stay functional across changes
1 parent 46eb61e commit 21ba633

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+12453
-22
lines changed

.github/actionlint-matcher.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"problemMatcher": [
3+
{
4+
"owner": "actionlint",
5+
"pattern": [
6+
{
7+
"regexp": "^(?:\\x1b\\[\\d+m)?(.+?)(?:\\x1b\\[\\d+m)*:(?:\\x1b\\[\\d+m)*(\\d+)(?:\\x1b\\[\\d+m)*:(?:\\x1b\\[\\d+m)*(\\d+)(?:\\x1b\\[\\d+m)*: (?:\\x1b\\[\\d+m)*(.+?)(?:\\x1b\\[\\d+m)* \\[(.+?)\\]$",
8+
"file": 1,
9+
"line": 2,
10+
"column": 3,
11+
"message": 4,
12+
"code": 5
13+
}
14+
]
15+
}
16+
]
17+
}

.github/workflows/compose.yaml

Lines changed: 173 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
1+
name: Test compose examples
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- 'compose/**'
7+
- '.github/workflows/compose.yaml'
8+
push:
9+
branches:
10+
- main
11+
paths:
12+
- 'compose/**'
13+
- '.github/workflows/compose.yaml'
14+
15+
permissions:
16+
contents: read
17+
18+
jobs:
19+
lint-actions:
20+
name: Lint GitHub Actions workflows
21+
runs-on: ubuntu-latest
22+
timeout-minutes: 5
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v6
26+
27+
- name: Lint actions
28+
run: |
29+
echo "::add-matcher::.github/actionlint-matcher.json"
30+
bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash)
31+
./actionlint -color
32+
shell: bash
33+
34+
compose-test:
35+
name: Test ${{ matrix.compose-file }}
36+
needs: lint-actions
37+
strategy:
38+
fail-fast: false
39+
matrix:
40+
compose-file:
41+
- docker-compose.yml
42+
- docker-compose-postgres.yml
43+
- docker-compose-mysql.yml
44+
- docker-compose-mysql-es.yml
45+
- docker-compose-cass-es.yml
46+
- docker-compose-postgres-opensearch.yml
47+
runs-on: ubuntu-latest
48+
timeout-minutes: 15
49+
steps:
50+
- name: Print build information
51+
env:
52+
HEAD_REF: ${{ github.head_ref }}
53+
REF: ${{ github.ref }}
54+
COMPOSE_FILE: ${{ matrix.compose-file }}
55+
run: echo "head_ref=$HEAD_REF ref=$REF compose=$COMPOSE_FILE"
56+
57+
- uses: actions/checkout@v6
58+
59+
- name: Start compose stack
60+
working-directory: compose
61+
run: docker compose -f ${{ matrix.compose-file }} up -d
62+
63+
- name: Run validation
64+
working-directory: compose
65+
run: |
66+
docker compose -f ${{ matrix.compose-file }} -f docker-compose-validate.yml up temporal-validate --exit-code-from temporal-validate
67+
68+
- name: Print all logs on failure
69+
if: failure()
70+
working-directory: compose
71+
run: |
72+
echo "=== Printing all container logs ==="
73+
docker compose -f ${{ matrix.compose-file }} ps -a
74+
docker compose -f ${{ matrix.compose-file }} logs
75+
76+
- name: Cleanup
77+
if: always()
78+
working-directory: compose
79+
run: docker compose -f ${{ matrix.compose-file }} -f docker-compose-validate.yml down -v
80+
81+
compose-tls-test:
82+
name: Test docker-compose-tls.yml
83+
needs: lint-actions
84+
runs-on: ubuntu-latest
85+
timeout-minutes: 20
86+
steps:
87+
- name: Print build information
88+
env:
89+
HEAD_REF: ${{ github.head_ref }}
90+
REF: ${{ github.ref }}
91+
run: echo "head_ref=$HEAD_REF ref=$REF compose=docker-compose-tls.yml"
92+
93+
- uses: actions/checkout@v6
94+
95+
- name: Generate TLS certificates
96+
working-directory: compose
97+
run: |
98+
docker build -t temporal_tls:test -f tls/Dockerfile.tls .
99+
mkdir -p .pki
100+
docker run --rm -v temporal_tls_pki:/pki -v "${PWD}"/.pki:/pki-out temporal_tls:test
101+
102+
- name: Build TLS images
103+
working-directory: compose
104+
run: COMPOSE_PROJECT_NAME=tls_test docker compose -f docker-compose-tls.yml build --no-cache
105+
106+
- name: Start TLS compose stack
107+
working-directory: compose
108+
run: COMPOSE_PROJECT_NAME=tls_test docker compose -f docker-compose-tls.yml up -d
109+
110+
- name: Run validation
111+
working-directory: compose
112+
run: |
113+
COMPOSE_PROJECT_NAME=tls_test docker compose -f docker-compose-tls.yml -f docker-compose-validate.yml up temporal-validate --exit-code-from temporal-validate
114+
115+
- name: Print all logs on failure
116+
if: failure()
117+
working-directory: compose
118+
run: |
119+
echo "=== Printing all container logs ==="
120+
COMPOSE_PROJECT_NAME=tls_test docker compose -f docker-compose-tls.yml ps -a
121+
COMPOSE_PROJECT_NAME=tls_test docker compose -f docker-compose-tls.yml logs
122+
123+
- name: Cleanup
124+
if: always()
125+
working-directory: compose
126+
run: |
127+
COMPOSE_PROJECT_NAME=tls_test docker compose -f docker-compose-tls.yml -f docker-compose-validate.yml down -v
128+
docker volume rm temporal_tls_pki || true
129+
rm -rf .pki
130+
131+
compose-multirole-test:
132+
name: Test docker-compose-multirole.yaml
133+
needs: lint-actions
134+
runs-on: ubuntu-latest
135+
timeout-minutes: 20
136+
steps:
137+
- name: Print build information
138+
env:
139+
HEAD_REF: ${{ github.head_ref }}
140+
REF: ${{ github.ref }}
141+
run: echo "head_ref=$HEAD_REF ref=$REF compose=docker-compose-multirole.yaml"
142+
143+
- uses: actions/checkout@v6
144+
145+
- name: Install loki Docker plugin
146+
run: docker plugin install grafana/loki-docker-driver:latest --alias loki --grant-all-permissions
147+
148+
- name: Start multirole compose stack
149+
working-directory: compose
150+
run: docker compose -f docker-compose-multirole.yaml up -d
151+
152+
- name: Run validation
153+
working-directory: compose
154+
run: |
155+
docker compose -f docker-compose-multirole.yaml -f docker-compose-validate-multirole.yml up temporal-validate --exit-code-from temporal-validate
156+
157+
- name: Verify temporal services are running
158+
working-directory: compose
159+
run: |
160+
docker compose -f docker-compose-multirole.yaml ps temporal-history temporal-frontend temporal-matching temporal-worker
161+
162+
- name: Print all logs on failure
163+
if: failure()
164+
working-directory: compose
165+
run: |
166+
echo "=== Printing all container logs ==="
167+
docker compose -f docker-compose-multirole.yaml ps -a
168+
docker compose -f docker-compose-multirole.yaml logs
169+
170+
- name: Cleanup
171+
if: always()
172+
working-directory: compose
173+
run: docker compose -f docker-compose-multirole.yaml -f docker-compose-validate-multirole.yml down -v

.github/workflows/extensibility.yaml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,14 @@ jobs:
1717
runs-on: ${{ matrix.os }}
1818
steps:
1919
- name: Print build information
20-
run: 'echo head_ref: ${{ github.head_ref }}, ref: ${{ github.ref }}, os: ${{ matrix.os }}'
21-
- uses: actions/checkout@v2
20+
env:
21+
HEAD_REF: ${{ github.head_ref }}
22+
REF: ${{ github.ref }}
23+
OS: ${{ matrix.os }}
24+
run: echo "head_ref=$HEAD_REF ref=$REF os=$OS"
25+
- uses: actions/checkout@v6
2226
- name: Set up Go
23-
uses: actions/setup-go@v3.0.0
27+
uses: actions/setup-go@v6
2428
with:
2529
go-version: '1.22'
2630
- name: build

.github/workflows/promql-to-dd-go_build-publish.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,21 @@ jobs:
1515

1616
steps:
1717
- name: Checkout
18-
uses: actions/checkout@v3
18+
uses: actions/checkout@v6
1919

2020
- name: Set up QEMU
21-
uses: docker/setup-qemu-action@v2
21+
uses: docker/setup-qemu-action@v3
2222

2323
- name: Set up Docker Buildx
24-
uses: docker/setup-buildx-action@v2
24+
uses: docker/setup-buildx-action@v3
2525

2626
- name: Log in to registry
2727
# This is where you will update the personal access token to GITHUB_TOKEN
2828
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin
2929

3030
- name: Setup Docker metadata
3131
id: meta
32-
uses: docker/metadata-action@v4
32+
uses: docker/metadata-action@v5
3333
with:
3434
images: |
3535
ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}
@@ -41,7 +41,7 @@ jobs:
4141
type=sha
4242
4343
- name: Build and Push
44-
uses: docker/build-push-action@v3
44+
uses: docker/build-push-action@v6
4545
with:
4646
context: cloud/observability/promql-to-dd-go
4747
tags: ${{ steps.meta.outputs.tags }}

.github/workflows/promql-to-dd-go_test.yaml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,14 @@ jobs:
1515
runs-on: ${{ matrix.os }}
1616
steps:
1717
- name: Print build information
18-
run: 'echo head_ref: ${{ github.head_ref }}, ref: ${{ github.ref }}, os: ${{ matrix.os }}'
19-
- uses: actions/checkout@v2
18+
env:
19+
HEAD_REF: ${{ github.head_ref }}
20+
REF: ${{ github.ref }}
21+
OS: ${{ matrix.os }}
22+
run: echo "head_ref=$HEAD_REF ref=$REF os=$OS"
23+
- uses: actions/checkout@v6
2024
- name: Set up Go
21-
uses: actions/setup-go@v3.0.0
25+
uses: actions/setup-go@v6
2226
with:
2327
go-version: '1.20'
2428
- name: build

.github/workflows/promql-to-scrape.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ jobs:
2424

2525
steps:
2626
- name: Checkout
27-
uses: actions/checkout@v3
27+
uses: actions/checkout@v6
2828

2929
- name: Set up QEMU
30-
uses: docker/setup-qemu-action@v2
30+
uses: docker/setup-qemu-action@v3
3131

3232
- name: Set up Docker Buildx
33-
uses: docker/setup-buildx-action@v2
33+
uses: docker/setup-buildx-action@v3
3434

3535
- name: Login to GitHub Container Registry
3636
uses: docker/login-action@v3
@@ -41,7 +41,7 @@ jobs:
4141

4242
- name: Setup Docker metadata
4343
id: meta
44-
uses: docker/metadata-action@v4
44+
uses: docker/metadata-action@v5
4545
with:
4646
images: |
4747
ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}
@@ -53,7 +53,7 @@ jobs:
5353
type=sha
5454
5555
- name: Build and Push
56-
uses: docker/build-push-action@v3
56+
uses: docker/build-push-action@v6
5757
with:
5858
context: cloud/observability/promql-to-scrape
5959
tags: ${{ steps.meta.outputs.tags }}

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# Temporal Customization Samples
2-
These samples show how to customize Temporal server for specific production scenarios.
1+
# Temporal Server Samples
2+
These samples show how to run and customize Temporal server for local development and production scenarios.
33

44
Learn more about Temporal at:
55
* Documentation: https://docs.temporal.io
@@ -16,6 +16,7 @@ Please follow instructions from README.md file in every sample directory.
1616

1717
## Samples
1818

19+
- **[Docker Compose](./compose/)**: docker-compose files to run a local Temporal Server with various database and dependency configurations (PostgreSQL, MySQL, Cassandra, Elasticsearch, OpenSearch).
1920
- **[TLS](./tls/)**: how to configure Transport Layer Security (TLS) to secure network communication with and within Temporal cluster.
2021
- **[Authorizer](./extensibility/authorizer)**: how to inject a low-level authorizer component that can control access to all API calls.
2122

compose/.env

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
COMPOSE_PROJECT_NAME=temporal
2+
CASSANDRA_VERSION=3.11.9
3+
ELASTICSEARCH_VERSION=7.17.27
4+
MYSQL_VERSION=8
5+
TEMPORAL_VERSION=1.29.1
6+
TEMPORAL_ADMINTOOLS_VERSION=1.29.1-tctl-1.18.4-cli-1.5.0
7+
TEMPORAL_UI_VERSION=2.34.0
8+
POSTGRESQL_VERSION=16
9+
POSTGRES_PASSWORD=temporal
10+
POSTGRES_USER=temporal
11+
POSTGRES_DEFAULT_PORT=5432
12+
OPENSEARCH_VERSION=2.5.0

0 commit comments

Comments
 (0)