Add help system, deployment docs, and improve setup
Introduces a new interactive help command with button navigation, adds a detailed DEPLOYMENT.md guide, and improves server setup validation and error handling. Updates command registration to include all 9 games, adds version reporting, enhances Docker deployment with a multi-platform script, and removes local .env files from the repo. Also refactors bot startup for better diagnostics and graceful shutdown.
This commit is contained in:
93
scripts/deploy.sh
Executable file
93
scripts/deploy.sh
Executable file
@@ -0,0 +1,93 @@
|
||||
#!/bin/bash
|
||||
|
||||
# VRBattles Discord Bot - Docker Deploy Script
|
||||
# Usage: ./scripts/deploy.sh [version]
|
||||
# Example: ./scripts/deploy.sh v1.2.7
|
||||
|
||||
set -e
|
||||
|
||||
# Colors for output
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
BLUE='\033[0;34m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
# Configuration
|
||||
DOCKER_USERNAME="far54"
|
||||
IMAGE_NAME="vrbattles-discord-bot"
|
||||
FULL_IMAGE_NAME="${DOCKER_USERNAME}/${IMAGE_NAME}"
|
||||
|
||||
# Get version from package.json if not provided
|
||||
if [ -z "$1" ]; then
|
||||
VERSION=$(node -p "require('./package.json').version")
|
||||
VERSION="v${VERSION}"
|
||||
else
|
||||
VERSION="$1"
|
||||
fi
|
||||
|
||||
echo -e "${BLUE}🚀 VRBattles Discord Bot Deployment${NC}"
|
||||
echo -e "${YELLOW}📦 Version: ${VERSION}${NC}"
|
||||
echo -e "${YELLOW}🐳 Image: ${FULL_IMAGE_NAME}${NC}"
|
||||
echo ""
|
||||
|
||||
# Check if Docker is running
|
||||
if ! docker info > /dev/null 2>&1; then
|
||||
echo -e "${RED}❌ Docker is not running. Please start Docker and try again.${NC}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Sync games from Supabase
|
||||
echo -e "${BLUE}🔄 Syncing games from Supabase...${NC}"
|
||||
npm run sync-games
|
||||
|
||||
echo -e "${BLUE}🏗️ Building multi-platform Docker image...${NC}"
|
||||
echo -e "${YELLOW}📋 Platforms: linux/amd64, linux/arm64${NC}"
|
||||
|
||||
# Check if buildx is available
|
||||
if ! docker buildx version > /dev/null 2>&1; then
|
||||
echo -e "${RED}❌ Docker buildx is not available. Please update Docker.${NC}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Create/use buildx builder
|
||||
docker buildx create --name multiarch --use --driver docker-container --bootstrap 2>/dev/null || true
|
||||
docker buildx use multiarch
|
||||
|
||||
echo -e "${BLUE}📤 Building and pushing to Docker Hub...${NC}"
|
||||
echo -e "${YELLOW}Note: Make sure you're logged in with 'docker login'${NC}"
|
||||
|
||||
# Check if logged in
|
||||
if ! docker info | grep -q "Username:"; then
|
||||
echo -e "${YELLOW}⚠️ You don't appear to be logged in to Docker Hub.${NC}"
|
||||
echo -e "${YELLOW}🔐 Please run: docker login${NC}"
|
||||
read -p "Press Enter after logging in, or Ctrl+C to cancel..."
|
||||
fi
|
||||
|
||||
# Build and push multi-platform images
|
||||
docker buildx build --platform linux/amd64,linux/arm64 \
|
||||
-t "${FULL_IMAGE_NAME}:latest" \
|
||||
-t "${FULL_IMAGE_NAME}:${VERSION}" \
|
||||
. --push
|
||||
|
||||
echo ""
|
||||
echo -e "${GREEN}✅ Successfully deployed!${NC}"
|
||||
echo ""
|
||||
echo -e "${BLUE}📋 Deployment Summary:${NC}"
|
||||
echo -e " 🐳 Images pushed:"
|
||||
echo -e " • ${FULL_IMAGE_NAME}:latest"
|
||||
echo -e " • ${FULL_IMAGE_NAME}:${VERSION}"
|
||||
echo ""
|
||||
echo -e "${BLUE}🔧 Coolify Deployment:${NC}"
|
||||
echo -e " 1. Go to your Coolify dashboard"
|
||||
echo -e " 2. Update your application image to: ${FULL_IMAGE_NAME}:${VERSION}"
|
||||
echo -e " 3. Restart the application"
|
||||
echo ""
|
||||
echo -e "${BLUE}🎯 Features in this version:${NC}"
|
||||
echo -e " ✅ All 9 games in dropdowns"
|
||||
echo -e " ✅ Working help button navigation"
|
||||
echo -e " ✅ No debug message spam"
|
||||
echo -e " ✅ Automatic Supabase game sync"
|
||||
echo -e " ✅ Optimized Docker image"
|
||||
echo ""
|
||||
echo -e "${GREEN}🎉 Deployment complete!${NC}"
|
||||
Reference in New Issue
Block a user