The Blockscout VC Sidecar service monitors database changes in Supabase and automatically updates Docker container configurations and restarts services when necessary. This ensures that your Blockscout services are always running with the latest configuration. Intention is to make sure that changes made in Cloud Console are reflected in the running containers.
To configure the service, use a YAML file with the following structure:
supabaseRealtimeUrl: "wss://your-project.supabase.co/realtime/v1/websocket"
supabaseAnonKey: "your-anon-key"
pathToDockerCompose: "./config/docker-compose.yaml"
frontendServiceName: "frontend"
frontendContainerName: "frontend"
backendServiceName: "backend"
backendContainerName: "backend"
statsServiceName: "stats"
statsContainerName: "stats"
proxyServiceName: "proxy"
proxyContainerName: "proxy"
table: "silos"
chainId: 10The service includes basic authentication (username/password) to protect sensitive endpoints while maintaining public access to read-only operations.
Configure authentication in your config.yaml file:
# config.yaml
auth:
username: "admin"
password: "your-secure-password"GET /- Token Management DashboardGET /api/v1/tokens- Get unified tokens (merged from both local and Blockscout databases)GET /api/v1/tokens/:tokenAddress- Get unified token info by addressPOST /api/v1/tokens- Create/update tokens (automatically syncs icon_url to Blockscout)
GET /api/v1/chains/:chainId/token-infos/:tokenAddress- Get token information
Include credentials in the Authorization header or use curl's -u flag:
# For protected endpoints
curl -u username:password \
http://localhost:8080/api/v1/tokens/paginated
# Or with Authorization header
curl -H "Authorization: Basic $(echo -n 'username:password' | base64 -w0)" \
http://localhost:8080/api/v1/tokens/paginated
# For public endpoints (no auth required)
curl http://localhost:8080/api/v1/chains/1313161575/token-infos/0x123...If no auth.username and auth.password are set in config, authentication is disabled and all endpoints are accessible (useful for development).
The service can be deployed using Docker Compose. Below is an example configuration:
services:
sidecar:
command:
- sh
- -c
- /app/app sidecar --config /app/config/local.yaml
container_name: blockscout-vc-sidecar
image: ghcr.io/aurora-is-near/blockscout-vc:latest
restart: unless-stopped
environment:
# Authentication is configured via config.yaml file
# No environment variables needed for auth
volumes:
- ./config:/app/config
- /var/run/docker.sock:/var/run/docker.sock
- ./docker-compose.yaml:/app/config/docker-compose.yaml- Configuration files should be mounted in the
/app/configdirectory
Start the service:
docker compose up -dRestart the service:
docker compose up -d --force-recreateStop the service:
docker compose downView logs:
docker logs -f blockscout-vc-sidecar- Monitors Supabase database changes in real-time
- Automatically updates Docker Compose environment variables
- Restarts affected services when configuration changes
- Handles multiple service updates efficiently
- Prevents duplicate container restarts
- Validates configuration changes before applying
- Tracks explorer URL changes and updates related environment variables
- Uses template-based environment variable management
- Token Management Dashboard with embedded templates
- Basic Authentication for protected endpoints
- Public Token Info Access for read-only operations
- Go 1.21 or later
- Docker
- Docker Compose
- Clone the repository:
git clone https://github.com/blockscout/blockscout-vc-sidecar.git- Build the binary:
go build -o blockscout-vc-sidecar- Run with configuration:
./blockscout-vc-sidecar --config config/local.yamlblockscout-vc/
βββ cmd/
β βββ root.go
β βββ sidecar.go
βββ internal/
β βββ client/ # WebSocket client implementation
β βββ config/ # Configuration handling
β βββ docker/ # Docker operations
β βββ env/ # Environment variable management
β βββ handlers/ # Event handlers (name, coin, image, explorer)
β βββ heartbeat/ # Heartbeat logic
β βββ subscription/ # Supabase subscription logic
β βββ worker/ # Worker implementation
βββ config/
β βββ local.yaml # Configuration file
βββ main.go
| Parameter | Description | Required |
|---|---|---|
supabaseRealtimeUrl |
Supabase Realtime WebSocket URL | Yes |
supabaseAnonKey |
Supabase Anonymous Key | Yes |
pathToDockerCompose |
Path to the Docker Compose file | Yes |
frontendServiceName |
Name of the frontend service | Yes |
frontendContainerName |
Name of the frontend container | Yes |
backendServiceName |
Name of the backend service | Yes |
backendContainerName |
Name of the backend container | Yes |
statsServiceName |
Name of the stats service | Yes |
statsContainerName |
Name of the stats container | Yes |
proxyServiceName |
Name of the proxy service | Yes |
proxyContainerName |
Name of the proxy container | Yes |
table |
Name of the table to listen to | Yes |
chainId |
Chain ID to listen to | Yes |
pathToEnvFile |
Path to the environment file | Yes |
The sidecar service includes several handlers that respond to database changes:
- Name Handler: Updates network name and featured networks configuration
- Coin Handler: Updates cryptocurrency symbol and related settings
- Image Handler: Updates logo and favicon URLs
- Explorer Handler: Updates explorer URL and related environment variables
The Explorer Handler monitors changes to the explorer_url field in the database and automatically updates related environment variables:
BLOCKSCOUT_HOST: The main explorer hostMICROSERVICE_VISUALIZE_SOL2UML_URL: Visualization service URLNEXT_PUBLIC_FEATURED_NETWORKS: Featured networks configuration for the frontendNEXT_PUBLIC_API_HOST: Frontend API hostNEXT_PUBLIC_APP_HOST: Frontend app hostNEXT_PUBLIC_STATS_API_HOST: Stats API hostNEXT_PUBLIC_VISUALIZE_API_HOST: Visualization API hostSTATS__BLOCKSCOUT_API_URL: Stats service API URLEXPLORER_URL: Explorer host for nginx configurationBLOCKSCOUT_HTTP_PROTOCOL: Protocol (http/https) for nginx configuration
When the explorer URL changes, all affected services (backend, frontend, stats, proxy) are automatically restarted.
Enable debug logging by setting the environment variable:
export LOG_LEVEL=debugReleases are managed via GitHub with canonical versioning (e.g., 0.1.2). Ensure the versioning follows semantic versioning guidelines.
To release a new version:
- Create a release on GitHub, specifying the appropriate tag (following semantic versioning guidelines).
- This will trigger the build and push workflows to create a new Docker image and store it in the GitHub registry.