Skip to content

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

Update dev related commands (#2166)

Leendert de Borst4e01138b6bea
diff --git a/.github/workflows/dotnet-integration-tests.yml b/.github/workflows/dotnet-integration-tests.yml
index e1890c079..8dc67c5ce 100644
--- a/.github/workflows/dotnet-integration-tests.yml
+++ b/.github/workflows/dotnet-integration-tests.yml
@@ -42,7 +42,7 @@ jobs:
run: dotnet build
- name: Start dev database
- run: ./install.sh configure-dev-db start
+ run: ./scripts/dev.sh db-start
- name: Run integration tests
working-directory: apps/server
diff --git a/.github/workflows/e2e-tests-browser-extension.yml b/.github/workflows/e2e-tests-browser-extension.yml
index c8eaf3a9f..6f9acf31b 100644
--- a/.github/workflows/e2e-tests-browser-extension.yml
+++ b/.github/workflows/e2e-tests-browser-extension.yml
@@ -71,7 +71,7 @@ jobs:
npm run build:chrome
- name: Start dev database
- run: ./install.sh configure-dev-db start
+ run: ./scripts/dev.sh db-start
- name: Ensure browsers are installed
working-directory: apps/server
@@ -137,7 +137,7 @@ jobs:
run: dotnet build AliasVault.Api
- name: Start dev database
- run: ./install.sh configure-dev-db start
+ run: ./scripts/dev.sh db-start
- name: Start API server
working-directory: apps/server/AliasVault.Api
diff --git a/.github/workflows/e2e-tests-server.yml b/.github/workflows/e2e-tests-server.yml
index df3d13a93..23e26d269 100644
--- a/.github/workflows/e2e-tests-server.yml
+++ b/.github/workflows/e2e-tests-server.yml
@@ -42,7 +42,7 @@ jobs:
run: dotnet build
- name: Start dev database
- run: ./install.sh configure-dev-db start
+ run: ./scripts/dev.sh db-start
- name: Ensure browsers are installed
working-directory: apps/server
@@ -110,7 +110,7 @@ jobs:
run: dotnet build
- name: Start dev database
- run: ./install.sh configure-dev-db start
+ run: ./scripts/dev.sh db-start
- name: Ensure browsers are installed
working-directory: apps/server
diff --git a/dockerfiles/README.md b/dockerfiles/README.md
index bdab27f57..952170120 100644
--- a/dockerfiles/README.md
+++ b/dockerfiles/README.md
@@ -15,11 +15,11 @@ This build is primarily intended for platforms with **limited management** such
Used to locally build Docker images from source instead of retrieving pre-built images from GitHub Container Registry. Automatically used when running `./install.sh build`.
### `docker-compose.dev.yml`
-Contains containers for aiding in local development of AliasVault. Provides a separate PostgreSQL instance for development on port 5433, managed via `./install.sh configure-dev-db`.
+Contains containers for aiding in local development of AliasVault. Provides a separate PostgreSQL instance for development (port 5109 by default), managed via `./scripts/dev.sh`.
## Usage
- **Standard deployment**: `./install.sh install` (uses multi-container setup and ../docker-compose.yml)
- **Build from source**: `./install.sh build` (uses docker-compose.build.yml)
-- **Development database**: `./install.sh configure-dev-db start`
+- **Development database**: `./scripts/dev.sh db-start` (and `db-stop`)
- **Single container**: Deploy with `docker-compose.all-in-one.yml`
\ No newline at end of file
diff --git a/dockerfiles/docker-compose.dev.yml b/dockerfiles/docker-compose.dev.yml
index 87e76be72..3c3edd919 100644
--- a/dockerfiles/docker-compose.dev.yml
+++ b/dockerfiles/docker-compose.dev.yml
@@ -5,9 +5,10 @@ services:
dockerfile: apps/server/Databases/AliasServerDb/Dockerfile
image: aliasvault-postgres-dev
ports:
- - "5433:5432"
+ # Overridable via env var (scripts/dev.sh), but defaults to 5433.
+ - "${AV_DB_PORT:-5433}:5432"
volumes:
- - ../database/postgres-dev:/var/lib/postgresql/data:rw
+ - "../database/postgres-dev:/var/lib/postgresql/data:rw"
- ../apps/server/Databases/AliasServerDb/postgresql.conf:/etc/postgresql/postgresql.conf
environment:
- POSTGRES_DB=aliasvault
diff --git a/docs/misc/dev/linux-macos-development.md b/docs/misc/dev/linux-macos-development.md
index 263843474..58332e63f 100644
--- a/docs/misc/dev/linux-macos-development.md
+++ b/docs/misc/dev/linux-macos-development.md
@@ -158,12 +158,12 @@ If you encounter database connection issues:
2. **Port Conflicts**
- Run `./scripts/dev.sh ports` to see the ports in use (defaults: API `5100`, database `5109`)
- - If those ports are taken, bump `AV_INSTANCE` in `dev.env.local` to shift the whole block
+ - If those ports are taken, bump `AV_INSTANCE` in `dev.env` to shift the whole block
## Additional Notes
- Keep your .NET SDK and Docker up to date
-- The development database runs on port 5109 by default (configurable via `dev.env.local`)
+- The development database runs on port 5109 by default (configurable via `dev.env`)
- Use the debug encryption key in development for easier testing
- Store sensitive data in environment variables or user secrets
diff --git a/install.sh b/install.sh
index d366388ce..f41bf43fa 100755
--- a/install.sh
+++ b/install.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-# @version 20260608
+# @version 20260613
# Repository information used for downloading files and images from GitHub
REPO_OWNER="aliasvault"
@@ -69,16 +69,12 @@ show_usage() {
printf " update Update AliasVault including install.sh script to the latest version\n"
printf " update-installer Update install.sh script if newer version is available\n"
printf "\n"
- printf " db-export Export database to file\n"
- printf " db-import Import database from file\n"
- printf "\n"
- printf " configure-dev-db Enable/disable development database (for local development only)\n"
+ printf " db-export Export database to file (run for usage and options)\n"
+ printf " db-import Import database from file (run for usage and options)\n"
printf "\n"
printf "Options:\n"
printf " --verbose Show detailed output\n"
printf " -y, --yes Automatic yes to prompts\n"
- printf " --dev Target development database for db import/export operations\n"
- printf " --parallel=N Use pigz with N threads for faster compression (db-export only, max: 32)\n"
printf "\n"
}
@@ -99,7 +95,7 @@ print_logo() {
# Canonical command list (primary forms only, no aliases). Used by
# suggest_commands to render "Did you mean..." prefix matches when the user
# enters an unknown command. Keep sorted so suggestions appear in stable order.
-KNOWN_COMMANDS="build configure-admin-access configure-dev-db configure-email configure-hostname configure-ip-logging configure-registration configure-ssl configure-trusted-proxies db-export db-import install migrate-db reset-admin-password restart start stop uninstall update update-installer"
+KNOWN_COMMANDS="build configure-admin-access configure-email configure-hostname configure-ip-logging configure-registration configure-ssl configure-trusted-proxies db-export db-import install migrate-db reset-admin-password restart start stop uninstall update update-installer"
# Print "Did you mean ..." suggestions for any known command that has the user's
# input as a prefix. Returns 0 if at least one match was found, 1 otherwise.
@@ -223,15 +219,6 @@ parse_args() {
COMMAND="update-installer"
shift
;;
- configure-dev-db|dev-db)
- COMMAND="configure-dev-db"
- shift
- # Check for direct option argument
- if [ $# -gt 0 ] && [[ ! "$1" =~ ^- ]]; then
- COMMAND_ARG="$1"
- shift
- fi
- ;;
migrate-db|migrate)
COMMAND="migrate-db"
shift
@@ -945,7 +932,7 @@ main() {
exit 1
fi
;;
- "install"|"build"|"update"|"configure-dev-db")
+ "install"|"build"|"update")
# Full dependency check for operations that require Docker
if ! check_dependencies; then
exit 1
@@ -1029,9 +1016,6 @@ main() {
check_install_script_update
exit $?
;;
- "configure-dev-db")
- configure_dev_database
- ;;
"db-export")
handle_db_export
;;
@@ -2838,124 +2822,6 @@ handle_install_version() {
print_install_success_message
}
-# Function to handle development database configuration
-configure_dev_database() {
- printf "${YELLOW}+++ Development Database Configuration +++${NC}\n"
- printf "\n"
-
- if [ ! -f "dockerfiles/docker-compose.dev.yml" ]; then
- printf "${RED}> The dockerfiles/docker-compose.dev.yml file is missing. This file is required to start the development database. Please checkout the full GitHub repository and try again.${NC}\n"
- return 1
- fi
-
- # Check if direct option was provided
- if [ -n "$COMMAND_ARG" ]; then
- case $COMMAND_ARG in
- 1|start)
- if docker compose -f dockerfiles/docker-compose.dev.yml -p aliasvault-dev ps --status running 2>/dev/null | grep -q postgres-dev; then
- printf "${YELLOW}> Development database is already running.${NC}\n"
- else
- printf "${CYAN}> Starting development database...${NC}\n"
- docker compose -p aliasvault-dev -f dockerfiles/docker-compose.dev.yml up -d --wait --wait-timeout 60
- printf "${GREEN}> Development database started successfully.${NC}\n"
- fi
- print_dev_db_details
- return
- ;;
- 0|stop)
- if ! docker compose -f dockerfiles/docker-compose.dev.yml -p aliasvault-dev ps --status running 2>/dev/null | grep -q postgres-dev; then
- printf "${YELLOW}> Development database is already stopped.${NC}\n"
- else
- printf "${CYAN}> Stopping development database...${NC}\n"
- docker compose -p aliasvault-dev -f dockerfiles/docker-compose.dev.yml down
- printf "${GREEN}> Development database stopped successfully.${NC}\n"
- fi
- return
- ;;
- esac
- fi
-
- # Check current status
- if docker compose -f dockerfiles/docker-compose.dev.yml -p aliasvault-dev ps --status running 2>/dev/null | grep -q postgres-dev; then
- DEV_DB_STATUS="running"
- else
- DEV_DB_STATUS="stopped"
- fi
-
- printf "${CYAN}About Development Database:${NC}\n"
- printf "A separate PostgreSQL instance for development purposes that:\n"
- printf " - Runs on port 5433 (to avoid conflicts)\n"
- printf " - Uses simple credentials (password: 'password')\n"
- printf " - Stores data separately from production\n"
- printf "\n"
- printf "${CYAN}Current Status:${NC}\n"
- if [ "$DEV_DB_STATUS" = "running" ]; then
- printf "Development Database: ${GREEN}Running${NC}\n"
- else
- printf "Development Database: ${YELLOW}Stopped${NC}\n"
- fi
- printf "\n"
- printf "Options:\n"
- printf "1) Start development database\n"
- printf "2) Stop development database\n"
- printf "3) View connection details\n"
- printf "4) Cancel\n"
- printf "\n"
-
- read -p "Select an option [1-4]: " dev_db_option
-
- case $dev_db_option in
- 1)
- if [ "$DEV_DB_STATUS" = "running" ]; then
- printf "${YELLOW}> Development database is already running.${NC}\n"
- else
- printf "${CYAN}> Starting development database...${NC}\n"
- docker compose -p aliasvault-dev -f dockerfiles/docker-compose.dev.yml up -d --wait --wait-timeout 60
- printf "${GREEN}> Development database started successfully.${NC}\n"
- fi
- print_dev_db_details
- ;;
- 2)
- if [ "$DEV_DB_STATUS" = "stopped" ]; then
- printf "${YELLOW}> Development database is already stopped.${NC}\n"
- else
- printf "${CYAN}> Stopping development database...${NC}\n"
- docker compose -p aliasvault-dev -f dockerfiles/docker-compose.dev.yml down
- printf "${GREEN}> Development database stopped successfully.${NC}\n"
- fi
- ;;
- 3)
- print_dev_db_details
- ;;
- 4)
- printf "${YELLOW}Configuration cancelled.${NC}\n"
- exit 0
- ;;
- *)
- printf "${RED}Invalid option selected.${NC}\n"
- exit 1
- ;;
- esac
-}
-
-# Function to print development database connection details
-print_dev_db_details() {
- printf "\n"
- printf "${MAGENTA}=========================================================${NC}\n"
- printf "\n"
- printf "${CYAN}Development Database Connection Details:${NC}\n"
- printf "Host: localhost\n"
- printf "Port: 5433\n"
- printf "Database: aliasvault\n"
- printf "Username: aliasvault\n"
- printf "Password: password\n"
- printf "\n"
- printf "Connection string:\n"
- printf "Host=localhost;Port=5433;Database=aliasvault;Username=aliasvault;Password=password\n"
- printf "\n"
- printf "${MAGENTA}=========================================================${NC}\n"
-}
-
# Function to set deployment mode in .env
set_deployment_mode() {
local mode=$1
@@ -2975,7 +2841,7 @@ handle_db_export() {
printf "Usage: ./install.sh db-export [OPTIONS] > backup.sql.gz\n" >&2
printf "\n" >&2
printf "Options:\n" >&2
- printf " --dev Export from development database\n" >&2
+ printf " --dev Export from the development database (default: production)\n" >&2
printf " --parallel=N Use pigz with N threads for faster compression (max: 32)\n" >&2
printf "\n" >&2
printf "Examples:\n" >&2
@@ -2991,7 +2857,7 @@ handle_db_export() {
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
- printf "${RED}Error: Development database container is not running. Start it first with: ./install.sh configure-dev-db${NC}\n" >&2
+ printf "${RED}Error: Development database container is not running. Start it first with: ./scripts/dev.sh db-start${NC}\n" >&2
exit 1
fi
@@ -3064,34 +2930,35 @@ handle_db_import() {
printf "${YELLOW}+++ Importing Database +++${NC}\n"
- # 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
- printf "${RED}Error: Development PostgreSQL container is not healthy.${NC}\n"
- exit 1
- fi
- else
- if ! docker compose ps postgres | grep -q "healthy"; then
- printf "${RED}Error: PostgreSQL container is not healthy.${NC}\n"
- exit 1
- fi
- fi
-
- # Check if we're getting input from a pipe (check fd 3 instead of stdin now)
+ # Show usage when there's no piped input before any container checks so `db-import`
+ # with no input always explains itself.
if [ -t 3 ]; then
printf "Usage: ./install.sh db-import [OPTIONS] < backup_file\n"
printf "\n"
printf "Options:\n"
- printf " --dev Import to development database\n"
+ printf " --dev Import into the development database (default: production)\n"
printf "\n"
printf "Examples:\n"
printf " ./install.sh db-import < backup.sql.gz # Import gzipped SQL\n"
printf " ./install.sh db-import < backup.sql # Import plain SQL\n"
- printf " ./install.sh db-import --dev < backup.sql.gz # Import to dev database\n"
+ printf " ./install.sh db-import --dev < backup.sql.gz # Import into dev database\n"
printf "\n"
exit 1
fi
+ # 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
+ printf "${RED}Error: Development PostgreSQL container is not healthy. Start it first with: ./scripts/dev.sh db-start${NC}\n"
+ exit 1
+ fi
+ else
+ if ! docker compose ps postgres | grep -q "healthy"; then
+ printf "${RED}Error: PostgreSQL container is not healthy.${NC}\n"
+ exit 1
+ fi
+ fi
+
printf "${RED}Warning: This will DELETE ALL EXISTING DATA in the "
if [ "$DEV_DB" = true ]; then
printf "development database"
diff --git a/scripts/dev.sh b/scripts/dev.sh
index 324a94d3f..f4550298f 100755
--- a/scripts/dev.sh
+++ b/scripts/dev.sh
@@ -6,16 +6,9 @@
# setup: every service runs from source on a single, consistent set of ports,
# so the apps always know where to find each other.
#
-# Each invocation starts exactly one app/service. To run several at once,
-# launch multiple instances (e.g. the VS Code tasks fan out one call per app).
-#
-# Config defaults live in this script; per-machine overrides go in the
-# (gitignored) ./dev.env.local, which is created from a template on first run.
-#
# Usage:
# ./scripts/dev.sh # interactive menu (pick an app)
# ./scripts/dev.sh <app> # start one app: api | client | admin | smtp | taskrunner | ext | mobile
-# ./scripts/dev.sh db # toggle the dev database (start if stopped, else stop)
# ./scripts/dev.sh db-start # start (only) the dev database
# ./scripts/dev.sh db-stop # stop & remove this instance's dev database
# ./scripts/dev.sh ports # print the resolved port map and exit
@@ -38,13 +31,13 @@ info() { printf "%s==>%s %s\n" "$CYAN" "$NC" "$1"; }
warn() { printf "%s! %s%s\n" "$YELLOW" "$1" "$NC"; }
die() { printf "%sError:%s %s\n" "$RED" "$NC" "$1" >&2; exit 1; }
-LOCAL_ENV="$ROOT_DIR/dev.env.local"
+LOCAL_ENV="$ROOT_DIR/dev.env"
# --- Config defaults -----------------------------------------------------------
DEFAULT_BASE_PORT=5100 # first port of the block; every service counts up from here
DEFAULT_PORT_STRIDE=10 # how far apart consecutive instances are spaced
-# Write the dev.env.local template, with AV_INSTANCE pinned to the given value.
+# Write the dev.env template, with AV_INSTANCE pinned to the given value.
seed_local_env() {
cat > "$LOCAL_ENV" <<ENV
# ----------------------------------------------------------------------------
@@ -73,10 +66,10 @@ ENV
}
# --- Load port config ----------------------------------------------------------
-# First run: create a dev.env.local set to instance 0.
+# First run: create a dev.env set to instance 0.
if [ ! -f "$LOCAL_ENV" ]; then
seed_local_env 0
- info "Created dev.env.local (instance 0). Bump AV_INSTANCE there if the default ports are in use."
+ info "Created dev.env (instance 0). Bump AV_INSTANCE there if the default ports are in use."
fi
# shellcheck disable=SC1091
@@ -84,11 +77,11 @@ set -a
. "$LOCAL_ENV"
set +a
-# Precedence: dev.env.local > built-in defaults.
+# Precedence: dev.env > built-in defaults.
AV_INSTANCE="${AV_INSTANCE:-0}"
AV_BASE_PORT="${AV_BASE_PORT:-$DEFAULT_BASE_PORT}"
AV_PORT_STRIDE="${AV_PORT_STRIDE:-$DEFAULT_PORT_STRIDE}"
-# Default true for pre-existing dev.env.local files that predate this setting.
+# Default true for pre-existing dev.env files that predate this setting.
AV_USE_DEBUG_ENCRYPTION_KEY="${AV_USE_DEBUG_ENCRYPTION_KEY:-true}"
case "$AV_INSTANCE" in (*[!0-9]*|"") die "AV_INSTANCE must be a non-negative integer (got '$AV_INSTANCE').";; esac
case "$AV_USE_DEBUG_ENCRYPTION_KEY" in true|false) ;; (*) die "AV_USE_DEBUG_ENCRYPTION_KEY must be 'true' or 'false' (got '$AV_USE_DEBUG_ENCRYPTION_KEY').";; esac