#!/bin/bash set -e echo "=== Sriphat Data Platform Startup ===" echo "" cd "$(dirname "$0")" echo "[1/7] Creating shared network..." cd 00-network bash create-network.sh cd .. echo "[2/7] Starting Infrastructure (Nginx + Keycloak + PostgreSQL)..." cd 01-infra docker compose --env-file ../.env.global up -d cd .. echo "Waiting for PostgreSQL to be ready..." sleep 10 echo "[3/7] Creating databases for Airbyte and Superset..." docker exec postgres psql -U postgres -tc "SELECT 1 FROM pg_database WHERE datname = 'airbyte'" | grep -q 1 || docker exec postgres psql -U postgres -c "CREATE DATABASE airbyte;" docker exec postgres psql -U postgres -tc "SELECT 1 FROM pg_database WHERE datname = 'temporal'" | grep -q 1 || docker exec postgres psql -U postgres -c "CREATE DATABASE temporal;" docker exec postgres psql -U postgres -tc "SELECT 1 FROM pg_database WHERE datname = 'temporal_visibility'" | grep -q 1 || docker exec postgres psql -U postgres -c "CREATE DATABASE temporal_visibility;" docker exec postgres psql -U postgres -tc "SELECT 1 FROM pg_database WHERE datname = 'superset'" | grep -q 1 || docker exec postgres psql -U postgres -c "CREATE DATABASE superset;" echo "[4/7] Starting API Service..." cd 03-apiservice docker compose --env-file ../.env.global up --build -d cd .. echo "[5/7] Starting Airbyte (Data Ingestion)..." cd 04-ingestion docker compose --env-file ../.env.global up -d cd .. echo "[6/7] Starting Superset (Analytics)..." cd 06-analytics docker compose --env-file ../.env.global up -d cd .. echo "" echo "=== All services started! ===" echo "" echo "Access points:" echo "- Nginx Proxy Manager: http://localhost:8021" echo "- Keycloak Admin: http://localhost:8080" echo "- Airbyte: http://localhost:8000" echo "- API Service: Configure in Nginx (apiservice:8000)" echo "- Superset: Configure in Nginx (superset:8088)" echo "" echo "Next steps:" echo "1. Configure domains in Nginx Proxy Manager (port 8021)" echo "2. Setup Keycloak realm and clients" echo "3. Configure Airbyte sources/destinations" echo "4. Setup Superset dashboards"