Fix SQLite init: lazy loading, writability check, and host permissions
All checks were successful
Deploy Website / build-and-deploy (push) Successful in 30s

DB initialization was eager at module import time, crashing the entire
analytics route when /server_storage wasn't writable. Now deferred to
first logVisit() call with graceful fallback. Also fix deploy workflow
to chown via a bind-mounted container so permissions apply on the host.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Shivam Patel
2026-02-09 00:17:44 -05:00
parent 4a01928fe7
commit 9cf5f9620c
2 changed files with 45 additions and 25 deletions

View File

@@ -24,14 +24,10 @@ jobs:
- name: Prepare Host Storage
run: |
# 1. Create the host folder if it doesn't exist
sudo mkdir -p /server_storage
# 2. Fix permissions for the 'nextjs' user (UID 1001)
# Since your Dockerfile runs as user 1001, it cannot write to
# a root-owned folder without this chown command.
sudo chown -R 1001:1001 /server_storage
sudo chmod -R 755 /server_storage
# The bind mount creates /server_storage on the host if missing.
# Run a throwaway container to fix ownership so UID 1001 (nextjs) can write.
docker run --rm -v /server_storage:/data alpine sh -c \
"chown -R 1001:1001 /data && chmod -R 755 /data"
- name: Run New Container
run: |