-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
173 lines (151 loc) · 4.76 KB
/
Makefile
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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
# Makefile
LEDGER_PORT_A := 1000
LEDGER_PORT_B := 1001
CANTON_DOMAIN_PORT := 2000
CANTON_DOMAIN_URL := http://127.0.0.1:2000
NAVIGATOR_PORT_A := 4500
NAVIGATOR_PORT_B := 4501
JSON_API_PORT_A := 4000
JSON_API_PORT_B := 4001
JSON_API_URL_A := http://127.0.0.1:4000
JSON_API_URL_B := http://127.0.0.1:4001
LEDGER_ID := participant1
commands := "\
\nMake commands: \
\n (1) make daml_build \
\n (-) make daml_start \
\n (2) make canton_a \
\n make canton_b \
\n (-) make navigator_a \
\n make navigator_b \
\n (3) make json_api_a \
\n (4) make json_api_b \
\n (5) make ui_start \
\n (-) make ui_build \
\nEnvs:\
\n LEDGER_PORT_A: ${LEDGER_PORT_A} \
\n LEDGER_PORT_B: ${LEDGER_PORT_B} \
\n CANTON_DOMAIN_PORT: ${CANTON_DOMAIN_PORT} \
\n CANTON_DOMAIN_URL: ${CANTON_DOMAIN_URL} \
\n NAVIGATOR_PORT_A: ${NAVIGATOR_PORT_A} \
\n NAVIGATOR_PORT_B: ${NAVIGATOR_PORT_B} \
\n JSON_API_PORT_A: ${JSON_API_PORT_A} \
\n JSON_API_PORT_B: ${JSON_API_PORT_B} \
\n JSON_API_URL_A: ${JSON_API_URL_A} \
\n JSON_API_URL_B: ${JSON_API_URL_B} \
\n LEDGER_ID: ${LEDGER_ID} \
\n"
default:
echo ${commands}
##################################################################
############################## Daml ##############################
##################################################################
daml_build:
docker run --rm -it \
-w /data \
-v ${PWD}/daml:/data \
digitalasset/daml-sdk:1.18.0 \
sh -c "daml build"
daml_start:
docker run --rm -it \
-w /data \
-v ${PWD}/daml:/data \
-p ${JSON_API_PORT_A}:${JSON_API_PORT_A} \
-p 7500:7500 \
digitalasset/daml-sdk:1.18.0 \
sh -c "daml start \
--start-navigator=true \
--sandbox-option='--wall-clock-time' \
--sandbox-option='--ledgerid=${LEDGER_ID_A}' \
--json-api-port=${JSON_API_PORT_A} \
--json-api-option='--address=0.0.0.0'"
##################################################################
############################# Canton #############################
##################################################################
canton_a:
docker run --rm -it \
--network host \
-v ${PWD}/canton:/canton/app \
-v ${PWD}/daml:/canton/daml \
-e DOMAIN_PORT=${CANTON_DOMAIN_PORT} \
-e LEDGER_PORT=${LEDGER_PORT_A} \
-p ${CANTON_DOMAIN_PORT}:${CANTON_DOMAIN_PORT} \
-p ${LEDGER_PORT_A}:${LEDGER_PORT_A} \
digitalasset/canton-community:latest \
--config /canton/app/canton.conf \
--bootstrap /canton/app/init.canton
canton_b:
docker run --rm -it \
--network host \
-v ${PWD}/canton:/canton/app \
-v ${PWD}/daml:/canton/daml \
-e DOMAIN_URL=${CANTON_DOMAIN_URL} \
-e LEDGER_PORT=${LEDGER_PORT_B} \
-p ${LEDGER_PORT_B}:${LEDGER_PORT_B} \
digitalasset/canton-community:latest \
--config /canton/app/canton_2.conf \
--bootstrap /canton/app/init_2.canton
##################################################################
########################### Navigator ############################
##################################################################
navigator_a:
docker run --rm -it \
--network host \
-p ${NAVIGATOR_PORT_A}:${NAVIGATOR_PORT_A} \
digitalasset/daml-sdk:1.18.0 \
sh -c "daml ledger navigator \
--host localhost \
--port ${LEDGER_PORT_A} \
--port ${NAVIGATOR_PORT_A}"
navigator_b:
docker run --rm -it \
--network host \
-p ${NAVIGATOR_PORT_B}:${NAVIGATOR_PORT_B} \
digitalasset/daml-sdk:1.18.0 \
sh -c "daml ledger navigator \
--host localhost \
--port ${LEDGER_PORT_B} \
--port ${NAVIGATOR_PORT_B}"
##################################################################
############################ JsonApi #############################
##################################################################
json_api_a:
docker run --rm -it \
--network host \
-p ${JSON_API_PORT_A}:${JSON_API_PORT_A} \
digitalasset/daml-sdk:1.18.0 \
sh -c "daml json-api \
--http-port ${JSON_API_PORT_A} \
--ledger-port ${LEDGER_PORT_A} \
--ledger-host localhost \
--address 0.0.0.0 \
--allow-insecure-tokens"
json_api_b:
docker run --rm -it \
--network host \
-p ${JSON_API_PORT_B}:${JSON_API_PORT_B} \
digitalasset/daml-sdk:1.18.0 \
sh -c "daml json-api \
--http-port ${JSON_API_PORT_B} \
--ledger-port ${LEDGER_PORT_B} \
--ledger-host localhost \
--address 0.0.0.0 \
--allow-insecure-tokens"
##################################################################
############################## UI ################################
##################################################################
ui_start:
docker run --rm -it \
-w /usr/src/app \
-v ${PWD}/ui:/usr/src/app \
-p 3000:3000 \
-e JSON_API_URL=${JSON_API_URL_A} \
node:alpine \
sh -c "yarn install && yarn start"
ui_build:
docker run --rm -it \
-w /usr/src/app \
-v ${PWD}/ui:/usr/src/app \
-e JSON_API_URL=${JSON_API_URL_A} \
node:alpine \
sh -c "yarn install && yarn build"