-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
137 lines (125 loc) · 3.49 KB
/
Copy pathdocker-compose.yml
File metadata and controls
137 lines (125 loc) · 3.49 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
version: '3.8'
services:
# PostgreSQL Database
postgres:
image: postgres:15-alpine
container_name: weinsure-postgres
environment:
POSTGRES_DB: weinsure
POSTGRES_USER: weinsure_user
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-weinsure_password}
volumes:
- postgres_data:/var/lib/postgresql/data
- ./scripts/init-db.sql:/docker-entrypoint-initdb.d/init-db.sql
ports:
- "5432:5432"
networks:
- weinsure-network
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "pg_isready -U weinsure_user -d weinsure"]
interval: 10s
timeout: 5s
retries: 5
# Redis Cache
redis:
image: redis:7-alpine
container_name: weinsure-redis
ports:
- "6379:6379"
volumes:
- redis_data:/data
networks:
- weinsure-network
restart: unless-stopped
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
# WeInsure Application
weinsure-app:
build:
context: .
dockerfile: Dockerfile
container_name: weinsure-app
environment:
# Database
DATABASE_URL: postgresql://weinsure_user:${POSTGRES_PASSWORD:-weinsure_password}@postgres:5432/weinsure
REDIS_URL: redis://redis:6379
# Application
NODE_ENV: production
# Blockchain
RPC_URL: ${RPC_URL}
PRIVATE_KEY: ${PRIVATE_KEY}
NETWORK: ${NETWORK:-sepolia}
# Contract Addresses
POLICY_FACTORY_ADDRESS: ${POLICY_FACTORY_ADDRESS}
POLICY_NFT_ADDRESS: ${POLICY_NFT_ADDRESS}
ESCROW_ADDRESS: ${ESCROW_ADDRESS}
TRIGGER_CONTRACT_ADDRESS: ${TRIGGER_CONTRACT_ADDRESS}
MOCK_USDC_ADDRESS: ${MOCK_USDC_ADDRESS}
# API Keys
OPENWEATHER_API_KEY: ${OPENWEATHER_API_KEY}
WEATHER_API_KEY: ${WEATHER_API_KEY}
ETHERSCAN_API_KEY: ${ETHERSCAN_API_KEY}
# Security
JWT_SECRET: ${JWT_SECRET}
# Frontend URLs
NEXT_PUBLIC_API_URL: http://localhost:3001
NEXT_PUBLIC_RPC_URL: ${RPC_URL}
NEXT_PUBLIC_CHAIN_ID: ${CHAIN_ID:-11155111}
NEXT_PUBLIC_POLICY_FACTORY_ADDRESS: ${POLICY_FACTORY_ADDRESS}
NEXT_PUBLIC_POLICY_NFT_ADDRESS: ${POLICY_NFT_ADDRESS}
NEXT_PUBLIC_ESCROW_ADDRESS: ${ESCROW_ADDRESS}
NEXT_PUBLIC_TRIGGER_CONTRACT_ADDRESS: ${TRIGGER_CONTRACT_ADDRESS}
NEXT_PUBLIC_MOCK_USDC_ADDRESS: ${MOCK_USDC_ADDRESS}
NEXT_PUBLIC_ETHERSCAN_URL: ${ETHERSCAN_URL:-https://sepolia.etherscan.io}
ports:
- "3000:3000" # Frontend
- "3001:3001" # Backend API
- "3002:3002" # Oracle Service
volumes:
- ./logs:/app/logs
- app_data:/app/data
networks:
- weinsure-network
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
restart: unless-stopped
healthcheck:
test: ["CMD", "node", "scripts/health-check.js"]
interval: 30s
timeout: 10s
retries: 3
start_period: 60s
# Nginx Reverse Proxy (Optional)
nginx:
image: nginx:alpine
container_name: weinsure-nginx
ports:
- "80:80"
- "443:443"
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
- ./ssl:/etc/nginx/ssl:ro
networks:
- weinsure-network
depends_on:
- weinsure-app
restart: unless-stopped
profiles:
- production
volumes:
postgres_data:
driver: local
redis_data:
driver: local
app_data:
driver: local
networks:
weinsure-network:
driver: bridge