Skip to content

Commit 1ba4b4e

Browse files
committed
fix: simplify docker-compose with 8090:8090 P2P port, remove bootnode
1 parent e240041 commit 1ba4b4e

File tree

1 file changed

+22
-93
lines changed

1 file changed

+22
-93
lines changed

docker-compose.yml

Lines changed: 22 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -1,137 +1,66 @@
11
# =============================================================================
22
# Platform Validator Configuration
33
# =============================================================================
4-
# Fully decentralized P2P architecture
5-
#
64
# Usage:
7-
# export VALIDATOR_SECRET_KEY="your-mnemonic-or-hex-key"
5+
# cp .env.example .env
6+
# # Edit .env with your VALIDATOR_SECRET_KEY
87
# docker compose up -d
98
# =============================================================================
109

1110
services:
12-
# ==========================================================================
13-
# Platform Bootnode - P2P Discovery Relay
14-
# ==========================================================================
15-
# The bootnode is the first node validators connect to for peer discovery.
16-
# Its PeerId is derived from BOOTNODE_SECRET_KEY, so keep the same key
17-
# to maintain a stable PeerId across restarts.
18-
#
19-
# To get the PeerId, start the bootnode and look for the log line:
20-
# "P2P network initialized, local peer: PeerId("12D3KooW...")"
21-
#
22-
# Then tell validators to bootstrap with:
23-
# --bootstrap /ip4/<BOOTNODE_IP>/tcp/8090/p2p/<PEER_ID>
24-
# ==========================================================================
25-
bootnode:
26-
image: platform-bootnode:latest
27-
container_name: platform-bootnode
28-
restart: unless-stopped
29-
30-
ports:
31-
- "8090:8090" # P2P libp2p port
32-
33-
volumes:
34-
- bootnode-data:/data
35-
36-
environment:
37-
- RUST_LOG=info,validator_node=debug,platform_p2p_consensus=info
38-
- DATA_DIR=/data
39-
- BOOTNODE_SECRET_KEY=${BOOTNODE_SECRET_KEY}
40-
- SUBTENSOR_ENDPOINT=wss://entrypoint-finney.opentensor.ai:443
41-
- NETUID=100
42-
- P2P_PORT=8090
43-
44-
healthcheck:
45-
test: ["CMD-SHELL", "test -e /data/distributed.db || exit 1"]
46-
interval: 30s
47-
timeout: 10s
48-
retries: 3
49-
start_period: 30s
50-
51-
networks:
52-
- platform
53-
5411
# ==========================================================================
5512
# Platform Validator Node
5613
# ==========================================================================
5714
validator:
5815
image: ghcr.io/platformnetwork/platform:latest
5916
container_name: platform-validator
6017
restart: unless-stopped
61-
depends_on:
62-
- bootnode
63-
# SECURITY NOTE: Privileged mode is required for Docker-in-Docker to spawn challenge containers.
64-
# This is necessary for the decentralized evaluation architecture where validators run
65-
# challenge containers locally. If you don't need to run challenges, remove this line.
66-
privileged: true
67-
68-
# Enable Watchtower auto-update for this container only
18+
6919
labels:
7020
- "com.centurylinklabs.watchtower.enable=true"
71-
21+
7222
ports:
73-
- "8091:8090" # P2P libp2p port (external 8091 to avoid conflict with bootnode)
74-
- "8080:8080" # Local RPC API
75-
23+
- "8080:8080" # JSON-RPC API
24+
- "8090:8090" # P2P libp2p
25+
7626
volumes:
7727
- validator-data:/data
78-
- /var/run/docker.sock:/var/run/docker.sock
79-
28+
8029
environment:
81-
- RUST_LOG=info,validator_node=debug,platform_p2p_consensus=debug
30+
- RUST_LOG=${RUST_LOG:-info,validator_node=debug}
8231
- DATA_DIR=/data
8332
- VALIDATOR_SECRET_KEY=${VALIDATOR_SECRET_KEY}
84-
# Subtensor endpoint (Bittensor mainnet)
85-
- SUBTENSOR_ENDPOINT=wss://entrypoint-finney.opentensor.ai:443
86-
# Network UID for this subnet
87-
- NETUID=100
88-
# P2P settings
89-
- P2P_LISTEN_ADDR=/ip4/0.0.0.0/tcp/8090
90-
# Bootstrap to local bootnode via Docker network
91-
- BOOTSTRAP_PEERS=/dns4/bootnode/tcp/8090/p2p/12D3KooWSpDLH6kBTHuHhJCmS4vZMhuTZa1T35qJYd9NgSVdzGnP
92-
33+
- SUBTENSOR_ENDPOINT=${SUBTENSOR_ENDPOINT:-wss://entrypoint-finney.opentensor.ai:443}
34+
- NETUID=${NETUID:-100}
35+
- RPC_PORT=8080
36+
- P2P_PORT=8090
37+
- WITH_BOOTNODE=${WITH_BOOTNODE:-true}
38+
- BOOTNODE_PORT=8090
39+
9340
healthcheck:
94-
test: ["CMD-SHELL", "test -e /data/distributed.db || exit 1"]
41+
test: ["CMD-SHELL", "curl -sf http://localhost:8080/health || exit 1"]
9542
interval: 30s
9643
timeout: 10s
9744
retries: 3
98-
start_period: 30s
99-
100-
networks:
101-
- platform
45+
start_period: 60s
10246

10347
# ==========================================================================
104-
# Watchtower - Auto-update platform container only
48+
# Watchtower - Auto-update validator
10549
# ==========================================================================
10650
watchtower:
107-
image: nickfedor/watchtower@sha256:053e7ecba848b77eb5b966d236c2f4f2e1155e05007c9ef52418b4b7e255484b
51+
image: containrrr/watchtower:latest
10852
container_name: platform-watchtower
10953
restart: unless-stopped
110-
54+
11155
volumes:
11256
- /var/run/docker.sock:/var/run/docker.sock
113-
57+
11458
environment:
115-
# Only update containers with label "com.centurylinklabs.watchtower.enable=true"
11659
- WATCHTOWER_LABEL_ENABLE=true
117-
# Check at :00, :05, :10, :15... (all validators sync at same time)
11860
- WATCHTOWER_SCHEDULE=0 */5 * * * *
119-
# Remove old images after update
12061
- WATCHTOWER_CLEANUP=true
121-
# Include stopped containers
122-
- WATCHTOWER_INCLUDE_STOPPED=false
123-
# Logging
12462
- WATCHTOWER_LOG_LEVEL=info
125-
126-
networks:
127-
- platform
12863

12964
volumes:
130-
bootnode-data:
131-
driver: local
13265
validator-data:
13366
driver: local
134-
135-
networks:
136-
platform:
137-
driver: bridge

0 commit comments

Comments
 (0)