feat(prod): complete production deployment with Podman containerization
- Migrate from Docker to Podman for enhanced security (rootless containers) - Add production-ready Dockerfile with multi-stage builds - Configure production environment with Arbitrum mainnet RPC endpoints - Add comprehensive test coverage for core modules (exchanges, execution, profitability) - Implement production audit and deployment documentation - Update deployment scripts for production environment - Add container runtime and health monitoring scripts - Document RPC limitations and remediation strategies - Implement token metadata caching and pool validation This commit prepares the MEV bot for production deployment on Arbitrum with full containerization, security hardening, and operational tooling. 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -1,9 +1,14 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# run.sh - Run the MEV bot
|
||||
# Builds and starts the MEV bot with production configuration
|
||||
|
||||
echo "Running MEV bot..."
|
||||
|
||||
# Set default GO_ENV if not already set (production by default)
|
||||
export GO_ENV="${GO_ENV:-production}"
|
||||
|
||||
# Build the application first
|
||||
./scripts/build.sh
|
||||
|
||||
@@ -14,29 +19,41 @@ if [ $? -eq 0 ]; then
|
||||
export GO_ENV
|
||||
fi
|
||||
|
||||
# Load environment variables from .env.production if it exists
|
||||
if [ -f ".env.production" ]; then
|
||||
echo "🔧 Loading production environment variables from .env.production..."
|
||||
set -a # Automatically export all variables
|
||||
source .env.production
|
||||
set +a # Stop automatically exporting
|
||||
# Load environment variables based on GO_ENV
|
||||
if [ "$GO_ENV" = "development" ]; then
|
||||
echo "🔧 Development mode: Using .env for local configuration..."
|
||||
if [ -f ".env" ]; then
|
||||
set -a
|
||||
source .env
|
||||
set +a
|
||||
fi
|
||||
else
|
||||
echo "❌ .env.production file not found! Creating one with defaults..."
|
||||
echo "Please configure .env.production for production deployment"
|
||||
exit 1
|
||||
# Production mode requires .env.production
|
||||
if [ -f ".env.production" ]; then
|
||||
echo "🔧 Loading production environment variables from .env.production..."
|
||||
set -a # Automatically export all variables
|
||||
source .env.production
|
||||
set +a # Stop automatically exporting
|
||||
else
|
||||
echo "❌ .env.production file not found! Creating one with defaults..."
|
||||
echo "Please configure .env.production for production deployment"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Validate required environment variables
|
||||
if [ -z "$MEV_BOT_ENCRYPTION_KEY" ]; then
|
||||
echo "❌ MEV_BOT_ENCRYPTION_KEY not found in .env.production"
|
||||
echo "Please set this variable for secure operations"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$CONTRACT_ARBITRAGE_EXECUTOR" ]; then
|
||||
echo "❌ CONTRACT_ARBITRAGE_EXECUTOR not found in .env.production"
|
||||
echo "Please set the deployed arbitrage executor contract address"
|
||||
exit 1
|
||||
# Validate required environment variables (production mode only)
|
||||
if [ "$GO_ENV" != "development" ]; then
|
||||
if [ -z "${MEV_BOT_ENCRYPTION_KEY:-}" ]; then
|
||||
echo "❌ MEV_BOT_ENCRYPTION_KEY not found in .env.production"
|
||||
echo "Please set this variable for secure operations"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "${CONTRACT_ARBITRAGE_EXECUTOR:-}" ]; then
|
||||
echo "❌ CONTRACT_ARBITRAGE_EXECUTOR not found in .env.production"
|
||||
echo "Please set the deployed arbitrage executor contract address"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Set required environment variables with production values
|
||||
@@ -57,22 +74,35 @@ if [ $? -eq 0 ]; then
|
||||
env | grep MEV_BOT_KEYSTORE_PATH
|
||||
|
||||
echo ""
|
||||
echo "🚀 PRODUCTION MEV BOT STARTUP"
|
||||
echo "================================"
|
||||
if [ "$GO_ENV" = "development" ]; then
|
||||
echo "🚀 DEVELOPMENT MEV BOT STARTUP"
|
||||
echo "==============================="
|
||||
else
|
||||
echo "🚀 PRODUCTION MEV BOT STARTUP"
|
||||
echo "=============================="
|
||||
fi
|
||||
echo "Environment: $GO_ENV"
|
||||
echo ""
|
||||
echo "📡 Network Configuration:"
|
||||
echo " RPC: $ARBITRUM_RPC_ENDPOINT"
|
||||
echo " WS: $ARBITRUM_WS_ENDPOINT"
|
||||
echo " Metrics Port: $METRICS_PORT"
|
||||
echo ""
|
||||
echo "📝 Deployed Contracts:"
|
||||
echo " ArbitrageExecutor: $CONTRACT_ARBITRAGE_EXECUTOR"
|
||||
echo " FlashSwapper: $CONTRACT_FLASH_SWAPPER"
|
||||
echo " DataFetcher: $CONTRACT_DATA_FETCHER"
|
||||
echo ""
|
||||
echo "🔐 Security:"
|
||||
echo " Encryption Key: ${MEV_BOT_ENCRYPTION_KEY:0:8}...***"
|
||||
echo " RPC: ${ARBITRUM_RPC_ENDPOINT:-not set}"
|
||||
echo " WS: ${ARBITRUM_WS_ENDPOINT:-not set}"
|
||||
echo " Metrics Port: ${METRICS_PORT:-9090}"
|
||||
echo ""
|
||||
|
||||
if [ "$GO_ENV" != "development" ] && [ -n "${CONTRACT_ARBITRAGE_EXECUTOR:-}" ]; then
|
||||
echo "📝 Deployed Contracts:"
|
||||
echo " ArbitrageExecutor: $CONTRACT_ARBITRAGE_EXECUTOR"
|
||||
echo " FlashSwapper: ${CONTRACT_FLASH_SWAPPER:-not set}"
|
||||
echo " DataFetcher: ${CONTRACT_DATA_FETCHER:-not set}"
|
||||
echo ""
|
||||
fi
|
||||
|
||||
if [ -n "${MEV_BOT_ENCRYPTION_KEY:-}" ]; then
|
||||
echo "🔐 Security:"
|
||||
echo " Encryption Key: ${MEV_BOT_ENCRYPTION_KEY:0:8}...***"
|
||||
echo ""
|
||||
fi
|
||||
|
||||
# Set provider config path if not already set
|
||||
export PROVIDER_CONFIG_PATH="${PROVIDER_CONFIG_PATH:-$PWD/config/providers_runtime.yaml}"
|
||||
echo "📋 Provider Config: $PROVIDER_CONFIG_PATH"
|
||||
|
||||
Reference in New Issue
Block a user