Skip to content

Commit b9d9415

Browse files
committed
Merge pull request #56 from web3labs/clean-up
Refine k8s scripts and descriptors
2 parents 7744cb1 + 2244278 commit b9d9415

File tree

8 files changed

+25
-62
lines changed

8 files changed

+25
-62
lines changed

k8s/README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,10 @@ minikube addons enable ingress
2929
```
3030

3131
```
32-
'''
3332
minikube service sirato-proxy
34-
'''
33+
```
34+
35+
```
3536
❯ minikube service sirato-proxy
3637
|-----------|--------------|-------------|---------------------------|
3738
| NAMESPACE | NAME | TARGET PORT | URL |
@@ -46,6 +47,7 @@ minikube service sirato-proxy
4647
|-----------|--------------|-------------|------------------------|
4748
🎉 Opening service default/sirato-proxy in default browser...
4849
```
50+
4951
Point your browser to the provided URL.
5052

5153
## Stopping Sirato

k8s/api-deployment.yml.tmpl renamed to k8s/api.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ spec:
2525
- name: MONGO_CREATE_INDICES
2626
value: "true"
2727
- name: NODE_ENDPOINT
28-
value: NODEENDPOINT
28+
value: {{NODE_ENDPOINT}}
2929
- name: REINDEX_ENDPOINT
3030
value: http://sirato-ingestion/reindex
3131
---

k8s/ingestion-deployment.yml.tmpl renamed to k8s/ingestion.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ spec:
2222
- name: MONGO_DB_NAME
2323
value: epirus
2424
- name: NODE_ENDPOINT
25-
value: NODEENDPOINT
25+
value: {{NODE_ENDPOINT}}
2626
image: web3labs/epirus-free-ingestion:latest
2727
name: ingestion
2828
resources: {}
File renamed without changes.

k8s/proxy.yml.tmpl renamed to k8s/proxy.yml

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,11 @@ metadata:
55
data:
66
nginx.conf: |
77
user nginx;
8-
worker_processes 3;
98
error_log /var/log/nginx/error.log;
109
events {
11-
worker_connections 10240;
1210
}
1311
http {
14-
log_format main
15-
'remote_addr:$remote_addr\t'
16-
'time_local:$time_local\t'
17-
'method:$request_method\t'
18-
'uri:$request_uri\t'
19-
'host:$host\t'
20-
'status:$status\t'
21-
'bytes_sent:$body_bytes_sent\t'
22-
'referer:$http_referer\t'
23-
'useragent:$http_user_agent\t'
24-
'forwardedfor:$http_x_forwarded_for\t'
25-
'request_time:$request_time';
26-
access_log /var/log/nginx/access.log main;
12+
access_log /var/log/nginx/access.log;
2713
server {
2814
listen 80;
2915
server_name _;
@@ -74,7 +60,6 @@ spec:
7460
emptyDir: {}
7561
restartPolicy: Always
7662
---
77-
---
7863
apiVersion: v1
7964
kind: Service
8065
metadata:

k8s/sirato-destroy.sh

100644100755
Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,6 @@
1-
#!/bin/bash
1+
#!/usr/bin/env bash
2+
set -eu
23

3-
echo ---------------- Deleting Epirus-mogodb PoD and Service ----------------
4-
kubectl delete -f mongodb-deployment.yml
5-
6-
echo ---------------- Deleting Epirus-web PoD and Service ----------------
7-
kubectl delete -f web-deployment.yml
8-
9-
echo ---------------- Deleting Epirus-api PoD and Service ----------------
10-
kubectl delete -f api-deployment.yml
11-
12-
echo ---------------- Deleting Epirus-ingestion PoD ----------------
13-
kubectl delete -f ingestion-deployment.yml
14-
15-
echo ---------------- Deleting Proxy PoD ----------------
16-
kubectl delete -f proxy.yml
17-
18-
echo ---------------- Deleting vmbc-sirato Namespace ----------------
4+
kubectl delete --all deployments -n sirato-explorer
5+
kubectl delete --all services -n sirato-explorer
196
kubectl delete namespace sirato-explorer
20-
21-
echo ---------------- Removing tmp files ----------------
22-
rm -rvf mongodb-deployment.yml web-deployment.yml api-deployment.yml ingestion-deployment.yml proxy.yml
23-
24-
echo ========================== DONE ===========================

k8s/sirato-launch.sh

100644100755
Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,26 @@
11
#!/usr/bin/env bash
2-
set -e
2+
set -eu
33

4-
endpoint=""
4+
NAMESPACE="sirato-explorer"
5+
ENDPOINT=""
56

67
if [ $# -eq 1 ]; then
78
echo "Using endpoint: $1"
8-
endpoint=$1
9+
ENDPOINT=$1
910
else
10-
echo "Please specify a node endpoint"
11+
echo "Usage: $0 <RPC_URL>"
12+
echo "Example: $0 https://your.evm.net:8545/"
1113
exit 1
1214
fi
1315

14-
NAMESPACE="sirato-explorer"
15-
16-
kubectl create namespace ${NAMESPACE}
16+
kubectl create namespace $NAMESPACE
1717

18-
cp api-deployment.yml.tmpl api-deployment.yml
19-
cp ingestion-deployment.yml.tmpl ingestion-deployment.yml
20-
cp mongodb-deployment.yml.tmpl mongodb-deployment.yml
21-
cp web-deployment.yml.tmpl web-deployment.yml
22-
cp proxy.yml.tmpl proxy.yml
18+
kubectl create -n $NAMESPACE -f mongodb.yml
19+
sed "s|{{NODE_ENDPOINT}}|$ENDPOINT|g" ingestion.yml | kubectl create -n $NAMESPACE -f -
20+
sed "s|{{NODE_ENDPOINT}}|$ENDPOINT|g" api.yml | kubectl create -n $NAMESPACE -f -
21+
kubectl create -n $NAMESPACE -f web.yml,proxy.yml
2322

24-
if [ "$ARCH" == "Darwin" ]; then
25-
sed -i '' "s|NODEENDPOINT|$endpoint|g" "ingestion-deployment.yml"
26-
sed -i '' "s|NODEENDPOINT|$endpoint|g" "api-deployment.yml"
27-
else
28-
sed -i "s|NODEENDPOINT|$endpoint|g" "ingestion-deployment.yml"
29-
sed -i "s|NODEENDPOINT|$endpoint|g" "api-deployment.yml"
30-
fi
23+
kubectl get pods -n $NAMESPACE
24+
kubectl get svc -n $NAMESPACE
3125

32-
kubectl create -f mongodb-deployment.yml,api-deployment.yml,ingestion-deployment.yml,web-deployment.yml,proxy.yml
26+
echo -e "\n🎉 If you are in Minikube you can run 'minikube service sirato-proxy -n ${NAMESPACE}' to get an ingress URL"
File renamed without changes.

0 commit comments

Comments
 (0)