-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
137 lines (131 loc) · 5.01 KB
/
docker-compose.yml
File metadata and controls
137 lines (131 loc) · 5.01 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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# ╔══════════════════════════════════════════════════════════════╗
# ║ 🛫 YieldsPilot - Docker Compose ║
# ║ ║
# ║ Services: ║
# ║ api - Express REST API (port 3001, internal only) ║
# ║ agent - Autonomous yield management loop ║
# ║ monitor - Vault position monitor + Telegram alerts ║
# ║ dashboard - React frontend served via nginx ║
# ║ tunnel - Cloudflare Tunnel (public HTTPS access) ║
# ║ ║
# ║ Usage: ║
# ║ ./scripts/prod.sh up - build & start everything ║
# ║ ./scripts/prod.sh logs - tail logs ║
# ║ ./scripts/prod.sh stop - shut down ║
# ║ ║
# ║ Tunnel modes: ║
# ║ Named tunnel - set CLOUDFLARE_TUNNEL_TOKEN in .env ║
# ║ Quick tunnel - omit token for a temporary trycloudflare ║
# ║ URL (printed in tunnel logs) ║
# ╚══════════════════════════════════════════════════════════════╝
services:
# ── Express REST API ─────────────────────────────────
api:
build:
context: .
dockerfile: docker/api.Dockerfile
container_name: yieldpilot-api
restart: unless-stopped
env_file: .env
environment:
- NODE_ENV=production
volumes:
# Persist agent logs so the API can serve them
- ./data/agent_log.json:/app/agent_log.json
- ./data/agent_state.json:/app/agent_state.json
# Shared SQLite DB (agent writes, api reads)
- ./data/yieldpilot.db:/app/yieldpilot.db
healthcheck:
test: ["CMD", "wget", "-qO-", "http://localhost:3001/api/health"]
interval: 10s
timeout: 5s
start_period: 15s
retries: 3
logging:
driver: json-file
options:
max-size: "10m"
max-file: "3"
# ── Autonomous Agent ─────────────────────────────────
agent:
build:
context: .
dockerfile: docker/agent.Dockerfile
container_name: yieldpilot-agent
restart: unless-stopped
env_file: .env
environment:
- NODE_ENV=production
volumes:
# Persist agent logs outside container
- ./data/agent_log.json:/app/agent_log.json
- ./data/agent_state.json:/app/agent_state.json
# Shared SQLite DB (agent writes, api reads)
- ./data/yieldpilot.db:/app/yieldpilot.db
depends_on:
api:
condition: service_healthy
logging:
driver: json-file
options:
max-size: "10m"
max-file: "3"
# ── Vault Monitor ───────────────────────────────────
monitor:
build:
context: .
dockerfile: docker/monitor.Dockerfile
container_name: yieldpilot-monitor
restart: unless-stopped
env_file: .env
environment:
- NODE_ENV=production
logging:
driver: json-file
options:
max-size: "10m"
max-file: "3"
# ── Dashboard (Frontend) ────────────────────────────
dashboard:
build:
context: .
dockerfile: docker/frontend.Dockerfile
args:
VITE_NETWORK: ${VITE_NETWORK:-mainnet}
container_name: yieldpilot-dashboard
restart: unless-stopped
env_file: .env
depends_on:
api:
condition: service_healthy
healthcheck:
test: ["CMD", "wget", "-qO-", "http://127.0.0.1:3000"]
interval: 10s
timeout: 5s
retries: 3
logging:
driver: json-file
options:
max-size: "5m"
max-file: "2"
# ── Cloudflare Tunnel ────────────────────────────────
# Named tunnel: set CLOUDFLARE_TUNNEL_TOKEN in .env
# Quick tunnel: omit CLOUDFLARE_TUNNEL_TOKEN - a temporary
# trycloudflare.com URL will appear in the logs
tunnel:
image: cloudflare/cloudflared:latest
container_name: yieldpilot-tunnel
restart: unless-stopped
depends_on:
dashboard:
condition: service_healthy
env_file: .env
entrypoint: ["cloudflared", "--no-autoupdate"]
command: ["tunnel", "run", "--token", "${CLOUDFLARE_TUNNEL_TOKEN}"]
logging:
driver: json-file
options:
max-size: "5m"
max-file: "2"
volumes:
agent-data: