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:
parent
6c43b624c1
commit
f1da768e02
@ -85,18 +85,22 @@ function update_script() {
|
|||||||
msg_ok "Updated Gramps Web API"
|
msg_ok "Updated Gramps Web API"
|
||||||
|
|
||||||
msg_info "Updating Gramps Web Frontend"
|
msg_info "Updating Gramps Web Frontend"
|
||||||
cd /opt/gramps-web/frontend
|
pushd /opt/gramps-web/frontend >/dev/null
|
||||||
export COREPACK_ENABLE_DOWNLOAD_PROMPT=0
|
export COREPACK_ENABLE_DOWNLOAD_PROMPT=0
|
||||||
corepack enable
|
corepack enable
|
||||||
$STD npm install
|
$STD npm install
|
||||||
$STD npm run build
|
$STD npm run build
|
||||||
|
popd >/dev/null
|
||||||
msg_ok "Updated Gramps Web Frontend"
|
msg_ok "Updated Gramps Web Frontend"
|
||||||
|
|
||||||
msg_info "Applying Database Migration"
|
msg_info "Applying Database Migration"
|
||||||
|
pushd /opt/gramps-web-api >/dev/null
|
||||||
GRAMPS_API_CONFIG=/opt/gramps-web/config/config.cfg \
|
GRAMPS_API_CONFIG=/opt/gramps-web/config/config.cfg \
|
||||||
|
ALEMBIC_CONFIG=/opt/gramps-web-api/alembic.ini \
|
||||||
GRAMPSHOME=/opt/gramps-web/data/gramps \
|
GRAMPSHOME=/opt/gramps-web/data/gramps \
|
||||||
GRAMPS_DATABASE_PATH=/opt/gramps-web/data/gramps/grampsdb \
|
GRAMPS_DATABASE_PATH=/opt/gramps-web/data/gramps/grampsdb \
|
||||||
$STD /opt/gramps-web/venv/bin/python3 -m gramps_webapi user migrate
|
$STD /opt/gramps-web/venv/bin/python3 -m gramps_webapi user migrate
|
||||||
|
popd >/dev/null
|
||||||
msg_ok "Applied Database Migration"
|
msg_ok "Applied Database Migration"
|
||||||
|
|
||||||
msg_info "Starting Service"
|
msg_info "Starting Service"
|
||||||
|
|||||||
@ -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 gunicorn
|
||||||
$STD uv pip install --no-cache-dir /opt/gramps-web-api
|
$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
|
export COREPACK_ENABLE_DOWNLOAD_PROMPT=0
|
||||||
corepack enable
|
corepack enable
|
||||||
$STD npm install
|
$STD npm install
|
||||||
$STD npm run build
|
$STD npm run build
|
||||||
|
popd >/dev/null
|
||||||
|
|
||||||
|
pushd /opt/gramps-web-api >/dev/null
|
||||||
GRAMPS_API_CONFIG=/opt/gramps-web/config/config.cfg \
|
GRAMPS_API_CONFIG=/opt/gramps-web/config/config.cfg \
|
||||||
|
ALEMBIC_CONFIG=/opt/gramps-web-api/alembic.ini \
|
||||||
GRAMPSHOME=/opt/gramps-web/data/gramps \
|
GRAMPSHOME=/opt/gramps-web/data/gramps \
|
||||||
GRAMPS_DATABASE_PATH=/opt/gramps-web/data/gramps/grampsdb \
|
GRAMPS_DATABASE_PATH=/opt/gramps-web/data/gramps/grampsdb \
|
||||||
$STD /opt/gramps-web/venv/bin/python3 -m gramps_webapi user migrate
|
$STD /opt/gramps-web/venv/bin/python3 -m gramps_webapi user migrate
|
||||||
|
popd >/dev/null
|
||||||
msg_ok "Set up Gramps Web"
|
msg_ok "Set up Gramps Web"
|
||||||
|
|
||||||
msg_info "Creating Service"
|
msg_info "Creating Service"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user