Implement stack for solana proxy
This commit is contained in:
parent
70cfd206c0
commit
f52093c5b1
3
stack/README.md
Normal file
3
stack/README.md
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# solana-proxy-stack
|
||||||
|
|
||||||
|
[solana-proxy stack documentation](./stack-orchestrator/stack/solana-proxy/README.md)
|
@ -0,0 +1,33 @@
|
|||||||
|
services:
|
||||||
|
# Builds and serves the solana proxy
|
||||||
|
solana-proxy:
|
||||||
|
restart: unless-stopped
|
||||||
|
image: cerc/solana-proxy:local
|
||||||
|
environment:
|
||||||
|
# Provider endpoints and auth (optional)
|
||||||
|
ALCHEMY_API_KEY: ${ALCHEMY_API_KEY}
|
||||||
|
HELIUS_API_KEY: ${HELIUS_API_KEY}
|
||||||
|
QUICKNODE_ENDPOINT: ${QUICKNODE_ENDPOINT}
|
||||||
|
QUICKNODE_TOKEN: ${QUICKNODE_TOKEN}
|
||||||
|
|
||||||
|
# Proxy settings
|
||||||
|
CACHE_SIZE_GB: 100
|
||||||
|
DISABLE_CACHE: ${DISABLE_CACHE}
|
||||||
|
BACKOFF_MINUTES: 30
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
LOG_LEVEL: ${LOG_LEVEL:-INFO}
|
||||||
|
ERROR_DB_PATH: /app/errors.db
|
||||||
|
command: ["solana-proxy"]
|
||||||
|
volumes:
|
||||||
|
- solana-proxy-data:/app
|
||||||
|
ports:
|
||||||
|
- "8545"
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8545').read()"]
|
||||||
|
interval: 30s
|
||||||
|
timeout: 10s
|
||||||
|
retries: 3
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
solana-proxy-data:
|
@ -0,0 +1,5 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Build cerc/solana-proxy
|
||||||
|
source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
|
||||||
|
docker build -t cerc/solana-proxy:local ${build_command_args} ${CERC_REPO_BASE_DIR}/solana-proxy
|
78
stack/stack-orchestrator/stack/solana-proxy/README.md
Normal file
78
stack/stack-orchestrator/stack/solana-proxy/README.md
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
# solana-proxy
|
||||||
|
|
||||||
|
Instructions for running the `solana-proxy` using [laconic-so](https://git.vdb.to/cerc-io/stack-orchestrator)
|
||||||
|
|
||||||
|
## Setup
|
||||||
|
|
||||||
|
* Clone the stack repo:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
laconic-so fetch-stack git.vdb.to/LaconicNetwork/solana-proxy
|
||||||
|
```
|
||||||
|
|
||||||
|
* Build the container image:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
laconic-so --stack ~/cerc/solana-proxy/stack/stack-orchestrator/stack/solana-proxy build-containers
|
||||||
|
```
|
||||||
|
|
||||||
|
This should create the `cerc/solana-proxy` image locally
|
||||||
|
|
||||||
|
## Create a deployment
|
||||||
|
|
||||||
|
* Create a spec file for the deployment:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
laconic-so --stack ~/cerc/solana-proxy/stack/stack-orchestrator/stack/solana-proxy deploy init --output solana-proxy-spec.yml
|
||||||
|
```
|
||||||
|
|
||||||
|
* Edit `network` in the spec file to map container ports to host ports as required:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
network:
|
||||||
|
ports:
|
||||||
|
solana-proxy:
|
||||||
|
- '8545:8545'
|
||||||
|
```
|
||||||
|
|
||||||
|
* Create a deployment from the spec file:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
laconic-so --stack ~/cerc/solana-proxy/stack/stack-orchestrator/stack/solana-proxy deploy create --spec-file solana-proxy-spec.yml --deployment-dir solana-proxy-deployment
|
||||||
|
```
|
||||||
|
|
||||||
|
## Configuration
|
||||||
|
|
||||||
|
* Inside the `solana-proxy-deployment` deployment directory, open `config.env` file and set following env variables:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Provider endpoints and auth (optional)
|
||||||
|
ALCHEMY_API_KEY=your_alchemy_key_here
|
||||||
|
HELIUS_API_KEY=your_helius_key_here
|
||||||
|
QUICKNODE_ENDPOINT=your_endpoint.quiknode.pro
|
||||||
|
QUICKNODE_TOKEN=your_quicknode_token_here
|
||||||
|
|
||||||
|
# Proxy settings
|
||||||
|
DISABLE_CACHE=true
|
||||||
|
LOG_LEVEL=INFO
|
||||||
|
```
|
||||||
|
|
||||||
|
The proxy will work without API keys using free endpoints, but adding them provides access to premium providers with better rate limits.
|
||||||
|
|
||||||
|
## Start the deployment
|
||||||
|
|
||||||
|
```bash
|
||||||
|
laconic-so deployment --dir solana-proxy-deployment start
|
||||||
|
```
|
||||||
|
|
||||||
|
The Solana RPC proxy will be available at:
|
||||||
|
- RPC endpoint: <http://localhost:8545>
|
||||||
|
- WebSocket endpoint: <ws://localhost:8545/ws>
|
||||||
|
|
||||||
|
## Clean up
|
||||||
|
|
||||||
|
* Stop the deployment:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
laconic-so deployment --dir solana-proxy-deployment stop
|
||||||
|
```
|
8
stack/stack-orchestrator/stack/solana-proxy/stack.yml
Normal file
8
stack/stack-orchestrator/stack/solana-proxy/stack.yml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
version: "1.0"
|
||||||
|
name: solana-proxy
|
||||||
|
description: "Solana proxy service"
|
||||||
|
containers:
|
||||||
|
- cerc/solana-proxy
|
||||||
|
pods:
|
||||||
|
- solana-proxy
|
||||||
|
|
Loading…
Reference in New Issue
Block a user