61 lines
1.3 KiB
Bash
Executable File
61 lines
1.3 KiB
Bash
Executable File
#!/bin/bash
|
|
# Run MPR stack locally
|
|
# Usage: ./run.sh [OPTIONS] [docker-compose args]
|
|
#
|
|
# Options:
|
|
# -f, --foreground Run in foreground (don't detach)
|
|
# --build Rebuild images before starting
|
|
#
|
|
# Examples:
|
|
# ./run.sh # Start detached
|
|
# ./run.sh -f # Start in foreground (see logs)
|
|
# ./run.sh --build # Rebuild and start
|
|
# ./run.sh logs -f # Follow logs
|
|
|
|
set -e
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
cd "$SCRIPT_DIR"
|
|
|
|
# Load env
|
|
if [ -f .env ]; then
|
|
set -a
|
|
source .env
|
|
set +a
|
|
else
|
|
echo "Warning: .env not found, using defaults"
|
|
echo "Copy .env.template to .env to customize"
|
|
fi
|
|
|
|
# Check /etc/hosts
|
|
if ! grep -q "mpr.local.ar" /etc/hosts 2>/dev/null; then
|
|
echo "Note: Add to /etc/hosts:"
|
|
echo " 127.0.0.1 mpr.local.ar"
|
|
echo ""
|
|
fi
|
|
|
|
# Parse options
|
|
DETACH="-d"
|
|
BUILD=""
|
|
|
|
while [[ $# -gt 0 ]]; do
|
|
case $1 in
|
|
-f|--foreground)
|
|
DETACH=""
|
|
shift
|
|
;;
|
|
--build)
|
|
BUILD="--build"
|
|
shift
|
|
;;
|
|
*)
|
|
# Pass remaining args to docker compose
|
|
docker compose "$@"
|
|
exit $?
|
|
;;
|
|
esac
|
|
done
|
|
|
|
# Default: up with options
|
|
docker compose up $DETACH $BUILD
|