helper scripts
This commit is contained in:
@@ -7,12 +7,12 @@ POSTGRES_USER=mpr_user
|
|||||||
POSTGRES_PASSWORD=mpr_pass
|
POSTGRES_PASSWORD=mpr_pass
|
||||||
POSTGRES_HOST=postgres
|
POSTGRES_HOST=postgres
|
||||||
POSTGRES_PORT=5432
|
POSTGRES_PORT=5432
|
||||||
DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}
|
DATABASE_URL=postgresql://mpr_user:mpr_pass@postgres:5432/mpr
|
||||||
|
|
||||||
# Redis
|
# Redis
|
||||||
REDIS_HOST=redis
|
REDIS_HOST=redis
|
||||||
REDIS_PORT=6379
|
REDIS_PORT=6379
|
||||||
REDIS_URL=redis://${REDIS_HOST}:${REDIS_PORT}/0
|
REDIS_URL=redis://redis:6379/0
|
||||||
|
|
||||||
# Django
|
# Django
|
||||||
DEBUG=1
|
DEBUG=1
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ services:
|
|||||||
POSTGRES_USER: mpr_user
|
POSTGRES_USER: mpr_user
|
||||||
POSTGRES_PASSWORD: mpr_pass
|
POSTGRES_PASSWORD: mpr_pass
|
||||||
ports:
|
ports:
|
||||||
- "5433:5432"
|
- "5435:5432"
|
||||||
volumes:
|
volumes:
|
||||||
- postgres-data:/var/lib/postgresql/data
|
- postgres-data:/var/lib/postgresql/data
|
||||||
healthcheck:
|
healthcheck:
|
||||||
@@ -150,3 +150,5 @@ volumes:
|
|||||||
networks:
|
networks:
|
||||||
default:
|
default:
|
||||||
name: mpr
|
name: mpr
|
||||||
|
|
||||||
|
name: mpr
|
||||||
|
|||||||
39
ctrl/run.sh
39
ctrl/run.sh
@@ -1,12 +1,16 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# Run MPR stack locally
|
# Run MPR stack locally
|
||||||
# Usage: ./ctrl/run.sh [docker-compose args]
|
# Usage: ./run.sh [OPTIONS] [docker-compose args]
|
||||||
|
#
|
||||||
|
# Options:
|
||||||
|
# -f, --foreground Run in foreground (don't detach)
|
||||||
|
# --build Rebuild images before starting
|
||||||
#
|
#
|
||||||
# Examples:
|
# Examples:
|
||||||
# ./ctrl/run.sh # Start all services
|
# ./run.sh # Start detached
|
||||||
# ./ctrl/run.sh --build # Rebuild and start
|
# ./run.sh -f # Start in foreground (see logs)
|
||||||
# ./ctrl/run.sh -d # Detached mode
|
# ./run.sh --build # Rebuild and start
|
||||||
# ./ctrl/run.sh down # Stop all
|
# ./run.sh logs -f # Follow logs
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
@@ -30,4 +34,27 @@ if ! grep -q "mpr.local.ar" /etc/hosts 2>/dev/null; then
|
|||||||
echo ""
|
echo ""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
docker compose "$@"
|
# 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
|
||||||
|
|||||||
31
ctrl/stop.sh
Executable file
31
ctrl/stop.sh
Executable file
@@ -0,0 +1,31 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Stop MPR stack
|
||||||
|
# Usage: ./stop.sh [OPTIONS]
|
||||||
|
#
|
||||||
|
# Options:
|
||||||
|
# -v, --volumes Also remove volumes (database data)
|
||||||
|
#
|
||||||
|
# Examples:
|
||||||
|
# ./stop.sh # Stop containers
|
||||||
|
# ./stop.sh -v # Stop and remove volumes
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
cd "$SCRIPT_DIR"
|
||||||
|
|
||||||
|
VOLUMES=""
|
||||||
|
|
||||||
|
while [[ $# -gt 0 ]]; do
|
||||||
|
case $1 in
|
||||||
|
-v|--volumes)
|
||||||
|
VOLUMES="-v"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
docker compose down $VOLUMES
|
||||||
Reference in New Issue
Block a user