81 lines
2.6 KiB
Bash
81 lines
2.6 KiB
Bash
#!/bin/bash
|
|
# SerpentRace Production Deployment Script for Linux
|
|
# This script loads Docker images and starts the production environment
|
|
|
|
set -e
|
|
|
|
echo "==============================================="
|
|
echo "SerpentRace Production Deployment"
|
|
echo "==============================================="
|
|
echo
|
|
|
|
# Check if Docker is installed
|
|
if ! command -v docker &> /dev/null; then
|
|
echo "[ERROR] Docker is not installed. Please install Docker first."
|
|
exit 1
|
|
fi
|
|
|
|
if ! command -v docker-compose &> /dev/null; then
|
|
echo "[ERROR] Docker Compose is not installed. Please install Docker Compose first."
|
|
exit 1
|
|
fi
|
|
|
|
# Check if serpentrace-images.tar exists
|
|
if [ ! -f "serpentrace-images.tar" ]; then
|
|
echo "[ERROR] serpentrace-images.tar not found!"
|
|
echo "Please ensure the tar file is in the same directory as this script."
|
|
exit 1
|
|
fi
|
|
|
|
# Check if environment file exists
|
|
if [ ! -f ".env.server" ]; then
|
|
echo "[ERROR] .env.server file not found!"
|
|
echo "Please ensure the environment file is configured."
|
|
exit 1
|
|
fi
|
|
|
|
echo "[INFO] Loading Docker images from serpentrace-images.tar..."
|
|
docker load -i serpentrace-images.tar
|
|
|
|
echo "[INFO] Images loaded successfully!"
|
|
echo
|
|
|
|
# Show loaded images
|
|
echo "[INFO] Loaded images:"
|
|
docker images | grep -E "(serpentrace|postgres|redis|minio)"
|
|
echo
|
|
|
|
echo "[WARNING] Before starting the services, please review and update .env.server:"
|
|
echo " - Change all placeholder passwords"
|
|
echo " - Configure email settings"
|
|
echo " - Update domain names"
|
|
echo " - Set strong JWT secret"
|
|
echo
|
|
read -p "Press Enter to continue with deployment or Ctrl+C to exit..."
|
|
|
|
echo "[INFO] Starting production services..."
|
|
docker-compose -f docker-compose.deploy.yml --env-file .env.server up -d
|
|
|
|
echo
|
|
echo "==============================================="
|
|
echo "Deployment Complete!"
|
|
echo "==============================================="
|
|
echo
|
|
echo "Services are starting up. Please wait a few moments for all services to be ready."
|
|
echo
|
|
echo "Available services:"
|
|
echo " - Frontend: http://localhost (or your domain)"
|
|
echo " - Backend API: http://localhost:3000"
|
|
echo " - MinIO Console: http://localhost:9001"
|
|
echo
|
|
echo "To check service status: docker-compose -f docker-compose.deploy.yml ps"
|
|
echo "To view logs: docker-compose -f docker-compose.deploy.yml logs -f [service_name]"
|
|
echo "To stop services: docker-compose -f docker-compose.deploy.yml down"
|
|
echo
|
|
echo "IMPORTANT SECURITY NOTES:"
|
|
echo "1. Change all default passwords in .env.server"
|
|
echo "2. Configure firewall rules for your server"
|
|
echo "3. Set up SSL/TLS certificates for HTTPS"
|
|
echo "4. Configure regular backups"
|
|
echo "5. Monitor logs and system resources"
|
|
echo |