Sign inSign up

andremiras/canto

By andremiras

Updated 5 months ago

Image
0

6.6K

andremiras/canto repository overview

Docker Canto

Build Docker Hub GHCR

Canto images for all versions, available in two flavours:

FlavourTag exampleDescription
stock8.1.3, latestMinimal Alpine image with just the cantod binary
managed8.1.3-managedAdds env-var config templating, auto-init, and entrypoint

Images are published to both Docker Hub and GitHub Container Registry:

# Stock
docker pull andremiras/canto:latest
docker pull ghcr.io/andremiras/canto:latest

# Managed
docker pull andremiras/canto:managed
docker pull ghcr.io/andremiras/canto:managed

Usage

Stock image

The stock image contains only the cantod binary. Use it when you manage configuration yourself or want a minimal base to build on:

docker run andremiras/canto

Or a specific version:

docker run andremiras/canto:8.1.3

Build your own image from it:

FROM andremiras/canto:8.1.3
RUN apk add vim
COPY my-config/ /root/.cantod/config/
Managed image

The managed image includes an entrypoint that auto-initialises the chain, downloads the genesis file, and renders config templates from environment variables:

docker run --env-file .env andremiras/canto:managed

Persisting chain data using volumes:

docker run --env-file .env --volume $(pwd)/data:/root/.cantod/data andremiras/canto:managed

Extend it with custom init scripts:

FROM andremiras/canto:managed
# any executable within /docker-entrypoint.d/ will get loaded
COPY ./20-extra-init.sh /docker-entrypoint.d/
RUN chmod u+x /docker-entrypoint.d/20-extra-init.sh

Runtime configuration (managed image)

Most settings from the ~/.cantod/config/*.toml files can be updated at runtime using environment variables. Each environment variable follows a pattern of: <FILENAME>_<SECTION>_<SETTING> e.g. CONFIG_STATESYNC_ENABLE

For instance to state sync a node:

CHAIN_ID=canto_7700-1
CONFIG_STATESYNC_ENABLE=true
CONFIG_STATESYNC_RPC_SERVERS=https://canto-rpc.polkachu.com:443,https://canto-rpc.polkachu.com:443
CONFIG_P2P_SEEDS=8542cd7e6bf9d260fef543bc49e59be5a3fa9074@seed.publicnode.com:26656

Or to sync an archive node from scratch:

APP_PRUNING=nothing
CHAIN_ID=canto_7700-1
CONFIG_STATESYNC_ENABLE=false
CONFIG_STATESYNC_TRUST_HEIGHT=0
VERSION=1.0.0
Docker Compose

Copy the example environment file and adjust as needed:

cp .env.example .env

Start the Canto node:

docker compose up
Ports and services

The default docker compose up exposes the following ports from the Canto node:

PortServiceProtocol
1317Cosmos REST APIHTTP
8545Ethereum JSON-RPCHTTP
8546Ethereum WebSocketWS
9090Cosmos gRPCgRPC
9091Cosmos gRPC-webHTTP
26656Tendermint P2PTCP
26657Tendermint RPCHTTP
Traefik reverse proxy

Start with the proxy profile to front all RPC services behind a Traefik reverse proxy with per-IP rate limiting (60 req/min, burst of 20):

docker compose --profile proxy up

Traefik listens on different host ports to avoid conflicts with the direct Canto ports:

Host portUpstreamService
11317canto:1317Cosmos REST API
18545canto:8545Ethereum JSON-RPC
18546canto:8546Ethereum WebSocket
19091canto:9090Cosmos gRPC
19092canto:9091Cosmos gRPC-web
36657canto:26657Tendermint RPC
8899Traefik metrics (Prometheus)

All Traefik host ports are configurable via environment variables (e.g. TRAEFIK_EVM_RPC_PORT, TRAEFIK_COSMOS_REST_PORT). The dynamic routing configuration lives in config/etc/traefik/dynamic.yml.

Monitoring

Optionally start with Prometheus and Grafana monitoring:

docker compose --profile monitoring up
PortService
19090Prometheus
3000Grafana

This starts Prometheus scraping Tendermint metrics from the node, and Grafana with a pre-configured Tendermint dashboard. The monitoring configuration lives under config/etc/.

Profiles can be combined:

docker compose --profile proxy --profile monitoring up
Systemd service

Update the WorkingDirectory path in docker-compose-canto.service. Then copy it over before enabling and starting it.

sudo cp docker-compose-canto.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable docker-compose-canto
sudo systemctl start docker-compose-canto

Check status and logs:

sudo systemctl status docker-compose-canto
sudo journalctl -u docker-compose-canto --follow --output cat

Tag summary

Content type

Image

Digest

sha256:66847d95d

Size

86.4 MB

Last updated

5 months ago

docker pull andremiras/canto