- multi-stage Dockerfile; worker bundled to build/worker.mjs (no tsx at runtime) - docker-compose.yml + docker-compose.nginx.yml (127.0.0.1:3320), Nginx site, encrypted backups - production URLs (datewise.metatronlabz.com) in shopify.app.toml; URL auto-update off - verified locally: healthz/landing/privacy/terms 200, unsigned proxy/webhook 400, worker starts Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
20 lines
895 B
Bash
20 lines
895 B
Bash
#!/bin/sh
|
|
# Encrypted nightly Postgres backup for Datewise. Run from the app folder on the VPS.
|
|
# Setup once: openssl rand -hex 32 > /root/.datewise-backup-key && chmod 600 /root/.datewise-backup-key
|
|
# Cron (3 am): 0 3 * * * /opt/datewise/scripts/backup.sh >> /var/log/datewise-backup.log 2>&1
|
|
# Restore: openssl enc -d -aes-256-cbc -pbkdf2 -pass file:/root/.datewise-backup-key -in FILE | gunzip | \
|
|
# docker compose exec -T db psql -U datewise datewise
|
|
set -eu
|
|
cd "$(dirname "$0")/.."
|
|
KEY=/root/.datewise-backup-key
|
|
DIR=/root/backups
|
|
mkdir -p "$DIR"
|
|
chmod 700 "$DIR"
|
|
OUT="$DIR/datewise-$(date +%F).sql.gz.enc"
|
|
docker compose exec -T db pg_dump -U datewise datewise | gzip | \
|
|
openssl enc -aes-256-cbc -pbkdf2 -salt -pass "file:$KEY" -out "$OUT"
|
|
chmod 600 "$OUT"
|
|
# keep 14 days
|
|
find "$DIR" -name 'datewise-*.sql.gz.enc' -mtime +14 -delete
|
|
echo "$(date -Is) backup ok: $OUT"
|