#!/bin/bash

set -e

cd "$(dirname "$0")/.."

echo "Starting supporting services with Docker Compose..."
docker-compose up -d db nextcloud collabora

echo "Starting backend..."
./scripts/dev-backend.sh &
BACKEND_PID=$!

echo "Starting frontend..."
./scripts/dev-frontend.sh &
FRONTEND_PID=$!

echo "All services started. Press Ctrl+C to stop."

trap "kill $BACKEND_PID $FRONTEND_PID; docker-compose down" INT

wait