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:
Krypto Kajun
2025-11-08 10:15:22 -06:00
parent 52d555ccdf
commit 8cba462024
55 changed files with 15523 additions and 4908 deletions

View File

@@ -1,9 +1,10 @@
#!/bin/bash
#!/usr/bin/env bash
# Production Deployment Script for MEV Bot
# This script deploys the MEV bot to a production environment for live trading
# Supports: Podman (preferred) and Docker
set -e # Exit on any error
set -euo pipefail # Exit on any error, undefined vars, pipe failures
# Colors for output
RED='\033[0;31m'
@@ -93,34 +94,37 @@ else
exit 1
fi
# Check if Docker is available
if ! command -v docker &> /dev/null; then
echo -e "${RED}❌ Error: Docker is not installed or not in PATH${NC}"
# Load container runtime detection
source "$(dirname "$0")/container-runtime.sh" init
if [[ -z "$CONTAINER_RUNTIME" ]]; then
echo -e "${RED}❌ Error: No container runtime found (podman or docker required)${NC}"
exit 1
fi
if ! command -v docker-compose &> /dev/null; then
echo -e "${RED}❌ Error: docker-compose is not installed or not in PATH${NC}"
if [[ -z "$COMPOSE_CMD" ]]; then
echo -e "${RED}❌ Error: No compose command available${NC}"
exit 1
fi
echo -e "${GREEN}Docker and docker-compose are available${NC}"
echo -e "${GREEN}Container runtime available: $CONTAINER_RUNTIME${NC}"
echo -e "${GREEN}✅ Compose command: $COMPOSE_CMD${NC}"
# Stop any existing containers
echo -e "${BLUE}⏹️ Stopping any existing production containers...${NC}"
docker-compose -f docker-compose.production.yaml down --remove-orphans 2>/dev/null || true
$COMPOSE_CMD -f docker-compose.production.yaml down --remove-orphans 2>/dev/null || true
# Pull latest images
echo -e "${BLUE}⬇️ Pulling latest images...${NC}"
docker-compose -f docker-compose.production.yaml pull
$COMPOSE_CMD -f docker-compose.production.yaml pull
# Build images
echo -e "${BLUE}🔨 Building production images...${NC}"
docker-compose -f docker-compose.production.yaml build
$COMPOSE_CMD -f docker-compose.production.yaml build
# Start services
echo -e "${BLUE}🚀 Starting production services...${NC}"
docker-compose -f docker-compose.production.yaml up -d
$COMPOSE_CMD -f docker-compose.production.yaml up -d
# Wait for services to start
echo -e "${BLUE}⏳ Waiting for services to start...${NC}"
@@ -133,7 +137,7 @@ SERVICES_RUNNING=true
SERVICES=("mev-bot-arbitrum" "mev-bot-redis" "mev-bot-postgres" "mev-bot-prometheus" "mev-bot-grafana" "mev-bot-fluentd")
for service in "${SERVICES[@]}"; do
if docker ps | grep -q "$service"; then
if $CONTAINER_RUNTIME ps | grep -q "$service"; then
echo -e "${GREEN}$service is running${NC}"
else
echo -e "${RED}$service is not running${NC}"
@@ -151,15 +155,15 @@ if [ "$SERVICES_RUNNING" = true ]; then
echo -e " - Grafana: http://localhost:${GRAFANA_PORT:-3000}"
echo ""
echo -e "${BLUE}📝 Logs:${NC}"
echo -e " - MEV Bot: docker logs mev-bot-arbitrum"
echo -e " - Redis: docker logs mev-bot-redis"
echo -e " - PostgreSQL: docker logs mev-bot-postgres"
echo -e " - MEV Bot: $CONTAINER_RUNTIME logs mev-bot-arbitrum"
echo -e " - Redis: $CONTAINER_RUNTIME logs mev-bot-redis"
echo -e " - PostgreSQL: $CONTAINER_RUNTIME logs mev-bot-postgres"
echo ""
echo -e "${YELLOW}⚠️ Remember to monitor the production environment closely during initial deployment${NC}"
echo -e "${YELLOW}⚠️ Start with small position sizes to validate everything works correctly${NC}"
else
echo -e "${RED}❌ Some production services failed to start${NC}"
echo -e "${YELLOW}Check logs with: docker-compose -f docker-compose.production.yaml logs${NC}"
echo -e "${YELLOW}Check logs with: $COMPOSE_CMD -f docker-compose.production.yaml logs${NC}"
exit 1
fi