-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
114 lines (90 loc) · 2.94 KB
/
docker-compose.yml
File metadata and controls
114 lines (90 loc) · 2.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# Chi Subnet Docker Compose
#
# For Validators: Use this file to run the validator with auto-updates
#
# Usage:
# 1. Copy this file to your server
# 2. Update NETUID and wallet configuration
# 3. Run: docker-compose up -d
# 4. View logs: docker-compose logs -f validator
#
# Watchtower will automatically update the validator when new images are pushed
services:
validator:
# For production: use the Docker Hub image
# image: your-dockerhub-username/chi-subnet:latest
# For development: build locally
build: .
container_name: chi-validator
restart: unless-stopped
# Load environment variables from .env file
env_file:
- .env
environment:
# Network configuration
- NETWORK=${NETWORK:-finney}
- NETUID=${NETUID:-1}
# Wallet configuration (keys are mounted as volume)
- WALLET_NAME=${WALLET_NAME:-default}
- HOTKEY_NAME=${HOTKEY_NAME:-default}
# Logging
- LOG_LEVEL=${LOG_LEVEL:-INFO}
volumes:
# Mount wallet directory (read-only for security)
- ~/.bittensor/wallets:/root/.bittensor/wallets:ro
# Persistent storage for validator state/scores
- validator-data:/app/data
# Uncomment if your validator serves an axon
# ports:
# - "8091:8091"
# Resource limits - adjust based on your hardware
deploy:
resources:
limits:
memory: 4G
reservations:
memory: 2G
# Health check
healthcheck:
test: ["CMD", "python", "-c", "import bittensor; print('healthy')"]
interval: 30s
timeout: 10s
retries: 3
start_period: 60s
# Logging configuration
logging:
driver: "json-file"
options:
max-size: "100m"
max-file: "5"
# Labels for Watchtower
labels:
- "com.centurylinklabs.watchtower.enable=true"
# Watchtower - automatically updates containers when new images are available
watchtower:
image: containrrr/watchtower:latest
container_name: watchtower
restart: unless-stopped
environment:
# Check for updates every 5 minutes (300 seconds)
- WATCHTOWER_POLL_INTERVAL=300
# Clean up old images after updating
- WATCHTOWER_CLEANUP=true
# Only update containers with the enable label
- WATCHTOWER_LABEL_ENABLE=true
# Rolling restart - graceful updates
- WATCHTOWER_ROLLING_RESTART=true
# Uncomment for Slack notifications
# - WATCHTOWER_NOTIFICATIONS=slack
# - WATCHTOWER_NOTIFICATION_SLACK_HOOK_URL=${SLACK_WEBHOOK_URL}
# - WATCHTOWER_NOTIFICATION_SLACK_IDENTIFIER=${HOSTNAME:-chi-validator}
volumes:
# Watchtower needs Docker socket access to manage containers
- /var/run/docker.sock:/var/run/docker.sock
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
volumes:
validator-data: