From 4a4cb9739b6424c949da4abcd0f9a8bd4e0b2c41 Mon Sep 17 00:00:00 2001 From: RaineAllDay Date: Wed, 18 Mar 2026 03:54:51 -0600 Subject: [PATCH] update deploy scripts --- scripts/deploy.sh | 13 ++++++++++--- scripts/resume-deploy.sh | 11 ++++++++--- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/scripts/deploy.sh b/scripts/deploy.sh index a94bfc3..2081112 100644 --- a/scripts/deploy.sh +++ b/scripts/deploy.sh @@ -164,6 +164,9 @@ for DIR in /opt/etc-prs "$APP_DIR" "$DATA_DIR" "$LOG_DIR" "$BACKUP_DIR"; do done chown -R "${APP_USER}:${APP_USER}" /opt/etc-prs "$DATA_DIR" "$LOG_DIR" "$BACKUP_DIR" +# SQLite WAL mode needs the process to create/write -wal and -shm sidecar files. +# Since PM2 runs as root, the data dir and DB files must be writable by root. +chmod 777 "$DATA_DIR" success "Directories created and ownership set" # ── Step 3: Clone from Gitea ────────────────────────────────────────────────── @@ -224,9 +227,13 @@ module.exports = { script: '${APP_DIR}/build/index.js', cwd: '${APP_DIR}', env: { - NODE_ENV: 'production', - PORT: '3000', - HOST: '127.0.0.1', + NODE_ENV: 'production', + PORT: '3000', + HOST: '127.0.0.1', + DATABASE_URL: '${DATA_DIR}/personalities.db', + RATE_LIMIT_PUBLISH: '${RATE_PUBLISH}', + RATE_LIMIT_READ: '${RATE_READ}', + PUBLIC_BASE_URL: 'https://${DOMAIN}', }, error_file: '${LOG_DIR}/error.log', out_file: '${LOG_DIR}/out.log', diff --git a/scripts/resume-deploy.sh b/scripts/resume-deploy.sh index a5f2a49..6b70a3b 100644 --- a/scripts/resume-deploy.sh +++ b/scripts/resume-deploy.sh @@ -208,6 +208,7 @@ for DIR in /opt/etc-prs "$APP_DIR" "$DATA_DIR" "$LOG_DIR" "$BACKUP_DIR"; do mkdir -p "$DIR" done chown -R "${APP_USER}:${APP_USER}" /opt/etc-prs "$DATA_DIR" "$LOG_DIR" "$BACKUP_DIR" +chmod 777 "$DATA_DIR" success "Directories OK" # ── Step 3: Clone / pull repo ───────────────────────────────────────────────── @@ -273,9 +274,13 @@ module.exports = { script: '${APP_DIR}/build/index.js', cwd: '${APP_DIR}', env: { - NODE_ENV: 'production', - PORT: '3000', - HOST: '127.0.0.1', + NODE_ENV: 'production', + PORT: '3000', + HOST: '127.0.0.1', + DATABASE_URL: '${DATA_DIR}/personalities.db', + RATE_LIMIT_PUBLISH: '${RATE_PUBLISH}', + RATE_LIMIT_READ: '${RATE_READ}', + PUBLIC_BASE_URL: 'https://${DOMAIN}', }, error_file: '${LOG_DIR}/error.log', out_file: '${LOG_DIR}/out.log',