From f1da768e02611b525ac9ece6e0a41d170fd1eddd Mon Sep 17 00:00:00 2001 From: "CanbiZ (MickLesk)" <47820557+MickLesk@users.noreply.github.com> Date: Tue, 17 Feb 2026 10:24:47 +0100 Subject: [PATCH] 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. --- ct/gramps-web.sh | 6 +++++- install/gramps-web-install.sh | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ct/gramps-web.sh b/ct/gramps-web.sh index fe3d29ece..19f8a0858 100644 --- a/ct/gramps-web.sh +++ b/ct/gramps-web.sh @@ -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" diff --git a/install/gramps-web-install.sh b/install/gramps-web-install.sh index dde886341..0014d670b 100644 --- a/install/gramps-web-install.sh +++ b/install/gramps-web-install.sh @@ -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"