#!/bin/bash # Game Tracker Deployment Script echo "=== Game Tracker Deployment ===" # Default settings DEPLOY_MODE=${DEPLOY_MODE:-local} # Check if .env file exists if [ ! -f .env ]; then echo "ERROR: .env file not found!" echo "Please create a .env file with your IGDB credentials:" echo "IGDB_CLIENT_ID=your_client_id_here" echo "IGDB_CLIENT_SECRET=your_client_secret_here" exit 1 fi # Make sure database directory exists mkdir -p instance # Check deployment mode if [ "$1" = "--ssl" ] || [ "$DEPLOY_MODE" = "ssl" ]; then echo "Deploying with SSL (for production use)..." # Check for domain name if [ -z "$DOMAIN" ]; then read -p "Enter your domain name (e.g., gametracker.example.com): " DOMAIN export DOMAIN fi # Check for email if [ -z "$EMAIL" ]; then read -p "Enter your email (for Let's Encrypt notifications): " EMAIL export EMAIL fi # Run the SSL setup script ./init-letsencrypt.sh echo "=== SSL Deployment Complete ===" echo "Your Game Tracker is now running at: https://$DOMAIN" echo "" echo "SSL certificates will auto-renew every 90 days" echo "To view logs: docker-compose logs -f" echo "To stop the server: docker-compose down" else echo "Deploying locally (for development/testing)..." # Create a simpler nginx config for local deployment mkdir -p nginx cat > nginx/app.conf << EOF server { listen 80; server_name localhost; location / { proxy_pass http://web:8000; proxy_set_header Host \$host; proxy_set_header X-Real-IP \$remote_addr; } } EOF # Build and start Docker containers echo "Building and starting Docker containers..." docker-compose up --build -d echo "=== Local Deployment Complete ===" echo "Your Game Tracker is now running at: http://localhost" echo "" echo "To view logs: docker-compose logs -f" echo "To stop the server: docker-compose down" echo "To deploy with SSL: ./deploy.sh --ssl" fi