Operations Command Reference

This reference covers the commands used to operate a self-hosted instance day to day.

All Compose commands assume you’re in the docker-compose directory of the backend repository.


Service lifecycle

Terminal window
# Start the stack in the background
docker compose up -d
# Stop the stack (data persists)
docker compose down
# Stop and DELETE all indexed data
docker compose down -v
# Restart one service
docker compose restart backend
# Recreate a service after config changes
docker compose up -d --force-recreate backend
# Update to the latest images
docker compose pull && docker compose up -d

Logs

Terminal window
# Follow backend (indexer + API) logs
docker compose logs -f backend
# Last hour of frontend logs
docker compose logs --since 1h frontend
# Filter a specific fetcher module
docker compose logs backend | grep "Indexer.Fetcher.Block"
# Export a day of logs for analysis
docker compose logs --since 24h backend > backend.log

Health and status

Terminal window
# Container status and resource usage
docker compose ps
docker stats
# Indexing status
curl -s http://localhost:4000/api/v2/main-page/indexing-status
# API liveness
curl -fsS http://localhost:4000/api/v2/stats > /dev/null && echo OK
# RPC endpoint reachability (from the host)
curl -X POST $ETHEREUM_JSONRPC_HTTP_URL \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}'

Database

Terminal window
# Open a psql shell
docker compose exec db psql -U postgres blockscout
# Logical backup
docker compose exec db pg_dump -U postgres blockscout | gzip > backup.sql.gz
# Restore
gunzip -c backup.sql.gz | docker compose exec -T db psql -U postgres blockscout
# Database size
docker compose exec db psql -U postgres -c \
"SELECT pg_size_pretty(pg_database_size('blockscout'));"

Source-install operations

Terminal window
# Run migrations manually
mix ecto.migrate
# Reset the local database (dev only)
mix ecto.drop && mix ecto.create && mix ecto.migrate
# Test suite
mix test
# Format and lint
mix format --check-formatted
mix credo --strict

Troubleshooting quick reference

TaskCommand
Is the indexer caught up?curl localhost:4000/api/v2/main-page/indexing-status
Is the RPC endpoint alive?eth_blockNumber call above
Which service is crash-looping?docker compose ps (look at STATUS)
Why did the backend restart?docker compose logs --tail 200 backend
How full is the disk?df -h

See Maintenance & Operations for the runbooks behind these commands, and Monitoring for alerting thresholds.