Skip to content

Commit 26b2022

Browse files
committed
Initial commit
0 parents  commit 26b2022

17 files changed

+1092
-0
lines changed

.gitignore

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Binaries for programs and plugins
2+
*.exe
3+
*.exe~
4+
*.dll
5+
*.so
6+
*.dylib
7+
8+
# Test binary, built with `go test -c`
9+
*.test
10+
11+
# Output of the go coverage tool, specifically when used with LiteIDE
12+
*.out
13+
14+
# Dependency directories (remove the comment below to include it)
15+
# vendor/

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2022, Render Developers
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Temporal
2+
3+
This is a template for running a production-ready Temporal cluster on Render. The setup supports independent autoscaling for each Temporal service (frontend, matching, history, worker), has [advanced visibility](https://docs.temporal.io/docs/content/what-is-advanced-visibility/) backed by Elasticsearch, and includes an example Go app to trigger and run workflows. Create a new repo using this template, and then click the button below to try it out:
4+
5+
[![Deploy to Render](https://render.com/images/deploy-to-render-button.svg)](https://render.com/deploy)
6+
7+
For deploy instructions, see our [Temporal guide](https://render.com/docs/deploy-temporal).
8+
9+
# Acknowledgements
10+
11+
[auto-setup-override.sh](temporal-cluster/server/auto-setup/auto-setup-override.sh) is based on Temporal's [auto-setup.sh script](https://github.com/temporalio/temporal/blob/077d39c775/docker/auto-setup.sh), with some modifications made to better accommodate Render's architecture.

assets/temporal-shell.png

118 KB
Loading

assets/worker-logs.png

239 KB
Loading

render.yaml

+291
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,291 @@
1+
databases:
2+
- name: temporal-db
3+
databaseName: temporal
4+
user: temporal
5+
plan: Starter
6+
region: oregon
7+
8+
envVarGroups:
9+
- name: temporal-shared
10+
envVars:
11+
- key: DYNAMIC_CONFIG_FILE_PATH
12+
value: /etc/temporal/dynamicconfig_es.yaml
13+
- key: ENABLE_ES
14+
value: true
15+
- key: ES_VERSION
16+
value: v7
17+
- key: ES_USER
18+
value: elastic
19+
- key: DB
20+
value: postgresql
21+
22+
services:
23+
- type: pserv
24+
name: temporal-elasticsearch
25+
autoDeploy: false
26+
plan: Starter
27+
region: oregon
28+
env: docker
29+
dockerfilePath: ./temporal-cluster/elasticsearch/Dockerfile
30+
envVars:
31+
- key: PORT
32+
value: 9200
33+
- key: ES_JAVA_OPTS
34+
value: "-Xms100m -Xmx100m"
35+
- key: xpack.security.enabled
36+
value: true
37+
- key: ELASTIC_PASSWORD
38+
generateValue: true
39+
- key: cluster.routing.allocation.disk.threshold_enabled
40+
value: true
41+
- key: cluster.routing.allocation.disk.watermark.low
42+
value: 512mb
43+
- key: cluster.routing.allocation.disk.watermark.high
44+
value: 256mb
45+
- key: cluster.routing.allocation.disk.watermark.flood_stage
46+
value: 128mb
47+
- key: discovery.type
48+
value: single-node
49+
- type: pserv
50+
name: temporal-frontend
51+
autoDeploy: false
52+
plan: Starter
53+
region: oregon
54+
env: docker
55+
dockerfilePath: ./temporal-cluster/server/auto-setup/Dockerfile
56+
scaling:
57+
minInstances: 1
58+
maxInstances: 3
59+
targetMemoryPercent: 80
60+
targetCPUPercent: 80
61+
envVars:
62+
- fromGroup: temporal-shared
63+
- key: SERVICES
64+
value: frontend
65+
- key: SKIP_POSTGRES_DB_CREATION
66+
value: true
67+
- key: SKIP_VISIBILITY_DB_SETUP
68+
value: true
69+
- key: ES_SEEDS
70+
fromService:
71+
name: temporal-elasticsearch
72+
type: pserv
73+
property: host
74+
- key: ES_PWD
75+
fromService:
76+
name: temporal-elasticsearch
77+
type: pserv
78+
envVarKey: ELASTIC_PASSWORD
79+
- key: DBNAME
80+
fromDatabase:
81+
name: temporal-db
82+
property: database
83+
- key: DB_PORT
84+
fromDatabase:
85+
name: temporal-db
86+
property: port
87+
- key: POSTGRES_USER
88+
fromDatabase:
89+
name: temporal-db
90+
property: user
91+
- key: POSTGRES_PWD
92+
fromDatabase:
93+
name: temporal-db
94+
property: password
95+
- key: POSTGRES_SEEDS
96+
fromDatabase:
97+
name: temporal-db
98+
property: host
99+
- type: pserv
100+
name: temporal-history
101+
autoDeploy: false
102+
plan: Starter
103+
region: oregon
104+
env: docker
105+
dockerfilePath: ./temporal-cluster/server/Dockerfile
106+
scaling:
107+
minInstances: 1
108+
maxInstances: 3
109+
targetMemoryPercent: 80
110+
targetCPUPercent: 80
111+
envVars:
112+
- fromGroup: temporal-shared
113+
- key: SERVICES
114+
value: history
115+
- key: TEMPORAL_FRONTEND_HOST
116+
fromService:
117+
name: temporal-frontend
118+
type: pserv
119+
property: host
120+
- key: ES_SEEDS
121+
fromService:
122+
name: temporal-elasticsearch
123+
type: pserv
124+
property: host
125+
- key: ES_PWD
126+
fromService:
127+
name: temporal-elasticsearch
128+
type: pserv
129+
envVarKey: ELASTIC_PASSWORD
130+
- key: DBNAME
131+
fromDatabase:
132+
name: temporal-db
133+
property: database
134+
- key: POSTGRES_USER
135+
fromDatabase:
136+
name: temporal-db
137+
property: user
138+
- key: POSTGRES_PWD
139+
fromDatabase:
140+
name: temporal-db
141+
property: password
142+
- key: POSTGRES_SEEDS
143+
fromDatabase:
144+
name: temporal-db
145+
property: host
146+
- type: pserv
147+
name: temporal-matching
148+
autoDeploy: false
149+
plan: Starter
150+
region: oregon
151+
env: docker
152+
dockerfilePath: ./temporal-cluster/server/Dockerfile
153+
scaling:
154+
minInstances: 1
155+
maxInstances: 3
156+
targetMemoryPercent: 80
157+
targetCPUPercent: 80
158+
envVars:
159+
- fromGroup: temporal-shared
160+
- key: SERVICES
161+
value: matching
162+
- key: TEMPORAL_FRONTEND_HOST
163+
fromService:
164+
name: temporal-frontend
165+
type: pserv
166+
property: host
167+
- key: ES_SEEDS
168+
fromService:
169+
name: temporal-elasticsearch
170+
type: pserv
171+
property: host
172+
- key: ES_PWD
173+
fromService:
174+
name: temporal-elasticsearch
175+
type: pserv
176+
envVarKey: ELASTIC_PASSWORD
177+
- key: DBNAME
178+
fromDatabase:
179+
name: temporal-db
180+
property: database
181+
- key: POSTGRES_USER
182+
fromDatabase:
183+
name: temporal-db
184+
property: user
185+
- key: POSTGRES_PWD
186+
fromDatabase:
187+
name: temporal-db
188+
property: password
189+
- key: POSTGRES_SEEDS
190+
fromDatabase:
191+
name: temporal-db
192+
property: host
193+
- type: pserv
194+
autoDeploy: false
195+
name: temporal-worker
196+
plan: Starter
197+
region: oregon
198+
env: docker
199+
dockerfilePath: ./temporal-cluster/server/Dockerfile
200+
scaling:
201+
minInstances: 1
202+
maxInstances: 3
203+
targetMemoryPercent: 80
204+
targetCPUPercent: 80
205+
envVars:
206+
- fromGroup: temporal-shared
207+
# The worker service needs to wait for the history service to be up first,
208+
# otherwise it will fail with "error starting scanner".
209+
- key: DEPENDS_ON_HISTORY
210+
fromService:
211+
name: temporal-history
212+
type: pserv
213+
property: host
214+
- key: SERVICES
215+
value: worker
216+
- key: TEMPORAL_FRONTEND_HOST
217+
fromService:
218+
name: temporal-frontend
219+
type: pserv
220+
property: host
221+
- key: ES_SEEDS
222+
fromService:
223+
name: temporal-elasticsearch
224+
type: pserv
225+
property: host
226+
- key: ES_PWD
227+
fromService:
228+
name: temporal-elasticsearch
229+
type: pserv
230+
envVarKey: ELASTIC_PASSWORD
231+
- key: DBNAME
232+
fromDatabase:
233+
name: temporal-db
234+
property: database
235+
- key: POSTGRES_USER
236+
fromDatabase:
237+
name: temporal-db
238+
property: user
239+
- key: POSTGRES_PWD
240+
fromDatabase:
241+
name: temporal-db
242+
property: password
243+
- key: POSTGRES_SEEDS
244+
fromDatabase:
245+
name: temporal-db
246+
property: host
247+
- type: web
248+
name: temporal-ui
249+
autoDeploy: false
250+
plan: Starter
251+
region: oregon
252+
env: docker
253+
dockerfilePath: ./temporal-cluster/web/Dockerfile
254+
envVars:
255+
- key: PORT
256+
value: 8088
257+
- key: TEMPORAL_PERMIT_WRITE_API
258+
value: true
259+
- key: TEMPORAL_GRPC_HOST
260+
fromService:
261+
name: temporal-frontend
262+
type: pserv
263+
property: host
264+
- type: web
265+
repo: https://github.com/render-examples/sample-temporal-app
266+
name: app-workflow-trigger
267+
plan: Starter
268+
region: oregon
269+
env: go
270+
buildCommand: go build start/main.go
271+
startCommand: ./main
272+
envVars:
273+
- key: TEMPORAL_CLUSTER_HOST
274+
fromService:
275+
name: temporal-frontend
276+
type: pserv
277+
property: host
278+
- type: worker
279+
repo: https://github.com/render-examples/sample-temporal-app
280+
name: app-worker
281+
plan: Starter
282+
region: oregon
283+
env: go
284+
buildCommand: go build worker/main.go
285+
startCommand: ./main
286+
envVars:
287+
- key: TEMPORAL_CLUSTER_HOST
288+
fromService:
289+
name: temporal-frontend
290+
type: pserv
291+
property: host
+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# The official Elasticsearch Docker image
2+
FROM docker.elastic.co/elasticsearch/elasticsearch:7.16.2
3+
4+
# Copy our config file over
5+
COPY --chown=1000:0 temporal-cluster/elasticsearch/elasticsearch.yml /usr/share/elasticsearch/config/elasticsearch.yml
6+
7+
# Allow Elasticsearch to create `elasticsearch.keystore`
8+
# to circumvent https://github.com/elastic/ansible-elasticsearch/issues/430
9+
RUN chmod g+ws /usr/share/elasticsearch/config
10+
11+
USER 1000:0
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
cluster.name: "elastic"
2+
# bind to all network interfaces
3+
network.host: 0.0.0.0

temporal-cluster/server/.bashrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export TEMPORAL_CLI_ADDRESS=${TEMPORAL_FRONTEND_HOST:-$RENDER_SERVICE_NAME}:7233

temporal-cluster/server/Dockerfile

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
FROM temporalio/server:1.14.3
2+
3+
COPY temporal-cluster/server/dynamicconfig.yaml /etc/temporal/dynamicconfig.yaml
4+
COPY temporal-cluster/server/dynamicconfig_es.yaml /etc/temporal/dynamicconfig_es.yaml
5+
COPY temporal-cluster/server/config_template.yaml /etc/temporal/config/config_template.yaml
6+
COPY temporal-cluster/server/.bashrc /home/temporal/.bashrc
7+
8+
ENTRYPOINT ["bash", "-c", "PUBLIC_FRONTEND_ADDRESS=$TEMPORAL_FRONTEND_HOST:7233 /etc/temporal/entrypoint.sh"]

temporal-cluster/server/LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2020 temporal.io
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FROM temporalio/auto-setup:1.14.3
2+
3+
COPY temporal-cluster/server/dynamicconfig.yaml /etc/temporal/dynamicconfig.yaml
4+
COPY temporal-cluster/server/dynamicconfig_es.yaml /etc/temporal/dynamicconfig_es.yaml
5+
COPY temporal-cluster/server/config_template.yaml /etc/temporal/config/config_template.yaml
6+
COPY temporal-cluster/server/auto-setup/auto-setup-override.sh /etc/temporal/auto-setup.sh
7+
COPY temporal-cluster/server/.bashrc /home/temporal/.bashrc

0 commit comments

Comments
 (0)