Fix production deploy: sync lockfile, Prisma engines, and build.
The Docker build failed because pnpm-lock.yaml was stale after removing Sanity and adding Prisma/admin deps. Bundle debian-openssl-3.0.x engines for node:20-slim, fix invalid tiptap package, and avoid DB access during next build. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
14
scripts/fetch-prisma-binaries.sh
Normal file
14
scripts/fetch-prisma-binaries.sh
Normal file
@@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env bash
|
||||
# Download Prisma engines for node:20-slim (debian-openssl-3.0.x). Run on a machine with internet.
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
pnpm install --registry https://registry.npmjs.org
|
||||
PRISMA_CLI_BINARY_TARGETS=debian-openssl-3.0.x pnpm exec prisma generate
|
||||
|
||||
ENGINES="$(find node_modules -path '*/@prisma/engines' -type d | head -1)"
|
||||
mkdir -p prisma-binaries
|
||||
cp "$ENGINES/libquery_engine-debian-openssl-3.0.x.so.node" prisma-binaries/
|
||||
cp "$ENGINES/schema-engine-debian-openssl-3.0.x" prisma-binaries/
|
||||
chmod +x prisma-binaries/schema-engine-debian-openssl-3.0.x
|
||||
ls -lh prisma-binaries/
|
||||
55
scripts/server-deploy.sh
Executable file
55
scripts/server-deploy.sh
Executable file
@@ -0,0 +1,55 @@
|
||||
#!/usr/bin/env bash
|
||||
# Manual deploy on NODE Cloud (no CI). Run on the server as root.
|
||||
set -euo pipefail
|
||||
APP_DIR="/srv/nodecloud/apps/biztaghavisite"
|
||||
PORT=3009
|
||||
|
||||
cd "$APP_DIR"
|
||||
|
||||
echo "==> Pull latest code"
|
||||
git pull origin main
|
||||
|
||||
echo "==> Ensure Docker network"
|
||||
docker network inspect nodecloud-net >/dev/null 2>&1 || docker network create nodecloud-net
|
||||
|
||||
if [[ ! -f .env ]]; then
|
||||
echo "ERROR: $APP_DIR/.env missing. Copy from .env.example and fill values."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "==> Build image (10–20 min on first run; Liara mirror may be slow)"
|
||||
docker compose build --no-cache
|
||||
|
||||
echo "==> Start MariaDB + app"
|
||||
docker compose up -d
|
||||
|
||||
echo "==> Wait for MariaDB"
|
||||
for i in $(seq 1 30); do
|
||||
if docker compose exec -T db healthcheck.sh --connect --innodb_initialized >/dev/null 2>&1; then
|
||||
echo " MariaDB healthy"
|
||||
break
|
||||
fi
|
||||
sleep 2
|
||||
done
|
||||
|
||||
echo "==> Apply database schema (idempotent)"
|
||||
set -a
|
||||
# shellcheck disable=SC1091
|
||||
source .env
|
||||
set +a
|
||||
docker compose exec -T db mariadb -u "${DB_USER:-biztaghavi}" -p"${DB_PASSWORD}" "${DB_NAME:-biztaghavi}" \
|
||||
< prisma/migrations/0_init/migration.sql || true
|
||||
|
||||
echo "==> Health check"
|
||||
sleep 3
|
||||
curl -sf "http://127.0.0.1:${PORT}/" -o /dev/null && echo "OK: app responds on :${PORT}" || {
|
||||
echo "FAIL: app not responding"
|
||||
docker compose logs --tail=80 next-app
|
||||
exit 1
|
||||
}
|
||||
|
||||
curl -sI -H "Host: biztaghavi.com" "http://127.0.0.1/" | head -5
|
||||
docker compose ps
|
||||
echo ""
|
||||
echo "Done. Test https://biztaghavi.com — purge ArvanCloud cache if needed."
|
||||
echo "Create admin once: curl -X POST https://biztaghavi.com/api/admin/setup ..."
|
||||
Reference in New Issue
Block a user