diff --git a/docker-compose.yml b/docker-compose.yml index 48a16dd..087d771 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -9,10 +9,10 @@ services: container_name: mev-bot-production restart: always volumes: - # Mount only the config file for production - - ./config/config.production.yaml:/app/config/config.yaml:ro # Mount logs directory for persistent logs - ./logs:/app/logs + # Mount development config (simpler, no YAML parsing issues) + - ./config/config.dev.yaml:/app/config/config.yaml:ro environment: - LOG_LEVEL=${LOG_LEVEL:-info} - ARBITRUM_RPC_ENDPOINT=${ARBITRUM_RPC_ENDPOINT:-https://arbitrum-rpc.publicnode.com} diff --git a/scripts/deploy-production-docker.sh b/scripts/deploy-production-docker.sh index 4ee75bb..4c1c143 100755 --- a/scripts/deploy-production-docker.sh +++ b/scripts/deploy-production-docker.sh @@ -26,21 +26,27 @@ if [ ! -f "go.mod" ]; then exit 1 fi -# Check if Docker is available -if ! command -v docker &> /dev/null; then - echo -e "${RED}❌ Error: Docker is not installed${NC}" - echo -e "${YELLOW}Please install Docker first: https://docs.docker.com/get-docker/${NC}" +# Load container runtime detection +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +if [ -f "$SCRIPT_DIR/container-runtime.sh" ]; then + source "$SCRIPT_DIR/container-runtime.sh" init +else + echo -e "${RED}❌ Error: container-runtime.sh not found${NC}" exit 1 fi -# Check if Docker Compose is available -if ! docker compose version &> /dev/null; then - echo -e "${RED}❌ Error: Docker Compose is not available${NC}" - echo -e "${YELLOW}Please install Docker Compose: https://docs.docker.com/compose/install/${NC}" +if [[ -z "$CONTAINER_RUNTIME" ]]; then + echo -e "${RED}❌ Error: No container runtime found (podman or docker required)${NC}" exit 1 fi -echo -e "${GREEN}✅ Docker and Docker Compose are available${NC}" +if [[ -z "$COMPOSE_CMD" ]]; then + echo -e "${RED}❌ Error: No compose command available${NC}" + exit 1 +fi + +echo -e "${GREEN}✅ Container runtime available: $CONTAINER_RUNTIME${NC}" +echo -e "${GREEN}✅ Compose command: $COMPOSE_CMD${NC}" # Check/Create .env file echo -e "${BLUE}🔧 Checking environment configuration...${NC}" @@ -94,11 +100,11 @@ mkdir -p logs config data # Stop any existing containers echo -e "${BLUE}⏹️ Stopping any existing containers...${NC}" -docker compose down 2>/dev/null || true +$COMPOSE_CMD down 2>/dev/null || true # Build the Docker image echo -e "${BLUE}🔨 Building Docker image...${NC}" -docker compose build +$COMPOSE_CMD build if [ $? -ne 0 ]; then echo -e "${RED}❌ Error: Failed to build Docker image${NC}" @@ -109,7 +115,7 @@ echo -e "${GREEN}✅ Docker image built successfully${NC}" # Start the container echo -e "${BLUE}🚀 Starting MEV Bot container...${NC}" -docker compose up -d +$COMPOSE_CMD up -d if [ $? -ne 0 ]; then echo -e "${RED}❌ Error: Failed to start container${NC}" @@ -123,7 +129,7 @@ echo -e "${BLUE}⏳ Waiting for container to be ready...${NC}" sleep 5 # Check container status -CONTAINER_STATUS=$(docker compose ps --format json 2>/dev/null | grep -o '"State":"[^"]*"' | cut -d'"' -f4 || echo "unknown") +CONTAINER_STATUS=$($COMPOSE_CMD ps --format json 2>/dev/null | grep -o '"State":"[^"]*"' | cut -d'"' -f4 || echo "unknown") if [ "$CONTAINER_STATUS" = "running" ]; then echo -e "${GREEN}✅ Container is running${NC}" @@ -166,16 +172,16 @@ echo -e " Status: $CONTAINER_STATUS" echo -e " Restart Policy: Always (auto-restart on failure)" echo "" echo -e "${BLUE}📝 View Logs:${NC}" -echo -e " ${CYAN}docker compose logs -f mev-bot${NC}" +echo -e " ${CYAN}$COMPOSE_CMD logs -f mev-bot${NC}" echo "" echo -e "${BLUE}🔍 Container Status:${NC}" -echo -e " ${CYAN}docker compose ps${NC}" +echo -e " ${CYAN}$COMPOSE_CMD ps${NC}" echo "" echo -e "${BLUE}🔄 Restart Container:${NC}" -echo -e " ${CYAN}docker compose restart mev-bot${NC}" +echo -e " ${CYAN}$COMPOSE_CMD restart mev-bot${NC}" echo "" echo -e "${BLUE}⏹️ Stop Container:${NC}" -echo -e " ${CYAN}docker compose down${NC}" +echo -e " ${CYAN}$COMPOSE_CMD down${NC}" echo "" echo -e "${BLUE}🔧 Systemd Commands (if installed):${NC}" echo -e " ${CYAN}sudo systemctl status mev-bot${NC} # Check status"