-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgraph-node.yaml
More file actions
189 lines (180 loc) · 5.62 KB
/
graph-node.yaml
File metadata and controls
189 lines (180 loc) · 5.62 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
---
apiVersion: v1
kind: Service
metadata:
name: persistencecore-graph-node
labels:
app.kubernetes.io/name: persistencecore-graph-node
spec:
clusterIP: None
ports:
- name: http
port: 8000
protocol: TCP
targetPort: 8000
- name: websocket
port: 8001
protocol: TCP
targetPort: 8001
- name: admin
port: 8020
protocol: TCP
targetPort: 8020
- name: health
port: 8030
protocol: TCP
targetPort: 8030
- name: prometheus
port: 8040
protocol: TCP
targetPort: 8040
selector:
app.kubernetes.io/name: persistencecore-graph-node
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: persistencecore-graph-node
spec:
serviceName: persistencecore-graph-node
replicas: 1
revisionHistoryLimit: 3
selector:
matchLabels:
app.kubernetes.io/instance: persistencecore
app.kubernetes.io/name: persistencecore-graph-node
template:
metadata:
annotations:
quality: release
role: api-gateway
sla: high
tier: gateway
labels:
app.kubernetes.io/instance: persistencecore
app.kubernetes.io/type: persistencecore-graph-node
app.kubernetes.io/name: persistencecore-graph-node
app.kubernetes.io/version: "0.1"
spec:
initContainers:
- name: wait-for-firehose-node
image: networld/grpcurl
imagePullPolicy: Always
env:
- name: FIREHOSE_HOST
valueFrom:
configMapKeyRef:
name: graph-node-config
key: firehose_node.host
- name: FIREHOSE_PORT
valueFrom:
configMapKeyRef:
name: graph-node-config
key: firehose_node.port
command:
- sh
- "-c"
- |
apk update
apk add jq
x=1; while [ $x -le 10 ]; do
echo "Attempt number: $x"
FIREHOSE_STATUS=$(./grpcurl -plaintext $FIREHOSE_HOST:$FIREHOSE_PORT grpc.health.v1.Health.Check | jq .status)
if [ $FIREHOSE_STATUS == '"SERVING"' ]
then
echo "Ready to start"
exit 0
fi
echo "Firehose node does not seem to be ready. Status: $FIREHOSE_STATUS Waiting for it to start. Sleeping for 15 seconds."
sleep 15
x=$(( $x + 1 ))
done
echo "Retry limit exceeded. Current status: $(./grpcurl -plaintext $FIREHOSE_HOST:$FIREHOSE_PORT grpc.health.v1.Health.Check | jq .status)"
exit 1
containers:
- name: graph-node
image: graphprotocol/graph-node:v0.29.0
imagePullPolicy: Always
env:
- name: FIREHOSE_HOST
valueFrom:
configMapKeyRef:
name: graph-node-config
key: firehose_node.host
- name: FIREHOSE_PORT
valueFrom:
configMapKeyRef:
name: graph-node-config
key: firehose_node.port
- name: IPFS_HOST
valueFrom:
configMapKeyRef:
name: graph-node-config
key: ipfs.host
- name: IPFS_PORT
valueFrom:
configMapKeyRef:
name: graph-node-config
key: ipfs.port
- name: POSTGRES_HOST
valueFrom:
secretKeyRef:
name: postgres-secret
key: POSTGRES_HOST
- name: POSTGRES_PORT
valueFrom:
secretKeyRef:
name: postgres-secret
key: POSTGRES_PORT
- name: POSTGRES_USER
valueFrom:
secretKeyRef:
name: postgres-secret
key: POSTGRES_USER
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: postgres-secret
key: POSTGRES_PASSWORD
- name: POSTGRES_DB
valueFrom:
secretKeyRef:
name: postgres-secret
key: POSTGRES_DB
command:
- bash
- "-c"
- |
cp config-graph/config-graph-node.toml config.toml
sed -i "s/POSTGRES_USER/$POSTGRES_USER/g" config.toml
sed -i "s/POSTGRES_PASSWORD/$POSTGRES_PASSWORD/g" config.toml
sed -i "s/POSTGRES_HOST/$POSTGRES_HOST/g" config.toml
sed -i "s/POSTGRES_PORT/$POSTGRES_PORT/g" config.toml
sed -i "s/POSTGRES_DB/$POSTGRES_DB/g" config.toml
sed -i "s/FIREHOSE_HOST/$FIREHOSE_HOST/g" config.toml
sed -i "s/FIREHOSE_PORT/$FIREHOSE_PORT/g" config.toml
# Print config before starting node
cat config.toml
# maybe dns needs some time to resolve?
# sleep 10
# echo "Sleeping for infinity"
# sleep infinity
# Start graph node
graph-node --config config.toml \
--ipfs "$IPFS_HOST:$IPFS_PORT" \
--node-id index_node_cosmos_1
resources:
limits:
cpu: "2"
memory: "2G"
requests:
cpu: "1"
memory: "1G"
volumeMounts:
- mountPath: config-graph
name: config-graph
volumes:
- name: config-graph
configMap:
name: config-graph
---