|
1 | 1 | # ============================================================================= |
2 | 2 | # Platform Validator Configuration |
3 | 3 | # ============================================================================= |
4 | | -# Fully decentralized P2P architecture |
5 | | -# |
6 | 4 | # Usage: |
7 | | -# export VALIDATOR_SECRET_KEY="your-mnemonic-or-hex-key" |
| 5 | +# cp .env.example .env |
| 6 | +# # Edit .env with your VALIDATOR_SECRET_KEY |
8 | 7 | # docker compose up -d |
9 | 8 | # ============================================================================= |
10 | 9 |
|
11 | 10 | 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 | | - |
54 | 11 | # ========================================================================== |
55 | 12 | # Platform Validator Node |
56 | 13 | # ========================================================================== |
57 | 14 | validator: |
58 | 15 | image: ghcr.io/platformnetwork/platform:latest |
59 | 16 | container_name: platform-validator |
60 | 17 | 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 | + |
69 | 19 | labels: |
70 | 20 | - "com.centurylinklabs.watchtower.enable=true" |
71 | | - |
| 21 | + |
72 | 22 | 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 | + |
76 | 26 | volumes: |
77 | 27 | - validator-data:/data |
78 | | - - /var/run/docker.sock:/var/run/docker.sock |
79 | | - |
| 28 | + |
80 | 29 | environment: |
81 | | - - RUST_LOG=info,validator_node=debug,platform_p2p_consensus=debug |
| 30 | + - RUST_LOG=${RUST_LOG:-info,validator_node=debug} |
82 | 31 | - DATA_DIR=/data |
83 | 32 | - 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 | + |
93 | 40 | healthcheck: |
94 | | - test: ["CMD-SHELL", "test -e /data/distributed.db || exit 1"] |
| 41 | + test: ["CMD-SHELL", "curl -sf http://localhost:8080/health || exit 1"] |
95 | 42 | interval: 30s |
96 | 43 | timeout: 10s |
97 | 44 | retries: 3 |
98 | | - start_period: 30s |
99 | | - |
100 | | - networks: |
101 | | - - platform |
| 45 | + start_period: 60s |
102 | 46 |
|
103 | 47 | # ========================================================================== |
104 | | - # Watchtower - Auto-update platform container only |
| 48 | + # Watchtower - Auto-update validator |
105 | 49 | # ========================================================================== |
106 | 50 | watchtower: |
107 | | - image: nickfedor/watchtower@sha256:053e7ecba848b77eb5b966d236c2f4f2e1155e05007c9ef52418b4b7e255484b |
| 51 | + image: containrrr/watchtower:latest |
108 | 52 | container_name: platform-watchtower |
109 | 53 | restart: unless-stopped |
110 | | - |
| 54 | + |
111 | 55 | volumes: |
112 | 56 | - /var/run/docker.sock:/var/run/docker.sock |
113 | | - |
| 57 | + |
114 | 58 | environment: |
115 | | - # Only update containers with label "com.centurylinklabs.watchtower.enable=true" |
116 | 59 | - WATCHTOWER_LABEL_ENABLE=true |
117 | | - # Check at :00, :05, :10, :15... (all validators sync at same time) |
118 | 60 | - WATCHTOWER_SCHEDULE=0 */5 * * * * |
119 | | - # Remove old images after update |
120 | 61 | - WATCHTOWER_CLEANUP=true |
121 | | - # Include stopped containers |
122 | | - - WATCHTOWER_INCLUDE_STOPPED=false |
123 | | - # Logging |
124 | 62 | - WATCHTOWER_LOG_LEVEL=info |
125 | | - |
126 | | - networks: |
127 | | - - platform |
128 | 63 |
|
129 | 64 | volumes: |
130 | | - bootnode-data: |
131 | | - driver: local |
132 | 65 | validator-data: |
133 | 66 | driver: local |
134 | | - |
135 | | -networks: |
136 | | - platform: |
137 | | - driver: bridge |
0 commit comments