feat: Add complete Docker containerization for v4
Production & Development Setup: - Multi-stage Dockerfile with optimized build (node:20-alpine) - docker-compose.yml for production with PostgreSQL - docker-compose.dev.yml for development with hot reload - Dockerfile.dev for development environment - .dockerignore to reduce build context Features: - Health checks for both app and database - Non-root user security (nextjs:nodejs) - Resource limits (CPU/memory) - Volume persistence for logs and database - PostgreSQL 16 with automatic initialization - Network isolation with custom bridge network Helper Scripts: - docker-build.sh - Build production image - docker-start.sh - Start all services - docker-stop.sh - Stop containers safely - docker-logs.sh - View real-time logs Documentation: - DOCKER.md - Complete deployment guide with: * Quick start commands * Production deployment steps * Development hot reload setup * Configuration examples * Docker commands reference * Troubleshooting guide * Best practices for security & performance Configuration: - Environment-based configuration via .env - Safe defaults for testing ($50 positions) - Separate dev/prod compose files - Debug mode with Node.js inspector (port 9229) - Log rotation and resource monitoring Ready for deployment with: cd v4 && ./docker-start.sh
This commit is contained in:
43
v4/docker-start.sh
Executable file
43
v4/docker-start.sh
Executable file
@@ -0,0 +1,43 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Trading Bot v4 - Docker Start Script
|
||||
# Starts the trading bot in production mode
|
||||
|
||||
set -e
|
||||
|
||||
echo "🚀 Starting Trading Bot v4..."
|
||||
echo ""
|
||||
|
||||
# Navigate to v4 directory
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
# Check if .env exists
|
||||
if [ ! -f ".env" ]; then
|
||||
echo "❌ Error: .env file not found!"
|
||||
echo " Run: cp .env.example .env"
|
||||
echo " Then edit .env with your credentials"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if image exists
|
||||
if ! docker images | grep -q "trading-bot"; then
|
||||
echo "📦 Image not found. Building..."
|
||||
./docker-build.sh
|
||||
fi
|
||||
|
||||
# Start services
|
||||
echo "🐳 Starting containers..."
|
||||
docker-compose up -d
|
||||
|
||||
echo ""
|
||||
echo "✅ Trading Bot started!"
|
||||
echo ""
|
||||
echo "Status:"
|
||||
docker-compose ps
|
||||
echo ""
|
||||
echo "View logs:"
|
||||
echo " docker-compose logs -f trading-bot"
|
||||
echo ""
|
||||
echo "Stop bot:"
|
||||
echo " docker-compose down"
|
||||
echo ""
|
||||
Reference in New Issue
Block a user