This commit is contained in:
1 parent
64db83c5d3
commit
15966bcf6d
1 file changed
+1
-25
@@ -50,31 +50,7 @@ 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 with Rotation (Keeps only last 5 backups)
|
# 5. Apply versioned CMS migrations and generate the Prisma client safely
|
||||||
echo "Creating database backup..."
|
|
||||||
BACKUP_DIR="/var/www/atom-nexst/backups"
|
|
||||||
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