Skip to content

PostgreSQL backup tool with Point-In-Time-Recovery and restore verification

FEATURE (ci \ cd): Parallel build and testing stages + add API ping smoke test

Rostislav Duginbc656467a2e9
diff --git a/.github/workflows/ci-release.yml b/.github/workflows/ci-release.yml
index 6c8cf36b..4555a65a 100644
--- a/.github/workflows/ci-release.yml
+++ b/.github/workflows/ci-release.yml
@@ -398,9 +398,79 @@ jobs:
echo "Cleanup complete"
- build-and-push-dev:
+ build-dev-image:
runs-on: self-hosted
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/develop' }}
+ steps:
+ - name: Clean workspace
+ run: |
+ sudo rm -rf "$GITHUB_WORKSPACE"/* || true
+ sudo rm -rf "$GITHUB_WORKSPACE"/.* || true
+
+ - 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: Build amd64 dev image and load locally
+ uses: docker/build-push-action@v5
+ with:
+ context: .
+ push: false
+ load: true
+ platforms: linux/amd64
+ cache-to: type=gha,mode=max,scope=dev-build
+ cache-from: type=gha,scope=dev-build
+ build-args: |
+ APP_VERSION=dev-${{ github.sha }}
+ tags: |
+ databasus-dev:smoke-${{ github.sha }}
+
+ - name: Run smoke pings against dev image
+ run: |
+ mkdir -p /tmp/databasus-dev-smoke-data
+ docker run -d --name databasus-dev-smoke \
+ -p 4005:4005 \
+ -v /tmp/databasus-dev-smoke-data:/databasus-data \
+ databasus-dev:smoke-${{ github.sha }}
+
+ for i in $(seq 1 60); do
+ code=$(curl -s -o /dev/null -w '%{http_code}' http://localhost:4005/system/health || true)
+ if [ "$code" = "200" ]; then
+ echo "healthcheck OK after ${i} attempt(s)"
+ break
+ fi
+ if [ "$i" -eq 60 ]; then
+ echo "healthcheck never returned 200 (last code: ${code})"
+ docker logs databasus-dev-smoke
+ exit 1
+ fi
+ sleep 2
+ done
+
+ body=$(curl -sf http://localhost:4005/)
+ if ! echo "$body" | grep -q 'id="root"'; then
+ echo "index.html did not contain React root div"
+ echo "$body"
+ exit 1
+ fi
+ echo "index.html OK"
+
+ - name: Cleanup smoke container
+ if: always()
+ run: |
+ docker rm -f databasus-dev-smoke || true
+ docker rmi databasus-dev:smoke-${{ github.sha }} || true
+ rm -rf /tmp/databasus-dev-smoke-data || true
+
+ push-dev-image:
+ runs-on: self-hosted
+ needs: [build-dev-image]
+ if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/develop' }}
steps:
- name: Clean workspace
run: |
@@ -428,12 +498,83 @@ jobs:
context: .
push: true
platforms: linux/amd64,linux/arm64
+ cache-from: type=gha,scope=dev-build
build-args: |
APP_VERSION=dev-${{ github.sha }}
tags: |
databasus/databasus-dev:latest
databasus/databasus-dev:${{ github.sha }}
+ build-image:
+ if: github.ref != 'refs/heads/develop'
+ runs-on: self-hosted
+ needs: [lint-backend, lint-frontend, lint-agent]
+ steps:
+ - name: Clean workspace
+ run: |
+ sudo rm -rf "$GITHUB_WORKSPACE"/* || true
+ sudo rm -rf "$GITHUB_WORKSPACE"/.* || true
+
+ - 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: Build amd64 image and load locally
+ uses: docker/build-push-action@v5
+ with:
+ context: .
+ push: false
+ load: true
+ platforms: linux/amd64
+ cache-to: type=gha,mode=max,scope=release-build
+ cache-from: type=gha,scope=release-build
+ build-args: |
+ APP_VERSION=ci-${{ github.sha }}
+ tags: |
+ databasus:smoke-${{ github.sha }}
+
+ - name: Run smoke pings against built image
+ run: |
+ mkdir -p /tmp/databasus-smoke-data
+ docker run -d --name databasus-smoke \
+ -p 4005:4005 \
+ -v /tmp/databasus-smoke-data:/databasus-data \
+ databasus:smoke-${{ github.sha }}
+
+ for i in $(seq 1 60); do
+ code=$(curl -s -o /dev/null -w '%{http_code}' http://localhost:4005/system/health || true)
+ if [ "$code" = "200" ]; then
+ echo "healthcheck OK after ${i} attempt(s)"
+ break
+ fi
+ if [ "$i" -eq 60 ]; then
+ echo "healthcheck never returned 200 (last code: ${code})"
+ docker logs databasus-smoke
+ exit 1
+ fi
+ sleep 2
+ done
+
+ body=$(curl -sf http://localhost:4005/)
+ if ! echo "$body" | grep -q 'id="root"'; then
+ echo "index.html did not contain React root div"
+ echo "$body"
+ exit 1
+ fi
+ echo "index.html OK"
+
+ - name: Cleanup smoke container
+ if: always()
+ run: |
+ docker rm -f databasus-smoke || true
+ docker rmi databasus:smoke-${{ github.sha }} || true
+ rm -rf /tmp/databasus-smoke-data || true
+
determine-version:
runs-on: self-hosted
container:
@@ -529,9 +670,9 @@ jobs:
echo "No version bump needed"
fi
- build-and-push:
+ push-image:
runs-on: self-hosted
- needs: [determine-version]
+ needs: [determine-version, build-image]
if: ${{ needs.determine-version.outputs.should_release == 'true' }}
permissions:
contents: write
@@ -562,6 +703,7 @@ jobs:
context: .
push: true
platforms: linux/amd64,linux/arm64
+ cache-from: type=gha,scope=release-build
build-args: |
APP_VERSION=${{ needs.determine-version.outputs.new_version }}
tags: |
@@ -573,7 +715,7 @@ jobs:
runs-on: self-hosted
container:
image: node:20
- needs: [determine-version, build-and-push]
+ needs: [determine-version, push-image]
if: ${{ needs.determine-version.outputs.should_release == 'true' }}
permissions:
contents: write
@@ -694,7 +836,7 @@ jobs:
image: alpine:3.19
volumes:
- /runner-cache/apk-cache:/etc/apk/cache
- needs: [determine-version, build-and-push]
+ needs: [determine-version, push-image]
if: ${{ needs.determine-version.outputs.should_release == 'true' }}
permissions:
contents: read
diff --git a/backend/README.md b/backend/README.md
index 9ee1a0d3..b816647e 100644
--- a/backend/README.md
+++ b/backend/README.md
@@ -1,11 +1,7 @@
# Before run
-Keep in mind: you need to use `backend-db` from the root `docker-compose.yml`
-instead of `databasus-db` from production deployments.
-
> Copy .env.example to .env in the repo root (single source for backend, frontend, and docker compose)
> Copy docker-compose.example.yml to docker-compose.yml in the repo root (for development only)
-> Go to tools folder and install Postgres versions
# Run
diff --git a/frontend/README.md b/frontend/README.md
index 892dad1e..993784da 100644
--- a/frontend/README.md
+++ b/frontend/README.md
@@ -2,13 +2,7 @@
## Setup
-This project uses [pnpm](https://pnpm.io/) (pinned via `packageManager` in `package.json`). Enable [Corepack](https://nodejs.org/api/corepack.html) once and the correct version is provisioned automatically:
-
-```bash
-corepack enable
-```
-
-Then install dependencies:
+Install dependencies:
```bash
pnpm install