This commit is contained in:
1 parent
3802a1cfb0
commit
64db83c5d3
1 file changed
+23
-4
@@ -50,12 +50,31 @@ jobs:
|
|||||||
export PNPM_CONFIG_ONLY_BUILT_DEPENDENCIES="@parcel/watcher,@swc/core,sharp"
|
export PNPM_CONFIG_ONLY_BUILT_DEPENDENCIES="@parcel/watcher,@swc/core,sharp"
|
||||||
pnpm install --frozen-lockfile
|
pnpm install --frozen-lockfile
|
||||||
|
|
||||||
# 5. [SAFETY] Database Backup & Migration
|
# 5. [SAFETY] Database Backup with Rotation (Keeps only last 5 backups)
|
||||||
# TIP: Adjust this to your database (e.g., pg_dump for Postgres or cp for SQLite)
|
|
||||||
echo "Creating database backup..."
|
echo "Creating database backup..."
|
||||||
# Example for SQLite:
|
BACKUP_DIR="/var/www/atom-nexst/backups"
|
||||||
# cp prisma/dev.db prisma/backup_prior_to_deploy.db
|
mkdir -p "$BACKUP_DIR"
|
||||||
|
|
||||||
|
TIMESTAMP=$(date +%Y%m%d_%H%M%S)
|
||||||
|
BACKUP_FILE="$BACKUP_DIR/db_backup_$TIMESTAMP.sql"
|
||||||
|
|
||||||
|
# ----------------- DATABASE CONFIGURATION -----------------
|
||||||
|
# Read credentials directly from your .env file or environment if available,
|
||||||
|
# or customize these variables to match your system.
|
||||||
|
DB_USER="root"
|
||||||
|
DB_NAME="epicnext"
|
||||||
|
# ----------------------------------------------------------
|
||||||
|
|
||||||
|
# Create a secure, compressed backup using mysqldump
|
||||||
|
# Note: If your MySQL requires a password, add '-pYourPassword' (no space after -p)
|
||||||
|
# or configure a secure /home/user/.my.cnf file to read credentials automatically.
|
||||||
|
mysqldump -u "$DB_USER" "$DB_NAME" > "$BACKUP_FILE"
|
||||||
|
|
||||||
|
echo "Rotating older backups (keeping only the 5 newest files)..."
|
||||||
|
# Lists backup files newest first, skips the first 5, and deletes any remaining older files
|
||||||
|
ls -dt "$BACKUP_DIR"/db_backup_*.sql | tail -n +6 | xargs -r rm
|
||||||
|
|
||||||
|
# Apply versioned CMS migrations and generate the Prisma client safely
|
||||||
pnpm db:migrate
|
pnpm db:migrate
|
||||||
pnpm prisma:generate
|
pnpm prisma:generate
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user