This tutorial will guide you through the process of deploying your own Soroban RPC (Remote Procedure Call) server on DigitalOcean's Kubernetes platform. Soroban is Stellar's smart contract platform, and having your own RPC server allows you to interact with the Stellar network for smart contract operations without relying on public infrastructure.
Benefits of deploying your own Soroban RPC server:
By the end of this tutorial, you'll have a fully functional Soroban RPC server accessible via your custom domain.
This tutorial is designed for developers with:
While prior experience with these technologies is helpful, we'll provide detailed explanations for each step.
A Kubernetes cluster on DigitalOcean has one or more node pools. Each node pool consists of a group of identical worker nodes. Worker nodes are built on Droplets. For this tutorial, we can build a cluster with two worker nodes in one node pool.
a. Log into your DigitalOcean account and navigate to the Kubernetes section.
b. Click "Create Cluster" and choose the following settings:
c. Click "Create Cluster" and wait for provisioning (this may take several minutes).
Rationale: This cluster configuration provides a balance between cost and reliability for a personal RPC server.
If you want to create a single node cluster, you will have to select a larger node size.
While the cluster is being provisioned, we can follow along with the rest of the setup instructions that appear under the Overview tab by clicking on Get Started
The first step in connecting to Kubernetes requires additional applications:
https://docs.digitalocean.com/reference/doctl/how-to/install/
https://kubernetes.io/docs/tasks/tools/
https://helm.sh/docs/intro/install/
doctl
commandRationale: These tools are essential for managing your Kubernetes cluster and deploying applications.
Display addresses of the control plane and cluster services
Displays a variety of commands that help manage your cluster via DigitalOcean's API
Stellar Development Foundation (SDF) provides Helm charts for easy deployment of Stellar applications.
We will first need to add the Helm Chart repository to our system using the following helm commands:
The helm repo add command adds the chart repository to your local Helm registry
The helm repo update command updates the information of available charts locally from the chart repositories you have added to your Helm registry.
Rationale: This step allows you to easily install and manage Stellar applications on your Kubernetes cluster.
Now that we have added the SDF chart repository to our local registry and updated the charts that are available to us, we can now deploy a workload using one of the charts available.
a. Create a local deployment configuration file:
soroban-rpc-values.yaml
on your local machineSince we will be connecting our RPC server to testnet, we can uncomment update Soroban RPC image tag to the latest version
sorbanRpc:
....
tag: latest
For the ingress section in the configuration file, add your fully registered domain name for the host value
We also want to uncomment and update the Ingress class name
After we have finished with our configuration file, we can use that to install Soroban RPC into our Kubernetes cluster
Rationale: This configuration sets up your RPC server to use the latest version and prepares it for public access via your domain.
Check the status of your service
Check the status of your pods
You should see pods related to Soroban RPC in a "Running" state.
Even though we have verified that our service is running on our cluster in the previous step, we still cannot access the service from the outside. For that we will need to create an ingress, an ingress is a way for us to expose our service to the outside world. We will use the nginx ingress and we will first need to add the Nginx Helm Chart Repository to our system.
The Nginx Ingress Controller manages external access to your services.
Add Nginx Ingress Helm Chart Repository to Your System:
We can now install the nginx ingress into our Kubernetes cluster
Run this command to watch the load balancer become available. This process creates a load balancer in the cluster resource group in DigitalOcean.
Rationale: The Ingress Controller allows external traffic to reach your RPC server securely.
a. Go to your domain registrar's DNS management page.
b. Create an A record:
c. Save the changes and wait for DNS propagation (can take up to 48 hours, but often much faster).
Rationale: This step connects your domain name to the DigitalOcean load balancer, allowing access to your RPC server.
Once DNS has propagated, test your RPC server:
If you need to remove the deployment: