#!/bin/bash # ============================================================ # EEG Portal - Deploy Script for Hetzner Cloud # ============================================================ set -e echo "=== EEG Portal Deployment ===" echo "" # Check if .env exists if [ ! -f .env ]; then echo "ERROR: .env file not found!" echo "Please copy .env.example to .env and fill in the values." echo "" echo " cp .env.example .env" echo " nano .env" exit 1 fi # Check required variables source .env if [ -z "$JWT_SECRET" ] || [ "$JWT_SECRET" = "your-super-secret-jwt-key-change-this" ]; then echo "ERROR: JWT_SECRET must be set in .env" exit 1 fi if [ -z "$POSTGRES_PASSWORD" ] || [ "$POSTGRES_PASSWORD" = "your-strong-db-password-change-this" ]; then echo "ERROR: POSTGRES_PASSWORD must be set in .env" exit 1 fi if [ -z "$APP_FRONTEND_URL" ] || [ "$APP_FRONTEND_URL" = "https://your-domain.at" ]; then echo "ERROR: APP_FRONTEND_URL must be set in .env" exit 1 fi echo "Configuration OK!" echo "" # Stop existing containers echo "Stopping existing containers..." docker compose down # Build and start echo "Building and starting services..." docker compose up -d --build echo "" echo "=== Deployment complete! ===" echo "" echo "Services:" echo " - Frontend: http://localhost:${APP_PORT:-80}" echo " - Backend: http://localhost:8080" echo " - Database: localhost:5432" echo "" echo "To view logs:" echo " docker compose logs -f" echo "" echo "To stop:" echo " docker compose down"