-
Notifications
You must be signed in to change notification settings - Fork 230
/
deploy.yaml
217 lines (193 loc) · 5.4 KB
/
deploy.yaml
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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
---
version: "2.0"
endpoints:
nodeendpoint-pg:
kind: ip
services:
node:
image: harbor.status.im/wakuorg/nwaku:v0.29.0
depends_on:
- postgres
expose:
- port: 60000
as: 60000
proto: tcp
to:
- global: true
ip: nodeendpoint-pg
- port: 8003
as: 8003
proto: tcp
to:
- global: true
ip: nodeendpoint-pg
- port: 9005
proto: udp
to:
- global: true
ip: nodeendpoint-pg
- port: 8000
as: 8000
proto: tcp
to:
- global: true
ip: nodeendpoint-pg
- port: 80
as: 80
to:
- global: true
ip: nodeendpoint-pg
params:
storage:
certs:
mount: /etc/letsencrypt
env:
#Mandatory
- IP_ADDR=
- ETH_CLIENT_ADDRESS=
- POSTGRES_USER=waku
- "POSTGRES_PASSWORD=secretpassword"
#Optional
- DOMAIN=
- NODEKEY=
- RLN_RELAY_CRED_BASE64=
- RLN_RELAY_CRED_PASSWORD=
command:
- sh
- '-c'
args:
- >
if [ -z "${IP_ADDR}" ]; then
echo "You need to provide the IP leased to this service in \$IP_ADDR env var"
sleep 120
exit 1
fi
DNS_WSS_CMD=
if [ -n "${DOMAIN}" ]; then
echo "==> Generating Let's Encrypt certificates!"
LETSENCRYPT_PATH=/etc/letsencrypt/live/${DOMAIN}
if ! [ -d "${LETSENCRYPT_PATH}" ]; then
apk add --no-cache certbot
certbot certonly\
--non-interactive\
--agree-tos\
--no-eff-email\
--no-redirect\
--email user@${DOMAIN}\
-d ${DOMAIN}\
--standalone
fi
if ! [ -e "${LETSENCRYPT_PATH}/privkey.pem" ]; then
echo "The certificate does not exist"
sleep 120
exit 1
fi
WS_SUPPORT="--websocket-support=true"
WSS_SUPPORT="--websocket-secure-support=true"
WSS_KEY="--websocket-secure-key-path=${LETSENCRYPT_PATH}/privkey.pem"
WSS_CERT="--websocket-secure-cert-path=${LETSENCRYPT_PATH}/cert.pem"
DNS4_DOMAIN="--dns4-domain-name=${DOMAIN}"
DNS_WSS_CMD="${WS_SUPPORT} ${WSS_SUPPORT} ${WSS_CERT} ${WSS_KEY} ${DNS4_DOMAIN}"
fi
if [ "${NODEKEY}" != "" ]; then
NODEKEY=--nodekey=${NODEKEY}
fi
STORE_DB_URL=--store-message-db-url=sqlite:///etc/letsencrypt/wakustore.sqlite3
if [ "${POSTGRES_PASSWORD}" != "" ]; then
STORE_DB_URL="--store-message-db-url=postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/waku"
fi
RLN_RELAY_CRED_PATH=${RLN_RELAY_CRED_PATH:-/keystore/keystore.json}
if [ -n "${RLN_RELAY_CRED_BASE64}" ]; then
mkdir -p `dirname ${RLN_RELAY_CRED_PATH}`
echo ${RLN_RELAY_CRED_BASE64}
echo ${RLN_RELAY_CRED_BASE64} | base64 -d > ${RLN_RELAY_CRED_PATH}
if [ -n "${RLN_RELAY_CRED_PATH}" ]; then
RLN_RELAY_CRED_ARG=--rln-relay-cred-path=${RLN_RELAY_CRED_PATH}
fi
fi
if [ -n "${RLN_RELAY_CRED_PASSWORD}" ]; then
RLN_RELAY_CRED_PASSWORD=--rln-relay-cred-password="${RLN_RELAY_CRED_PASSWORD}"
fi
exec "/usr/bin/wakunode"\
${DNS_WSS_CMD}\
${STORE_DB_URL}\
${NODEKEY}\
${RLN_RELAY_CRED_ARG}\
${RLN_RELAY_CRED_PASSWORD}\
--rln-relay-eth-client-address="${ETH_CLIENT_ADDRESS}"\
--rln-relay-tree-path="/etc/letsencrypt/rln_tree"\
--nat=extip:${IP_ADDR}\
--relay=true\
--filter=true\
--lightpush=true\
--cluster-id=1\
--keep-alive=true\
--peer-exchange=true\
--max-connections=300\
--discv5-discovery=true\
--discv5-udp-port=9005\
--discv5-enr-auto-update=True\
--log-level=DEBUG\
--metrics-server=True\
--metrics-server-port=8003\
--metrics-server-address=0.0.0.0\
--store=true\
--store-message-retention-policy=size:3GB
postgres:
image: postgres
expose:
- port: 5432
to:
- service: node
params:
storage:
data:
mount: /var/lib/postgresql/
env:
- POSTGRES_USER=waku
- "POSTGRES_PASSWORD=secretpassword"
- POSTGRES_DB=waku
profiles:
compute:
postgres:
resources:
cpu:
units: 0.5
memory:
size: 1Gi
storage:
- name: data
size: 4Gi
attributes:
persistent: true
class: beta3
node:
resources:
cpu:
units: 0.5
memory:
size: 1Gi
storage:
- name: certs
size: 100Mi
attributes:
persistent: true
class: beta3
placement:
westcoast:
pricing:
postgres:
denom: uakt
amount: 100000
node:
denom: uakt
amount: 100000
deployment:
postgres:
westcoast:
profile: postgres
count: 1
node:
westcoast:
profile: node
count: 1