PostgreSQL backup tool with Point-In-Time-Recovery and restore verification
TypeScript backupbackupsdatabasedatabase-backupdevopsdockergolangkubernetesmariadbmongodbmysqlpgpostgrespostgresqls3self-hostedsystem-administrationtoolsweb-ui
BREAKING CHANGE: Bump verwion to 1.0
Rostislav Dugin07ad7d9a2a57
diff --git a/.github/workflows/release.yml b/.github/workflows/ci-release.ymlsimilarity index 52%rename from .github/workflows/release.ymlrename to .github/workflows/ci-release.ymlindex 19902ca2..6fd88c58 100644--- a/.github/workflows/release.yml+++ b/.github/workflows/ci-release.yml@@ -1,4 +1,4 @@-name: Automated Release+name: CI and Releaseon:push:@@ -6,34 +6,105 @@ on:workflow_dispatch:jobs:- release:+ lint-backend:runs-on: ubuntu-latest- if: ${{ !contains(github.event.head_commit.message, '[skip-release]') }}- permissions:- contents: write- pull-requests: write-steps:- name: Check out codeuses: actions/checkout@v4++ - name: Set up Go+ uses: actions/setup-go@v5with:- fetch-depth: 0- token: ${{ secrets.GITHUB_TOKEN }}+ go-version: "1.23.3"++ - name: Cache Go modules+ uses: actions/cache@v4+ with:+ path: |+ ~/go/pkg/mod+ ~/.cache/go-build+ key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}+ restore-keys: |+ ${{ runner.os }}-go-++ - name: Install golangci-lint+ run: |+ curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.60.3+ echo "$(go env GOPATH)/bin" >> $GITHUB_PATH++ - name: Install swag for swagger generation+ run: go install github.com/swaggo/swag/cmd/[email protected]++ - name: Generate swagger docs+ run: |+ cd backend+ swag init -d . -g cmd/main.go -o swagger++ - name: Run golangci-lint+ run: |+ cd backend+ golangci-lint run++ - name: Verify go mod tidy+ run: |+ cd backend+ go mod tidy+ git diff --exit-code go.mod go.sum || (echo "go mod tidy made changes, please run 'go mod tidy' and commit the changes" && exit 1)++ lint-frontend:+ runs-on: ubuntu-latest+ steps:+ - name: Check out code+ uses: actions/checkout@v4- name: Set up Node.jsuses: actions/setup-node@v4with:node-version: "20"+ cache: "npm"+ cache-dependency-path: frontend/package-lock.json- name: Install dependenciesrun: |- npm install -g conventional-changelog-cli- npm install -g semver+ cd frontend+ npm ci++ - name: Check if prettier was run+ run: |+ cd frontend+ npm run format+ git diff --exit-code || (echo "Prettier made changes, please run 'npm run format' and commit the changes" && exit 1)++ - name: Check if linter was run+ run: |+ cd frontend+ npm run lint++ determine-version:+ runs-on: ubuntu-latest+ needs: [lint-backend, lint-frontend]+ if: ${{ !contains(github.event.head_commit.message, '[skip-release]') }}+ outputs:+ should_release: ${{ steps.version_bump.outputs.should_release }}+ new_version: ${{ steps.version_bump.outputs.new_version }}+ bump_type: ${{ steps.version_bump.outputs.bump_type }}+ steps:+ - name: Check out code+ uses: actions/checkout@v4+ with:+ fetch-depth: 0++ - name: Set up Node.js+ uses: actions/setup-node@v4+ with:+ node-version: "20"++ - name: Install semver+ run: npm install -g semver- name: Get current versionid: current_versionrun: |- # Get the latest tag, default to 0.0.0 if no tags existLATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0")echo "current_version=${LATEST_TAG#v}" >> $GITHUB_OUTPUTecho "Current version: ${LATEST_TAG#v}"@@ -102,12 +173,97 @@ jobs:echo "No version bump needed"fi+ build-only:+ runs-on: ubuntu-latest+ needs: [lint-backend, lint-frontend]+ if: ${{ contains(github.event.head_commit.message, '[skip-release]') }}+ steps:+ - name: Check out code+ uses: actions/checkout@v4++ - name: Set up QEMU (enables multi-arch emulation)+ uses: docker/setup-qemu-action@v3++ - name: Set up Docker Buildx+ uses: docker/setup-buildx-action@v3++ - name: Log in to Docker Hub+ uses: docker/login-action@v3+ with:+ username: ${{ secrets.DOCKERHUB_USERNAME }}+ password: ${{ secrets.DOCKERHUB_TOKEN }}++ - name: Build and push SHA-only tags+ uses: docker/build-push-action@v5+ with:+ context: .+ push: true+ platforms: linux/amd64,linux/arm64+ tags: |+ rostislavdugin/postgresus:latest+ rostislavdugin/postgresus:${{ github.sha }}++ build-and-push:+ runs-on: ubuntu-latest+ needs: [determine-version]+ if: ${{ needs.determine-version.outputs.should_release == 'true' }}+ permissions:+ contents: write+ steps:+ - name: Check out code+ uses: actions/checkout@v4++ - name: Set up QEMU (enables multi-arch emulation)+ uses: docker/setup-qemu-action@v3++ - name: Set up Docker Buildx+ uses: docker/setup-buildx-action@v3++ - name: Log in to Docker Hub+ uses: docker/login-action@v3+ with:+ username: ${{ secrets.DOCKERHUB_USERNAME }}+ password: ${{ secrets.DOCKERHUB_TOKEN }}++ - name: Build and push with version tags+ uses: docker/build-push-action@v5+ with:+ context: .+ push: true+ platforms: linux/amd64,linux/arm64+ tags: |+ rostislavdugin/postgresus:latest+ rostislavdugin/postgresus:v${{ needs.determine-version.outputs.new_version }}+ rostislavdugin/postgresus:${{ github.sha }}++ - name: Update Docker Hub description+ uses: peter-evans/dockerhub-description@v4+ continue-on-error: true+ with:+ username: ${{ secrets.DOCKERHUB_USERNAME }}+ password: ${{ secrets.DOCKERHUB_PASSWORD }}+ repository: rostislavdugin/postgresus+ short-description: "Free PostgreSQL monitoring & backup solution with multi-storage support"+ readme-filepath: ./README.md++ release:+ runs-on: ubuntu-latest+ needs: [determine-version, build-and-push]+ if: ${{ needs.determine-version.outputs.should_release == 'true' }}+ permissions:+ contents: write+ pull-requests: write+ steps:+ - name: Check out code+ uses: actions/checkout@v4+ with:+ fetch-depth: 0+ token: ${{ secrets.GITHUB_TOKEN }}+- name: Generate changelogid: changelog- if: steps.version_bump.outputs.should_release == 'true'run: |- CURRENT_VERSION="${{ steps.current_version.outputs.current_version }}"- NEW_VERSION="${{ steps.version_bump.outputs.new_version }}"+ NEW_VERSION="${{ needs.determine-version.outputs.new_version }}"LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0")# Get commits since last tag@@ -129,33 +285,28 @@ jobs:if [ -n "$line" ]; thenCOMMIT_MSG=$(echo "$line" | cut -d'|' -f1)COMMIT_HASH=$(echo "$line" | cut -d'|' -f2)- COMMIT_AUTHOR=$(echo "$line" | cut -d'|' -f3)- COMMIT_DATE=$(echo "$line" | cut -d'|' -f4)SHORT_HASH=${COMMIT_HASH:0:7}# Parse commit message format: TYPE (area): descriptionif [[ "$COMMIT_MSG" == FEATURE* ]]; then- # Extract area and descriptionTEMP="${COMMIT_MSG#FEATURE}"- TEMP="${TEMP#"${TEMP%%[![:space:]]*}"}" # trim leading spaces+ TEMP="${TEMP#"${TEMP%%[![:space:]]*}"}"if [[ "$TEMP" == \(* ]]; thenAREA=$(echo "$TEMP" | sed 's/^(\([^)]*\)).*/\1/')DESC=$(echo "$TEMP" | sed 's/^([^)]*):[[:space:]]*//')FEATURES="${FEATURES}- **${AREA}**: ${DESC} ([${SHORT_HASH}](https://github.com/${{ github.repository }}/commit/${COMMIT_HASH}))\n"fielif [[ "$COMMIT_MSG" == FIX* ]]; then- # Extract area and descriptionTEMP="${COMMIT_MSG#FIX}"- TEMP="${TEMP#"${TEMP%%[![:space:]]*}"}" # trim leading spaces+ TEMP="${TEMP#"${TEMP%%[![:space:]]*}"}"if [[ "$TEMP" == \(* ]]; thenAREA=$(echo "$TEMP" | sed 's/^(\([^)]*\)).*/\1/')DESC=$(echo "$TEMP" | sed 's/^([^)]*):[[:space:]]*//')FIXES="${FIXES}- **${AREA}**: ${DESC} ([${SHORT_HASH}](https://github.com/${{ github.repository }}/commit/${COMMIT_HASH}))\n"fielif [[ "$COMMIT_MSG" == REFACTOR* ]]; then- # Extract area and descriptionTEMP="${COMMIT_MSG#REFACTOR}"- TEMP="${TEMP#"${TEMP%%[![:space:]]*}"}" # trim leading spaces+ TEMP="${TEMP#"${TEMP%%[![:space:]]*}"}"if [[ "$TEMP" == \(* ]]; thenAREA=$(echo "$TEMP" | sed 's/^(\([^)]*\)).*/\1/')DESC=$(echo "$TEMP" | sed 's/^([^)]*):[[:space:]]*//')@@ -178,44 +329,12 @@ jobs:CHANGELOG="${CHANGELOG}### π¨ Refactoring\n${REFACTORS}\n"fi- # Save changelog to file- echo -e "$CHANGELOG" > RELEASE_CHANGELOG.md-- # Update main CHANGELOG.md - preserve all version history- if [ -f "CHANGELOG.md" ]; then- # Get the header until [Unreleased] section- sed -n '1,/## \[Unreleased\]/p' CHANGELOG.md > NEW_CHANGELOG.md- echo "" >> NEW_CHANGELOG.md- # Add the new release (without the "# Changelog" header)- echo "## [${NEW_VERSION}] - $(date +%Y-%m-%d)" >> NEW_CHANGELOG.md- echo "" >> NEW_CHANGELOG.md-- # Add the new release sections- if [ -n "$FEATURES" ]; then- echo "### β¨ Features" >> NEW_CHANGELOG.md- echo -e "$FEATURES" >> NEW_CHANGELOG.md- fi-- if [ -n "$FIXES" ]; then- echo "### π Bug Fixes" >> NEW_CHANGELOG.md- echo -e "$FIXES" >> NEW_CHANGELOG.md- fi-- if [ -n "$REFACTORS" ]; then- echo "### π¨ Refactoring" >> NEW_CHANGELOG.md- echo -e "$REFACTORS" >> NEW_CHANGELOG.md- fi-- # Get existing releases (everything after first ## [version] pattern)- sed -n '/## \[[0-9]/,$p' CHANGELOG.md >> NEW_CHANGELOG.md-- # Replace the original file- mv NEW_CHANGELOG.md CHANGELOG.md- else- echo -e "$CHANGELOG" > CHANGELOG.md- fi+ # Add Docker image info+ CHANGELOG="${CHANGELOG}### π³ Docker\n"+ CHANGELOG="${CHANGELOG}- **Image**: \`rostislavdugin/postgresus:v${NEW_VERSION}\`\n"+ CHANGELOG="${CHANGELOG}- **Platforms**: linux/amd64, linux/arm64\n\n"- # Set output for GitHub release (escape newlines)+ # Set output for GitHub release{echo 'changelog<<EOF'echo -e "$CHANGELOG"@@ -223,13 +342,12 @@ jobs:} >> $GITHUB_OUTPUT- name: Create GitHub Release- if: steps.version_bump.outputs.should_release == 'true'uses: actions/create-release@v1env:GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}with:- tag_name: v${{ steps.version_bump.outputs.new_version }}- release_name: Release v${{ steps.version_bump.outputs.new_version }}+ tag_name: v${{ needs.determine-version.outputs.new_version }}+ release_name: Release v${{ needs.determine-version.outputs.new_version }}body: ${{ steps.changelog.outputs.changelog }}draft: falseprerelease: falsediff --git a/.github/workflows/docker.yml b/.github/workflows/docker.ymldeleted file mode 100644index 4791981f..00000000--- a/.github/workflows/docker.yml+++ /dev/null@@ -1,121 +0,0 @@-name: Build & push Docker image--on:- push:- branches: [main]- workflow_dispatch: {}--jobs:- lint-backend:- runs-on: ubuntu-latest- steps:- - name: Check out code- uses: actions/checkout@v4-- - name: Set up Go- uses: actions/setup-go@v5- with:- go-version: "1.23.3"-- - name: Cache Go modules- uses: actions/cache@v4- with:- path: |- ~/go/pkg/mod- ~/.cache/go-build- key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}- restore-keys: |- ${{ runner.os }}-go--- - name: Install golangci-lint- run: |- curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.60.3- echo "$(go env GOPATH)/bin" >> $GITHUB_PATH-- - name: Install swag for swagger generation- run: go install github.com/swaggo/swag/cmd/[email protected]-- - name: Generate swagger docs- run: |- cd backend- swag init -d . -g cmd/main.go -o swagger-- - name: Run golangci-lint- run: |- cd backend- golangci-lint run-- - name: Verify go mod tidy- run: |- cd backend- go mod tidy- git diff --exit-code go.mod go.sum || (echo "go mod tidy made changes, please run 'go mod tidy' and commit the changes" && exit 1)-- lint-frontend:- runs-on: ubuntu-latest- steps:- - name: Check out code- uses: actions/checkout@v4-- - name: Set up Node.js- uses: actions/setup-node@v4- with:- node-version: "20"- cache: "npm"- cache-dependency-path: frontend/package-lock.json-- - name: Install dependencies- run: |- cd frontend- npm ci-- - name: Check if prettier was run- run: |- cd frontend- npm run format- git diff --exit-code || (echo "Prettier made changes, please run 'npm run format' and commit the changes" && exit 1)-- - name: Check if linter was run- run: |- cd frontend- npm run lint-- build-and-push:- runs-on: ubuntu-latest- needs: [lint-backend, lint-frontend]-- steps:- - name: Check out code- uses: actions/checkout@v4-- - name: Set up QEMU (enables multi-arch emulation)- uses: docker/setup-qemu-action@v3-- - name: Set up Docker Buildx- uses: docker/setup-buildx-action@v3-- - name: Log in to Docker Hub- uses: docker/login-action@v3- with:- username: ${{ secrets.DOCKERHUB_USERNAME }}- password: ${{ secrets.DOCKERHUB_TOKEN }}-- - name: Build and push- uses: docker/build-push-action@v5- with:- context: .- push: true- platforms: linux/amd64,linux/arm64 # both chip families- tags: |- rostislavdugin/postgresus:latest- rostislavdugin/postgresus:${{ github.sha }}-- - name: Update Docker Hub description- uses: peter-evans/dockerhub-description@v4- continue-on-error: true- with:- username: ${{ secrets.DOCKERHUB_USERNAME }}- password: ${{ secrets.DOCKERHUB_PASSWORD }}- repository: rostislavdugin/postgresus- short-description: "Free PostgreSQL monitoring & backup solution"- readme-filepath: ./README.md