From c84f2fc32e22476b1593da690dc2d5424f2cdcf4 Mon Sep 17 00:00:00 2001 From: Leendert de Borst Date: Sun, 14 Jun 2026 00:15:00 +0200 Subject: [PATCH] Update aliasvault dev db docker name (#2166) --- install.sh | 15 +++++++++------ scripts/dev.sh | 9 ++++----- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/install.sh b/install.sh index f41bf43fa..829d10e68 100755 --- a/install.sh +++ b/install.sh @@ -2833,6 +2833,8 @@ set_deployment_mode() { } # Function to handle database export +DEV_COMPOSE="docker compose -f dockerfiles/docker-compose.dev.yml -p aliasvault-dev" + handle_db_export() { printf "${YELLOW}+++ Exporting Database +++${NC}\n" >&2 @@ -2856,18 +2858,18 @@ handle_db_export() { # Determine docker compose command based on dev/prod if [ "$DEV_DB" = true ]; then # Check if dev containers are running - if ! docker compose -f dockerfiles/docker-compose.dev.yml -p aliasvault-dev ps postgres-dev --quiet 2>/dev/null | grep -q .; then + if ! $DEV_COMPOSE ps postgres-dev --quiet 2>/dev/null | grep -q .; then printf "${RED}Error: Development database container is not running. Start it first with: ./scripts/dev.sh db-start${NC}\n" >&2 exit 1 fi # Check if postgres-dev container is healthy - if ! docker compose -f dockerfiles/docker-compose.dev.yml -p aliasvault-dev ps postgres-dev | grep -q "healthy"; then + if ! $DEV_COMPOSE ps postgres-dev | grep -q "healthy"; then printf "${RED}Error: Development PostgreSQL container is not healthy. Please check the logs.${NC}\n" >&2 exit 1 fi - DOCKER_CMD="docker compose -f dockerfiles/docker-compose.dev.yml -p aliasvault-dev exec -T postgres-dev" + DOCKER_CMD="$DEV_COMPOSE exec -T postgres-dev" DB_TYPE="development" else # Production database export logic @@ -2948,7 +2950,7 @@ handle_db_import() { # Check if containers are running if [ "$DEV_DB" = true ]; then - if ! docker compose -f dockerfiles/docker-compose.dev.yml -p aliasvault-dev ps postgres-dev | grep -q "healthy"; then + if ! $DEV_COMPOSE ps postgres-dev | grep -q "healthy"; then printf "${RED}Error: Development PostgreSQL container is not healthy. Start it first with: ./scripts/dev.sh db-start${NC}\n" exit 1 fi @@ -3001,9 +3003,10 @@ handle_db_import() { fi printf "database...${NC}\n" - # Determine docker compose command based on dev/prod + # Determine docker compose command based on dev/prod ($DEV_COMPOSE was + # resolved during the health check above for the active dev instance). if [ "$DEV_DB" = true ]; then - DOCKER_CMD="docker compose -f dockerfiles/docker-compose.dev.yml -p aliasvault-dev exec -T postgres-dev" + DOCKER_CMD="$DEV_COMPOSE exec -T postgres-dev" else DOCKER_CMD="docker compose exec -T postgres" fi diff --git a/scripts/dev.sh b/scripts/dev.sh index f4550298f..1485a22f2 100755 --- a/scripts/dev.sh +++ b/scripts/dev.sh @@ -103,11 +103,10 @@ EXPO_PORT=$(( BLOCK_BASE + 4 )) # remember. Offsets 5..8 are left free as spare slots inside the block. DB_PORT=$(( BLOCK_BASE + 9 )) -if [ "$AV_INSTANCE" = "0" ]; then - DB_PROJECT="aliasvault-dev" -else - DB_PROJECT="aliasvault-dev-$AV_INSTANCE" -fi +# Always one dev DB container, named 'aliasvault-dev'. AV_INSTANCE only shifts +# the published port (above), not the container identity — so install.sh and any +# other tooling can find it by a single, stable project name. +DB_PROJECT="aliasvault-dev" DB_COMPOSE="$ROOT_DIR/dockerfiles/docker-compose.dev.yml" CONN_STR="Host=localhost;Port=$DB_PORT;Database=aliasvault;Username=aliasvault;Password=password;Maximum Pool Size=20;Minimum Pool Size=1"