This docker-compose.yml
file defines the setup for the Story Project, which
consists of multiple utilities for managing blockchain nodes, monitoring, and
data visualization. Below are detailed explanations of each component, their
purpose, and how to use this setup.
- Docker and Docker Compose must be installed on your system.
- Set environment variables before running the services (you can create a
.env
file or export them directly).NETWORK
to specify the blockchain network configuration.IMAGE_TAG__STORY_GETH
for thestory-geth
service image version.IMAGE_TAG__STORY
for thestory
service image version.IMAGE_TAG__PROMETHEUS
for thestory-prometheus
image version.IMAGE_TAG__GRAFANA
for thestory-grafana
image version.
- Container Name:
story-geth
- Image:
piplabs/story-geth:${IMAGE_TAG__STORY_GETH}
- Purpose: This service runs a Geth (Go Ethereum) node for the Story blockchain.
- Ports:
- HTTP-RPC:
8545
- WebSocket-RPC:
8546
- Metrics:
6060
- Authenticated RPC:
8551
- Discovery Ports:
30304/tcp
,30303/udp
- HTTP-RPC:
- Volumes: Persists blockchain data at
db-story-geth
. - Logging: Uses JSON file logging with max size of 10MB and max of 3 log files.
- Container Name:
story
- Image:
piplabs/story:${IMAGE_TAG__STORY}
- Depends On:
story-geth
- Purpose: The main service for Story blockchain, interacting with the
story-geth
service. - Ports:
- HTTP-API:
1317
- P2P:
26656
- HTTP-RPC:
26657
- Metrics:
26660
- HTTP-API:
- Volumes:
- Uses
db-story-geth
for blockchain data. - Stores story data in
db-story-data
. - Uses a custom
config.toml
configuration file.
- Uses
- Environment Variables: Uses
NETWORK
to define the network settings.
- Container Name:
story-prometheus
- Image:
prom/prometheus:${IMAGE_TAG__PROMETHEUS}
- Purpose: Collects metrics from the blockchain nodes for monitoring.
- Ports:
- Prometheus Web UI:
9090
- Prometheus Web UI:
- Volumes:
- Uses a custom Prometheus configuration located at
./monitoring/prometheus.yml
. - Data is persisted at
db-story-prometheus
.
- Uses a custom Prometheus configuration located at
- Profiles:
monitoring
- Container Name:
story-grafana
- Image:
grafana/grafana:${IMAGE_TAG__GRAFANA}
- Depends On:
story-prometheus
- Purpose: Visualizes metrics collected by Prometheus for easy monitoring.
- Ports:
- Grafana Web UI:
3000
- Grafana Web UI:
- Volumes:
- Uses
db-story-grafana
to persist Grafana data. - Loads Grafana provisioning settings from
./monitoring/provisioning
and configuration from./monitoring/grafana.ini
.
- Uses
- Profiles:
monitoring
-
Set Up Environment Variables: Ensure you have defined the required environment variables (
IMAGE_TAG__STORY_GETH
,IMAGE_TAG__STORY
,IMAGE_TAG__PROMETHEUS
,IMAGE_TAG__GRAFANA
,NETWORK
). This can be done using a.env
file. -
Run Services: To start all services, use the following command:
docker-compose up -d
The
-d
flag runs the containers in detached mode. -
Access Services:
- Story Geth API:
http://localhost:8545
- Story API:
http://localhost:1317
- Prometheus Web UI:
http://localhost:9090
- Grafana Web UI:
http://localhost:3000
- Story Geth API:
-
Monitoring Setup: By default,
story-prometheus
andstory-grafana
are enabled under themonitoring
profile. You can activate these services by specifying the profile:docker-compose --profile monitoring up -d
-
Stopping the Services: To stop all services, run:
docker-compose down
This will stop and remove all containers.
-
Removing All Volumes: To stop all services and delete all associated Docker volumes, use:
docker-compose down -v
Adding the -v option will remove all volumes, including db-story-geth, db-story-data, and any other volumes created by the services.
All services are configured to use JSON file logging, with a maximum size of
10MB per log file and up to 3 files. Logs are stored within the container and
can be accessed with docker logs <container_name>
.
Persistent data is stored in named volumes to ensure that data such as blockchain state, Prometheus metrics, and Grafana configurations are retained even if containers are removed. The following volumes are used:
db-story-geth
: Blockchain data forstory-geth
.db-story-data
: Story blockchain data forstory
.db-story-prometheus
: Metric data for Prometheus.db-story-grafana
: Grafana configurations and dashboards.
- Make sure to modify the
.env
file and configuration files (prometheus.yml
,grafana.ini
, etc.) according to your requirements before running the services. - To update the images, pull the latest versions and recreate the containers:
docker-compose pull docker-compose up -d --force-recreate
- Unable to Connect to Grafana or Prometheus: Ensure that the
monitoring
profile is activated during service startup.