GitHub Actions CI/CD Pipeline (.github/workflows/ci.yml): - Automated testing for backend, frontend, and smart contracts - Security scanning with Trivy - Docker image building on main branch - Deployment validation checks - Multi-job workflow with dependency management Docker Infrastructure: - Production-optimized Dockerfile with multi-stage build - Base image: oven/bun:1 for fast runtime - Non-root user for security (botuser) - Health check integration - Optimized layer caching - docker-compose.yml for easy deployment - Single-command deployment - Volume management for logs and data - Network isolation - Health checks and restart policies - Ready for PostgreSQL and Redis integration - .dockerignore for optimized builds - Excludes node_modules, tests, docs - Reduces image size significantly DevOps Scripts: - scripts/healthcheck.ts - Container health verification - HTTP health endpoint check - Exit codes for Docker health status - Used by Docker HEALTHCHECK directive - scripts/monitor.ts - Bot monitoring and statistics - Real-time bot status display - Trading performance metrics (win rate, P/L) - System information - Watch mode for continuous monitoring - Performance indicators and alerts - scripts/backup.sh - Automated backup system - Backs up logs, data, configs - Excludes secrets for security - Compression and retention (keeps last 7) - Backup metadata and restore instructions - scripts/setup.sh - Developer onboarding - Interactive setup wizard - Dependency installation (Bun, Node.js) - Environment file creation - Directory structure setup - Optional Hardhat installation - Next steps guidance Environment Templates: - .env.development - Safe defaults for local dev - Testnet configuration - Conservative trading limits - Debug logging enabled - .env.production (template only, not committed) - Mainnet configuration - Production security settings - Monitoring integrations - Strong API key requirements Package.json Scripts: - monitor: Check bot status and performance - monitor⌚ Continuous monitoring - backup: Create system backups - setup: Run setup wizard - docker:build: Build Docker image - docker:run: Start with Docker Compose - docker:stop: Stop containers - docker:logs: View container logs - validate: Pre-deployment validation Documentation: - DOCKER.md - Complete Docker deployment guide - Quick start instructions - Configuration management - Multi-architecture builds - Docker Compose usage - Monitoring and logging - Backup and restore procedures - Production best practices - Troubleshooting guide - CI/CD integration examples This infrastructure enables: ✅ One-command deployment (docker-compose up) ✅ Automated testing and security scanning ✅ Production-grade monitoring and health checks ✅ Easy developer onboarding (setup.sh) ✅ Comprehensive backup and disaster recovery ✅ CI/CD pipeline for automated deployments ✅ Multi-environment support (dev/prod)
72 lines
2.1 KiB
Plaintext
72 lines
2.1 KiB
Plaintext
# ========================================
|
|
# DEVELOPMENT ENVIRONMENT
|
|
# ========================================
|
|
# This file contains safe defaults for local development
|
|
# Copy to .env and update with your actual values
|
|
|
|
# ========================================
|
|
# ENVIRONMENT
|
|
# ========================================
|
|
NODE_ENV=development
|
|
LOG_LEVEL=debug
|
|
|
|
# ========================================
|
|
# BLOCKCHAIN CONFIGURATION
|
|
# ========================================
|
|
# Use testnet for development
|
|
NETWORK=testnet
|
|
CHAIN_ID=5611
|
|
|
|
# RPC URLs (testnet)
|
|
BNB_RPC=https://opbnb-testnet-rpc.bnbchain.org
|
|
RPC_URL_TESTNET=https://opbnb-testnet-rpc.bnbchain.org
|
|
|
|
# Your testnet wallet private key (GET TESTNET BNB FROM FAUCET!)
|
|
WALLET_PRIVATE_KEY=0x0000000000000000000000000000000000000000000000000000000000000000
|
|
|
|
# ========================================
|
|
# AI CONFIGURATION
|
|
# ========================================
|
|
# Get from https://openrouter.ai/keys
|
|
OPENROUTER_API_KEY=sk-or-v1-0000000000000000000000000000000000000000000000000000000000000000
|
|
AI_MODEL=openai/gpt-4o-mini
|
|
|
|
# ========================================
|
|
# API SERVER
|
|
# ========================================
|
|
PORT=3001
|
|
API_PORT=3001
|
|
FRONTEND_URL=http://localhost:3000
|
|
|
|
# API key (optional for development)
|
|
API_KEY=dev_key_only_for_local_testing
|
|
|
|
# ========================================
|
|
# BNB GREENFIELD (OPTIONAL)
|
|
# ========================================
|
|
GREENFIELD_RPC=https://greenfield-chain.bnbchain.org
|
|
GREENFIELD_BUCKET_NAME=immortal-bot-dev
|
|
GREENFIELD_ACCESS_KEY=
|
|
GREENFIELD_SECRET_KEY=
|
|
|
|
# ========================================
|
|
# TELEGRAM ALERTS (OPTIONAL)
|
|
# ========================================
|
|
TELEGRAM_BOT_TOKEN=
|
|
TELEGRAM_CHAT_ID=
|
|
|
|
# ========================================
|
|
# TRADING CONFIGURATION (CONSERVATIVE FOR DEV)
|
|
# ========================================
|
|
MAX_TRADE_AMOUNT_BNB=0.01
|
|
STOP_LOSS_PERCENTAGE=5
|
|
MAX_SLIPPAGE_PERCENTAGE=2
|
|
BOT_LOOP_INTERVAL_MS=60000
|
|
MIN_LIQUIDITY_USD=5000
|
|
|
|
# ========================================
|
|
# SMART CONTRACTS
|
|
# ========================================
|
|
IMMBOT_TOKEN_ADDRESS=
|
|
STAKING_CONTRACT_ADDRESS=
|