Use pushd/popd and set ALEMBIC_CONFIG

Replace plain cd with pushd/popd (silenced) when building the frontend and running migrations to preserve the original working directory. Ensure database migrations run from /opt/gramps-web-api and export ALEMBIC_CONFIG in both install and update scripts so Alembic uses the correct config. Minor cleanup to silence directory stack output.
This commit is contained in:
CanbiZ (MickLesk) 2026-02-17 10:24:47 +01:00
parent 6c43b624c1
commit f1da768e02
2 changed files with 10 additions and 2 deletions

View File

@ -85,18 +85,22 @@ function update_script() {
msg_ok "Updated Gramps Web API"
msg_info "Updating Gramps Web Frontend"
cd /opt/gramps-web/frontend
pushd /opt/gramps-web/frontend >/dev/null
export COREPACK_ENABLE_DOWNLOAD_PROMPT=0
corepack enable
$STD npm install
$STD npm run build
popd >/dev/null
msg_ok "Updated Gramps Web Frontend"
msg_info "Applying Database Migration"
pushd /opt/gramps-web-api >/dev/null
GRAMPS_API_CONFIG=/opt/gramps-web/config/config.cfg \
ALEMBIC_CONFIG=/opt/gramps-web-api/alembic.ini \
GRAMPSHOME=/opt/gramps-web/data/gramps \
GRAMPS_DATABASE_PATH=/opt/gramps-web/data/gramps/grampsdb \
$STD /opt/gramps-web/venv/bin/python3 -m gramps_webapi user migrate
popd >/dev/null
msg_ok "Applied Database Migration"
msg_info "Starting Service"

View File

@ -88,16 +88,20 @@ $STD uv pip install --no-cache-dir --upgrade pip setuptools wheel
$STD uv pip install --no-cache-dir gunicorn
$STD uv pip install --no-cache-dir /opt/gramps-web-api
cd /opt/gramps-web/frontend
pushd /opt/gramps-web/frontend >/dev/null
export COREPACK_ENABLE_DOWNLOAD_PROMPT=0
corepack enable
$STD npm install
$STD npm run build
popd >/dev/null
pushd /opt/gramps-web-api >/dev/null
GRAMPS_API_CONFIG=/opt/gramps-web/config/config.cfg \
ALEMBIC_CONFIG=/opt/gramps-web-api/alembic.ini \
GRAMPSHOME=/opt/gramps-web/data/gramps \
GRAMPS_DATABASE_PATH=/opt/gramps-web/data/gramps/grampsdb \
$STD /opt/gramps-web/venv/bin/python3 -m gramps_webapi user migrate
popd >/dev/null
msg_ok "Set up Gramps Web"
msg_info "Creating Service"