Skip to content

GCP

Prerequisites

Ensure that you have the following installed and configured:

1. Create a GKE Cluster

This command creates a new GKE cluster. Adjust the --zone, --machine-type, and node count options as needed.

gcloud container clusters create my-cluster --zone us-west1-a --machine-type n1-standard-1 --num-nodes=1 --enable-autoscaling --min-nodes=1 --max-nodes=3

Output:

Creating cluster my-cluster in us-west1-a... Cluster is being created.                                                                                                                                                                                                            
Created [https://container.googleapis.com/v1/projects/my-project/zones/us-west1-a/clusters/my-cluster].                                                                                                                           
To inspect the contents of your cluster, go to: https://console.cloud.google.com/kubernetes/workload_/gcloud/us-west1-a/my-cluster?project=my-project
kubeconfig entry generated for my-cluster.
NAME        LOCATION    MASTER_VERSION    MASTER_IP     MACHINE_TYPE   NODE_VERSION      NUM_NODES  STATUS
my-cluster  us-west1-a  v1.30.2-gke.100  35.233.164.24 n1-standard-1  v1.30.2-gke.100  1          RUNNING

gcloud automatically configures your kubeconfig file. To check your nodes:

kubectl get nodes

Output:

NAME                                          STATUS   ROLES    AGE     VERSION
gke-my-cluster-default-pool-1a2b3c4d-e123     Ready    <none>   6m33s   v1.30.2-gke.100

2. Deploy the Helm Chart

2.1. Download the rindexer repository

git clone https://github.com/joshstevens19/rindexer.git

2.2. Configure the values.yaml File

Customize the values.yaml for your deployment:

replicaCount: 2
 
image:
  repository: ghcr.io/joshstevens19/rindexer
  tag: "latest"
  pullPolicy: IfNotPresent
 
service:
  type: ClusterIP
  port: 3001
 
ingress:
  enabled: false
 
postgresql:
  enabled: false

2.3. Install the Helm Chart

helm install rindexer ./helm/rindexer -f helm/rindexer/values.yaml

Output:

NAME: rindexer
LAST DEPLOYED: Tue Aug 21 18:23:34 2024
NAMESPACE: default
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
1. Get the application URL by running these commands:
  export POD_NAME=$(kubectl get pods --namespace default -l "app.kubernetes.io/name=rindexer,app.kubernetes.io/instance=rindexer" -o jsonpath="{.items[0].metadata.name}")
  export CONTAINER_PORT=$(kubectl get pod --namespace default $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
  echo "Visit http://127.0.0.1:8080 to use your application"
  kubectl --namespace default port-forward $POD_NAME 8080:$CONTAINER_PORT

2.4. Verify the Deployment

kubectl get pods

Output:

NAME                                READY   STATUS    RESTARTS     AGE
rindexer-rindexer-35bb35619-t9r2l   1/1     Running   1 (7s ago)   17s

3. Monitor and Manage the Deployment

3.1. View Logs

kubectl logs -l app.kubernetes.io/name=rindexer

Output:

21 August - 17:32:17.710908  INFO RocketPoolETH::Transfer - network ethereum - 100.00% progress
21 August - 17:32:17.779423  INFO RocketPoolETH::Transfer - No events found between blocks 18999946 - 19000000
21 August - 17:32:17.779458  INFO RocketPoolETH::Transfer - COMPLETED - Finished indexing historic events
21 August - 17:32:18.825983  INFO RocketPoolETH::Approval - INDEXED - 4884 events - blocks: 18900000 - 19000000 - network: ethereum
21 August - 17:32:18.827845  INFO RocketPoolETH::Approval - network ethereum - 100.00% progress
21 August - 17:32:18.906260  INFO RocketPoolETH::Approval - No events found between blocks 18999896 - 19000000
21 August - 17:32:18.906299  INFO RocketPoolETH::Approval - COMPLETED - Finished indexing historic events
21 August - 17:32:18.906347  INFO Historical indexing complete - time taken: 2.599786906s
21 August - 17:32:18.906407  INFO Applying indexes if any back to the database as historic resync is complete
21 August - 17:32:18.906414  INFO rindexer resync is complete

3.2. Upgrade the Helm Chart

helm upgrade rindexer ./rindexer -f values.yaml

4. Clean Up

4.1. Uninstall the Helm Chart

helm uninstall rindexer

Output:

release "rindexer" uninstalled

4.2. Delete the EKS cluster

gcloud container clusters delete my-cluster --zone us-west1-a

Ouput:

The following clusters will be deleted.
 - [my-cluster] in [us-west1-a]
 
Do you want to continue (Y/n)?  Y
Deleting cluster my-cluster...done.
Deleted [https://container.googleapis.com/v1/projects/my-project/zones/us-west1-a/clusters/my-cluster].

This guide provides the necessary steps to deploy the rindexer Helm chart on Google Kubernetes Engine (GKE) using gcloud and kubectl.

Health Monitoring

Rindexer includes a built-in health monitoring server that provides comprehensive system status information. The health server runs on port 8080 by default and provides real-time insights into:

  • Database connectivity - PostgreSQL connection status
  • Indexing status - Whether the indexer is running and how many tasks are active
  • Sync status - Data synchronization health between different storage backends
  • Overall system health - Aggregated status across all components

Health Server Lifecycle

The health server's lifecycle depends on which services you start:

  • rindexer start indexer (with end_block set): Short-lived - dies when historical indexing completes
  • rindexer start indexer (no end_block set): Long-lived - stays alive for continuous live indexing
  • rindexer start graphql: No health server - health monitoring not available
  • rindexer start all: Long-lived - follows the GraphQL server lifecycle

Accessing Health Endpoints

The health server is automatically started when you run rindexer with indexing enabled. It provides the following endpoint:

  • GET /health - Complete health status with detailed service information

Example health response:

{
  "status": "healthy",
  "timestamp": "2024-01-15T10:30:00Z",
  "services": {
    "database": "healthy",
    "indexing": "healthy", 
    "sync": "healthy"
  },
  "indexing": {
    "active_tasks": 2,
    "is_running": true
  }
}

Health Status Types

The health endpoint returns different status types:

  • healthy - Service is functioning normally
  • unhealthy - Service has encountered an error
  • unknown - Status cannot be determined
  • not_configured - Service is not set up
  • disabled - Service is intentionally disabled
  • no_data - Service is working but no data is available
  • stopped - Service is not running

Monitoring in Production

For production deployments on GCP, you can:

  1. Set up monitoring alerts based on HTTP status codes:

    • 200 OK - System is healthy
    • 503 Service Unavailable - System has issues
  2. Use Google Cloud Monitoring to track health metrics

  3. Set up automated alerts when the health status changes to unhealthy

  4. Configure load balancer health checks to point to /health

  5. Access health endpoints through your GCP load balancer:

    https://your-load-balancer-ip:8080/health

Custom Health Port

You can configure the health server port in your rindexer.yaml file:

global:
  health_override_port: 8081