-
Notifications
You must be signed in to change notification settings - Fork 16
/
docker-compose-template.yml
156 lines (145 loc) · 4.29 KB
/
docker-compose-template.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
{% set players = num_players | int %}
{% if network is not defined or network == "localhost" %}
{% set network = "localhost" %}
{% endif %}
{% import "config/"~network~".j2" as config %}
version: '3'
{% if network == "localhost" %}
secrets:
ipfs_swarm_key:
file: swarm.key
{% endif %}
services:
{% if network == "localhost" %}
hardhatnet:
build:
context: .
dockerfile: ./deployer/Dockerfile
environment:
MNEMONIC: "{{ config.mnemonic() }}"
expose:
- {{ config.port() }}
ports:
- {{ config.port() }}:{{ config.port() }}
volumes:
- ./deployments/:/opt/cartesi/share/blockchain/deployments
networks:
- ethereum
{% endif %}
{% for i in range(players) %}
dispatcher_{{ i }}:
image: {{ image |default("cartesi/compute:local", true) }}
restart: always
environment:
MNEMONIC: "{{ config.mnemonic() }}"
ACCOUNT_INDEX: "{{ i }}"
RUST_LOG: dispatcher=info,transaction=info,configuration=info,utils=info,state=info,cartesi_compute=info
WEB3_PROVIDER_URI: {{ config.provider() }}
DEPLOYMENT_SEMAPHORE: {{ config.semaphore() }}
ETHEREUM_HOST: {{ config.host() }}
ETHEREUM_PORT: {{ config.port() }}
ETHEREUM_NETWORK: {{ network }}
QUERY_PORT: 3001
MACHINE_MANAGER_HOST: machine-manager
MACHINE_MANAGER_PORT: 50051
LOGGER_HOST: logger
LOGGER_PORT: 50051
IPFS_HOST: ipfs
IPFS_PORT: 50051
DOCKER: "TRUE"
RUST_BACKTRACE: 1
volumes:
{% if network == "localhost" %}
# remove deployments mapping to use supported testnets' deployment info
- ./deployments:/opt/cartesi/share/blockchain/deployments:ro
{% endif %}
- ./dapp_data_{{ i }}/flashdrive:/opt/cartesi/srv/compute/flashdrive
networks:
ethereum: {}
node_{{ i }}:
aliases:
- dispatcher
#ports:
# - "{{ 3001 + i }}:3001"
logger_{{ i }}:
image: cartesi/logger-server:0.8.0
{% if network == "localhost" %}
command: [ "-c", "/opt/cartesi/share/blockchain/deployments/localhost/Logger.json", "-d", "/opt/cartesi/srv/compute/flashdrive"]
{% else %}
command: [ "-c", "/opt/cartesi/share/blockchain/node_modules/@cartesi/logger/deployments/{{ network }}/Logger.json", "-d", "/opt/cartesi/srv/compute/flashdrive"]
{% endif %}
volumes:
{% if network == "localhost" %}
# remove deployments mapping to use supported testnets' deployment info
- ./deployments:/opt/cartesi/share/blockchain/deployments:ro
{% endif %}
- ./dapp_data_{{ i }}/flashdrive:/opt/cartesi/srv/compute/flashdrive
environment:
MNEMONIC: "{{ config.mnemonic() }}"
ACCOUNT_INDEX: "{{ i }}"
WEB3_PROVIDER_URI: {{ config.provider() }}
DEPLOYMENT_SEMAPHORE: {{ config.semaphore() }}
networks:
ethereum: {}
node_{{ i }}:
aliases:
- logger
ipfs_{{ i }}:
image: cartesi/ipfs-server:0.3.0
volumes:
- ./dapp_data_{{ i }}:/opt/cartesi/srv/compute
networks:
ipfs: {}
node_{{ i }}:
aliases:
- ipfs
#ports:
# - "{{ 50051 + i }}:50051"
command: ["-g", "http://kubo_{{ i }}:5001"]
kubo_{{ i }}:
image: ipfs/kubo:v0.14.0
command:
[
"daemon",
"--migrate=true",
"--enable-pubsub-experiment",
"--enable-gc",
"--routing=dhtclient"
]
{% if network == "localhost" %}
secrets:
- ipfs_swarm_key
{% endif %}
environment:
{% if network == "localhost" %}
IPFS_SWARM_KEY_FILE: /run/secrets/ipfs_swarm_key
{% else %}
IPFS_PROFILE: "server"
{% endif %}
networks:
ipfs:
aliases:
- kubo
machine_manager_{{ i }}:
image: cartesi/machine-manager:master
volumes:
- ./machines:/opt/cartesi/srv/compute/cartesi-machine
- ./dapp_data_{{ i }}/flashdrive:/opt/cartesi/srv/compute/flashdrive
command: [ "./bin/machine-manager", "--address", "0.0.0.0", "--port", "50051","--port-checkin","50052"]
environment:
RUST_LOG: machine_manager_server=info
networks:
ethereum: {}
node_{{ i }}:
aliases:
- machine-manager
{% endfor %}
volumes:
{% for i in range(players) %}dapp_data_{{ i }}:
{% endfor %}
networks:
ipfs:
name: ipfs
ethereum:
{% for i in range(players) %}node_{{ i }}:
{% endfor %}