Skip to content

Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.

Update dev.sh to make database port aware

Leendert de Borst19738a6287e7
diff --git a/docs/docs/contributing/development/development-setup.md b/docs/docs/contributing/development/development-setup.md
index ea66b4c7c..f817c7dd8 100644
--- a/docs/docs/contributing/development/development-setup.md
+++ b/docs/docs/contributing/development/development-setup.md
@@ -72,7 +72,8 @@ pwsh apps/server/Tests/AliasVault.E2ETests/bin/Debug/net10.0/playwright.ps1 inst
## Troubleshooting
- **Database**: check it's up with `docker ps | grep postgres-dev`, view logs with
- `docker logs aliasvault-dev-postgres-dev-1`, or restart with
+ `docker logs aliasvault-dev-5109-postgres-dev-1` (the container name includes the
+ instance's DB port), or restart with
`./scripts/dev.sh db-stop && ./scripts/dev.sh db-start`.
- **Port conflicts**: run `./scripts/dev.sh ports` to see what's in use. If a port is
taken, bump `AV_INSTANCE` in `dev.env` to shift the whole block.
diff --git a/install.sh b/install.sh
index 7417162d8..0ebcb60b3 100755
--- a/install.sh
+++ b/install.sh
@@ -2858,8 +2858,14 @@ set_deployment_mode() {
update_env_var "DEPLOYMENT_MODE" "$mode" &>/dev/null
}
-# Function to handle database export
-DEV_COMPOSE="docker compose -f dockerfiles/docker-compose.dev.yml -p aliasvault-dev"
+# The dev database compose project is named per instance with its published
+# port (e.g. 'aliasvault-dev-5109'); derive that port from dev.env using the
+# same defaults as scripts/dev.sh so db-export/db-import target the right one.
+DEV_DB_PORT=$(
+ [ -f "dev.env" ] && . ./dev.env
+ echo $(( ${AV_BASE_PORT:-5100} + ${AV_INSTANCE:-0} * ${AV_PORT_STRIDE:-10} + 9 ))
+)
+DEV_COMPOSE="docker compose -f dockerfiles/docker-compose.dev.yml -p aliasvault-dev-${DEV_DB_PORT}"
# Configure db-export/db-import to talk to an external PostgreSQL server when configured in .env.
setup_external_pg_client() {
diff --git a/scripts/dev.sh b/scripts/dev.sh
index 4d6ded520..ecf1f4987 100755
--- a/scripts/dev.sh
+++ b/scripts/dev.sh
@@ -103,10 +103,11 @@ EXPO_PORT=$(( BLOCK_BASE + 4 ))
# remember. Offsets 5..8 are left free as spare slots inside the block.
DB_PORT=$(( BLOCK_BASE + 9 ))
-# 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"
+# One dev DB container per instance, with the published port in the project
+# name (e.g. 'aliasvault-dev-5109') so multiple instances can run side by side
+# without start/stop/status checks hitting another instance's database.
+# install.sh derives the same name from dev.env for its db-export/db-import.
+DB_PROJECT="aliasvault-dev-$DB_PORT"
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"