refactor: move all remaining files to orig/ directory
Completed clean root directory structure: - Root now contains only: .git, .env, docs/, orig/ - Moved all remaining files and directories to orig/: - Config files (.claude, .dockerignore, .drone.yml, etc.) - All .env variants (except active .env) - Git config (.gitconfig, .github, .gitignore, etc.) - Tool configs (.golangci.yml, .revive.toml, etc.) - Documentation (*.md files, @prompts) - Build files (Dockerfiles, Makefile, go.mod, go.sum) - Docker compose files - All source directories (scripts, tests, tools, etc.) - Runtime directories (logs, monitoring, reports) - Dependency files (node_modules, lib, cache) - Special files (--delete) - Removed empty runtime directories (bin/, data/) V2 structure is now clean: - docs/planning/ - V2 planning documents - orig/ - Complete V1 codebase preserved - .env - Active environment config (not in git) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
96
orig/scripts/git-hooks/post-merge
Executable file
96
orig/scripts/git-hooks/post-merge
Executable file
@@ -0,0 +1,96 @@
|
||||
#!/bin/bash
|
||||
# Git post-merge hook
|
||||
# This hook runs after 'git pull' or 'git merge'
|
||||
# Automatically rebuilds and restarts the MEV bot
|
||||
|
||||
set -e
|
||||
|
||||
HOOK_DIR=$(dirname "$0")
|
||||
PROJECT_DIR=$(cd "$HOOK_DIR/../.." && pwd)
|
||||
|
||||
echo "========================================="
|
||||
echo "Post-Merge Hook: Auto-Rebuild & Restart"
|
||||
echo "========================================="
|
||||
echo "Project: $PROJECT_DIR"
|
||||
echo ""
|
||||
|
||||
# Color codes
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
RED='\033[0;31m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
# Change to project directory
|
||||
cd "$PROJECT_DIR"
|
||||
|
||||
# Check if Docker Compose is available
|
||||
if ! command -v docker &> /dev/null; then
|
||||
echo -e "${RED}Error: Docker not found${NC}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Log the update
|
||||
LOG_FILE="$PROJECT_DIR/logs/auto-update.log"
|
||||
mkdir -p "$PROJECT_DIR/logs"
|
||||
echo "[$(date)] Post-merge hook triggered" >> "$LOG_FILE"
|
||||
|
||||
# Get the latest commit info
|
||||
LATEST_COMMIT=$(git log -1 --pretty=format:"%h - %s")
|
||||
echo -e "${YELLOW}Latest commit: $LATEST_COMMIT${NC}"
|
||||
echo "[$(date)] Latest commit: $LATEST_COMMIT" >> "$LOG_FILE"
|
||||
|
||||
# Rebuild the Docker image
|
||||
echo ""
|
||||
echo -e "${YELLOW}Rebuilding Docker image...${NC}"
|
||||
if docker compose build --no-cache >> "$LOG_FILE" 2>&1; then
|
||||
echo -e "${GREEN}✓ Docker image rebuilt${NC}"
|
||||
echo "[$(date)] Docker image rebuilt successfully" >> "$LOG_FILE"
|
||||
else
|
||||
echo -e "${RED}✗ Docker build failed - check logs${NC}"
|
||||
echo "[$(date)] ERROR: Docker build failed" >> "$LOG_FILE"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Restart the container
|
||||
echo ""
|
||||
echo -e "${YELLOW}Restarting container...${NC}"
|
||||
if docker compose up -d >> "$LOG_FILE" 2>&1; then
|
||||
echo -e "${GREEN}✓ Container restarted${NC}"
|
||||
echo "[$(date)] Container restarted successfully" >> "$LOG_FILE"
|
||||
else
|
||||
echo -e "${RED}✗ Container restart failed - check logs${NC}"
|
||||
echo "[$(date)] ERROR: Container restart failed" >> "$LOG_FILE"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Wait a few seconds for the container to start
|
||||
sleep 5
|
||||
|
||||
# Check container status
|
||||
echo ""
|
||||
echo -e "${YELLOW}Container status:${NC}"
|
||||
docker compose ps
|
||||
|
||||
# Show recent logs
|
||||
echo ""
|
||||
echo -e "${YELLOW}Recent logs:${NC}"
|
||||
docker compose logs --tail=20 mev-bot
|
||||
|
||||
echo ""
|
||||
echo -e "${GREEN}========================================="
|
||||
echo "Auto-update complete!"
|
||||
echo "=========================================${NC}"
|
||||
echo ""
|
||||
echo "View full logs: tail -f $LOG_FILE"
|
||||
echo "View container logs: docker compose logs -f mev-bot"
|
||||
echo ""
|
||||
|
||||
# Send notification if curl is available (optional)
|
||||
if command -v curl &> /dev/null && [ -n "$WEBHOOK_URL" ]; then
|
||||
curl -X POST "$WEBHOOK_URL" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"text\":\"MEV Bot updated to: $LATEST_COMMIT\"}" \
|
||||
>> "$LOG_FILE" 2>&1 || true
|
||||
fi
|
||||
|
||||
exit 0
|
||||
Reference in New Issue
Block a user