-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfirehose-node.yaml
More file actions
230 lines (228 loc) · 7.61 KB
/
firehose-node.yaml
File metadata and controls
230 lines (228 loc) · 7.61 KB
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
217
218
219
220
221
222
223
224
225
226
227
228
229
230
---
apiVersion: v1
kind: Service
metadata:
name: persistencecore-firehose-node
labels:
app.kubernetes.io/name: persistencecore-firehose-node
spec:
clusterIP: None
ports:
- name: p2p
port: 26656
protocol: TCP
targetPort: 26656
- name: rpc
port: 26657
protocol: TCP
targetPort: 26657
- name: prometheus-node
port: 26660
protocol: TCP
targetPort: 26660
- name: http
port: 8081
protocol: TCP
targetPort: 8081
- name: firehose
port: 9030
protocol: TCP
targetPort: 9030
- name: prometheus-firehose
port: 9102
protocol: TCP
targetPort: 9102
selector:
app.kubernetes.io/name: persistencecore-firehose-node
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: persistencecore-firehose-node
spec:
serviceName: persistencecore-firehose-node
replicas: 1
revisionHistoryLimit: 3
selector:
matchLabels:
app.kubernetes.io/instance: persistencecore
app.kubernetes.io/name: persistencecore-firehose-node
template:
metadata:
annotations:
quality: release
role: api-gateway
sla: high
tier: gateway
labels:
app.kubernetes.io/instance: persistencecore
app.kubernetes.io/type: persistencecore-firehose-node
app.kubernetes.io/name: persistencecore-firehose-node
app.kubernetes.io/version: '0.1'
spec:
terminationGracePeriodSeconds: 10
initContainers:
- name: wait-for-genesis
image: docker.io/persistenceone/persistencecore:v7.0.0-fh
imagePullPolicy: Always
env:
- name: GENESIS_NODE_DATA_RESOLUTION_METHOD
valueFrom:
configMapKeyRef:
key: sync_node.resolution_method
name: firehose-node-config
- name: GENESIS_HOST
valueFrom:
configMapKeyRef:
key: sync_node.host
name: firehose-node-config
- name: GENESIS_PORT
valueFrom:
configMapKeyRef:
key: sync_node.exposer_port
name: firehose-node-config
command:
- bash
- "-c"
- |
# Do the following if the resolution method is dynamic else skip (we assume that in static configuration peer node is already up)
if [ "$GENESIS_NODE_DATA_RESOLUTION_METHOD" = "DYNAMIC" ]; then
while [ $(curl -sw '%{http_code}' http://$GENESIS_HOST:$GENESIS_PORT/node_id -o /dev/null) -ne 200 ]; do
echo "Genesis validator does not seem to be ready. Waiting for it to start..."
sleep 10;
done
fi
echo "Ready to start"
exit 0
- name: init-firehose-node
image: docker.io/persistenceone/persistencecore:v7.0.0-fh
imagePullPolicy: Always
env:
- name: CHAIN_ID
valueFrom:
configMapKeyRef:
key: chain.id
name: persistencecore
- name: HOME_DIR
value: /persistencecore
- name: GENESIS_HOST
valueFrom:
configMapKeyRef:
key: sync_node.host
name: firehose-node-config
# We support 2 types of resolution methods: (dynamic, static), if the resolution method is dynamic then we fetch the node id
# on the fly from the exposer app exposed service on the specified port, otherwise it is required that the node id is
# specified exactly as an environment variable
- name: GENESIS_NODE_DATA_RESOLUTION_METHOD
valueFrom:
configMapKeyRef:
key: sync_node.resolution_method
name: firehose-node-config
- name: GENESIS_EXPOSER_PORT
valueFrom:
configMapKeyRef:
key: sync_node.exposer_port
name: firehose-node-config
# This URL is used to fetch the genesis json if the NODE_DATA_RESOLUTION_METHOD is static
- name: GENESIS_JSON_FETCH_URL
valueFrom:
configMapKeyRef:
key: sync_node.genesis_json_fetch_url
name: firehose-node-config
- name: GENESIS_PORT_P2P
valueFrom:
configMapKeyRef:
key: sync_node.port_p2p
name: firehose-node-config
- name: STATE_RESTORE_SNAPSHOT_URL
valueFrom:
configMapKeyRef:
key: snapshot_restore_url
name: firehose-node-config
- name: SEEDS
valueFrom:
configMapKeyRef:
key: seeds
name: firehose-node-config
- name: FIRST_STREAMABLE_BLOCK
valueFrom:
configMapKeyRef:
key: first_streamable_block
name: firehose-node-config
- name: FORCE_INIT
valueFrom:
configMapKeyRef:
key: force_init
name: firehose-node-config
command:
- bash
- "-c"
- |
bash /scripts/init-firehose-node.sh
echo "Checking if firecosmos already installed.."
# Install firecosmos if not already installed
if [ ! -f /persistencecore/bin/firecosmos ]; then
echo "Installing firecosmos ..."
wget https://github.com/figment-networks/firehose-cosmos/releases/download/v0.6.0/firecosmos_linux_amd64 -O firecosmos
chmod +x firecosmos
mkdir -p /persistencecore/bin
mv firecosmos /persistencecore/bin/firecosmos
fi
resources:
limits:
cpu: "1"
memory: "1G"
requests:
cpu: "1"
memory: "1G"
volumeMounts:
- mountPath: /persistencecore
name: node-pv-storage
- mountPath: /config-graph
name: config-graph
- mountPath: /scripts
name: scripts-graph
containers:
- name: firehose-node
image: docker.io/persistenceone/persistencecore:v7.0.0-fh
imagePullPolicy: Always
env:
- name: CHAIN_ID
valueFrom:
configMapKeyRef:
key: chain.id
name: persistencecore
- name: HOME_DIR
value: /persistencecore
command:
- bash
- "-c"
- |
exec /persistencecore/bin/firecosmos start --config /persistencecore/config/firehose.yml --data-dir /fh-data
resources:
limits:
cpu: "4"
memory: "7G"
requests:
cpu: "3"
memory: "6G"
volumeMounts:
- mountPath: /persistencecore
name: node-pv-storage
- mountPath: /config-graph
name: config-graph
- mountPath: /fh-data
name: firehose-pv-storage
volumes:
- name: firehose-pv-storage
persistentVolumeClaim:
claimName: firehose-pv-claim
- name: node-pv-storage
persistentVolumeClaim:
claimName: node-pv-claim
- name: config-graph
configMap:
name: config-graph
- name: scripts-graph
configMap:
name: scripts-graph