Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions .github/workflows/db-backup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,23 @@ jobs:
run: |
set -euo pipefail
DUMP_DIR="inferencex-dump-$(date -u +%Y-%m-%d)"
( s=0; while sleep 30; do s=$((s + 30)); sz=$(du -sh "packages/db/$DUMP_DIR" 2>/dev/null | cut -f1); printf ' [dump] running %dm%02ds, %s written...\n' $((s / 60)) $((s % 60)) "${sz:-0B}"; done ) &
trap 'kill %1 2>/dev/null || true' EXIT
pnpm admin:db:dump "$DUMP_DIR"
# Keep every table intact: tar the dump, compress with xz/lzma2, and split into
# <2 GiB parts to stay under GitHub's per-release-asset cap (even as data grows).
echo "DUMP_DIR=${DUMP_DIR}" >> "$GITHUB_ENV"
echo "TAG=db-dump/$(date -u +%Y-%m-%d)" >> "$GITHUB_ENV"

- name: Compress and split dump
run: |
set -euo pipefail
( s=0; while sleep 30; do s=$((s + 30)); sz=$(du -ch "${GITHUB_WORKSPACE}/${DUMP_DIR}".tar.xz.part* 2>/dev/null | tail -1 | cut -f1); printf ' [compress] running %dm%02ds, %s written...\n' $((s / 60)) $((s % 60)) "${sz:-0B}"; done ) &
trap 'kill %1 2>/dev/null || true' EXIT
( cd packages/db
tar -cf - "$DUMP_DIR" \
| xz -T0 --lzma2=preset=9e,dict=192MiB \
| xz -v -T0 --memlimit-compress=95% --lzma2=preset=9e,dict=192MiB \
| split -b 1900m -d -a 2 - "${GITHUB_WORKSPACE}/${DUMP_DIR}.tar.xz.part" )
echo "DUMP_GLOB=${DUMP_DIR}.tar.xz.part*" >> "$GITHUB_ENV"
echo "TAG=db-dump/$(date -u +%Y-%m-%d)" >> "$GITHUB_ENV"

- name: Create release
env:
GH_TOKEN: ${{ github.token }}
Expand Down