File tree Expand file tree Collapse file tree 7 files changed +166
-0
lines changed
Expand file tree Collapse file tree 7 files changed +166
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Deploy to Google Cloud
2+
3+ on :
4+ push :
5+ branches : [main]
6+ tags : [v*]
7+
8+ jobs :
9+ deploy-google :
10+ runs-on : ubuntu-latest
11+
12+ steps :
13+ - name : Checkout Repository
14+ uses : actions/checkout@v4
15+
16+ - name : Set up Google Cloud CLI
17+ uses : google-github-actions/auth@v2
18+ with :
19+ credentials_json : ${{ secrets.GCP_CREDENTIALS }}
20+
21+ - name : Set up Cloud SDK
22+ uses : google-github-actions/setup-gcloud@v2
23+
24+ - name : Set up docker auth
25+ run : gcloud auth configure-docker
26+
27+ - name : Build and Push Binary & Migration Images
28+ run : |
29+ BINARY_IMAGE=gcr.io/eth-cloud-mb/evm-indexer:latest
30+ MIGRATION_IMAGE=gcr.io/eth-cloud-mb/evm-indexer-migration:latest
31+ DOCKERFILE_PATH=docker/Dockerfile
32+
33+ docker build -t $BINARY_IMAGE -f $DOCKERFILE_PATH.binary .
34+ docker push $BINARY_IMAGE
35+
36+ docker build -t $MIGRATION_IMAGE -f $DOCKERFILE_PATH.migration .
37+ docker push $MIGRATION_IMAGE
Original file line number Diff line number Diff line change 11/target
22.env
3+ ** /secrets.yaml
Original file line number Diff line number Diff line change 1+ # TODO - make this dynamic on network
2+ NETWORK = mainnet
3+
4+ delete :
5+ kontemplate delete values-$(NETWORK ) .yaml
6+
7+ apply :
8+ kontemplate apply values-$(NETWORK ) .yaml
9+
10+ hard-restart : delete apply
11+
12+ restart :
13+ kubectl rollout restart deployment evm-indexer-processor
Original file line number Diff line number Diff line change 1+ ## Basic Usage (with kontemplate)
2+
3+ Install [ kontemplate] ( https://code.tvl.fyi/tree/ops/kontemplate )
4+
5+ From within this directory
6+
7+ ### Configure Secrets
8+
9+ 1 . Encode your secret(s)
10+
11+ ``` shell
12+ echo -n ' Your secret value' | base64
13+ ```
14+
15+ 2 . Put into the [ secrets files] ( ./config/secrets.example.yaml ) in place of ` DO_NOT_ACTUALLY_PUT_SECRETS_HERE `
16+
17+
18+ 3 . Apply secrets
19+ ``` shell
20+ kubectl apply -f config/secrets.yaml
21+ ```
22+
23+ ### Delete Pod and Restart
24+
25+ ``` sh
26+ kontemplate delete values.yaml
27+ kontemplate apply values.yaml
28+ ```
29+
30+ or use the make file
31+
32+ ``` shell
33+ make hard-restart
34+ ```
35+
36+ to check status and observe logs:
37+
38+ ``` sh
39+ kubectl get pods
40+ kubectl logs -f [POD_NAME]
41+ ```
42+
43+ or, for convenience:
44+
45+ ``` shell
46+ kubectl logs -f $( kubectl get pods | grep arak-indexer | awk ' {print $1}' )
47+ ```
Original file line number Diff line number Diff line change 1+ apiVersion : apps/v1
2+ kind : Deployment
3+ metadata :
4+ name : {{ .ProjectName }}-processor
5+ namespace : {{ .Namespace }}
6+ spec :
7+ replicas : 1
8+ selector :
9+ matchLabels :
10+ app : {{ .ProjectName }}
11+ template :
12+ metadata :
13+ labels :
14+ app : {{ .ProjectName }}
15+ spec :
16+ containers :
17+ - name : {{ .ProjectName }}
18+ image : {{ .ContainerRepo }}/{{ .ProjectName }}:{{ .ImageTag }}
19+ imagePullPolicy : Always
20+ args : ["event-handler"]
21+ env :
22+ - name : LOG
23+ value : " info,event_handler=debug,eth=debug"
24+ - name : DB_SCHEMA
25+ value : {{ .Network }}
26+ - name : CHAIN_SOURCE
27+ value : " database"
28+ - name : PAGE_SIZE
29+ value : " 10"
30+ - name : NODE_URL
31+ valueFrom :
32+ secretKeyRef :
33+ name : indexer-secrets
34+ key : NODE_URL
35+
36+ - name : SOURCE_URL
37+ valueFrom :
38+ secretKeyRef :
39+ name : indexer-secrets
40+ key : SOURCE_URL
41+
42+ - name : STORE_URL
43+ valueFrom :
44+ secretKeyRef :
45+ name : indexer-secrets
46+ key : STORE_URL
Original file line number Diff line number Diff line change 1+ apiVersion : v1
2+ kind : Secret
3+ metadata :
4+ name : indexer-secrets
5+ type : Opaque
6+ data :
7+ SOURCE_URL : DO_NOT_ACTUALLY_PUT_SECRETS_HERE
8+ STORE_URL : DO_NOT_ACTUALLY_PUT_SECRETS_HERE
9+ NODE_URL : DO_NOT_ACTUALLY_PUT_SECRETS_HERE
Original file line number Diff line number Diff line change 1+ global :
2+ Namespace : default
3+ PodName : event-processor
4+ ContainerRepo : gcr.io/eth-cloud-mb
5+ ProjectName : evm-indexer
6+ ImageTag : latest
7+ Network : mainnet
8+
9+ include :
10+ # Notice how secrets are not explicitly included.
11+ # This is because you should kubectl create and apply them
12+ - name : " deployment"
13+ path : " config/pod.yaml"
You can’t perform that action at this time.
0 commit comments