Skip to content

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

FEATURE (versions): Add version display to Postgresus

Rostislav Dugincaf7e205e729
diff --git a/.github/workflows/ci-release.yml b/.github/workflows/ci-release.yml
index daca6045..d8a3fcae 100644
--- a/.github/workflows/ci-release.yml
+++ b/.github/workflows/ci-release.yml
@@ -301,6 +301,8 @@ jobs:
context: .
push: true
platforms: linux/amd64,linux/arm64
+ build-args: |
+ APP_VERSION=dev-${{ github.sha }}
tags: |
rostislavdugin/postgresus:latest
rostislavdugin/postgresus:${{ github.sha }}
@@ -333,6 +335,8 @@ jobs:
context: .
push: true
platforms: linux/amd64,linux/arm64
+ build-args: |
+ APP_VERSION=${{ needs.determine-version.outputs.new_version }}
tags: |
rostislavdugin/postgresus:latest
rostislavdugin/postgresus:v${{ needs.determine-version.outputs.new_version }}
diff --git a/Dockerfile b/Dockerfile
index 8f33f668..77425126 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -3,6 +3,10 @@ FROM --platform=$BUILDPLATFORM node:24-alpine AS frontend-build
WORKDIR /frontend
+# Add version for the frontend build
+ARG APP_VERSION=dev
+ENV VITE_APP_VERSION=$APP_VERSION
+
COPY frontend/package.json frontend/package-lock.json ./
RUN npm ci
COPY frontend/ ./
@@ -53,6 +57,11 @@ RUN CGO_ENABLED=0 \
# ========= RUNTIME =========
FROM --platform=$TARGETPLATFORM debian:bookworm-slim
+# Add version metadata to runtime image
+ARG APP_VERSION=dev
+LABEL org.opencontainers.image.version=$APP_VERSION
+ENV APP_VERSION=$APP_VERSION
+
# Install PostgreSQL server and client tools (versions 13-17)
RUN apt-get update && apt-get install -y --no-install-recommends \
wget ca-certificates gnupg lsb-release sudo gosu && \
diff --git a/backend/cmd/main.go b/backend/cmd/main.go
index 167b2c85..1bb61a3d 100644
--- a/backend/cmd/main.go
+++ b/backend/cmd/main.go
@@ -51,11 +51,16 @@ func main() {
runMigrations(log)
// create directories that used for backups and restore
- files_utils.EnsureDirectories([]string{
+ err := files_utils.EnsureDirectories([]string{
config.GetEnv().TempFolder,
config.GetEnv().DataFolder,
})
+ if err != nil {
+ log.Error("Failed to ensure directories", "error", err)
+ os.Exit(1)
+ }
+
// Handle password reset if flag is provided
newPassword := flag.String("new-password", "", "Set a new password for the user")
flag.Parse()
diff --git a/frontend/src/constants.ts b/frontend/src/constants.ts
index f2ba3068..edb5fbfa 100644
--- a/frontend/src/constants.ts
+++ b/frontend/src/constants.ts
@@ -12,3 +12,5 @@ export function getApplicationServer() {
}
export const GOOGLE_DRIVE_OAUTH_REDIRECT_URL = 'https://postgresus.com/storages/google-oauth';
+
+export const APP_VERSION = (import.meta.env.VITE_APP_VERSION as string) || 'dev';
diff --git a/frontend/src/widgets/main/MainScreenComponent.tsx b/frontend/src/widgets/main/MainScreenComponent.tsx
index 809f68b2..e1f7bf82 100644
--- a/frontend/src/widgets/main/MainScreenComponent.tsx
+++ b/frontend/src/widgets/main/MainScreenComponent.tsx
@@ -2,7 +2,7 @@ import { Tooltip } from 'antd';
import { useEffect, useState } from 'react';
import GitHubButton from 'react-github-btn';
-import { getApplicationServer } from '../../constants';
+import { APP_VERSION, getApplicationServer } from '../../constants';
import { type DiskUsage, diskApi } from '../../entity/disk';
import { DatabasesComponent } from '../../features/databases/ui/DatabasesComponent';
import { NotifiersComponent } from '../../features/notifiers/ui/NotifiersComponent';
@@ -101,7 +101,7 @@ export const MainScreenComponent = () => {
</div>
{/* ===================== END NAVBAR ===================== */}
- <div className="flex">
+ <div className="relative flex">
<div
className="max-w-[60px] min-w-[60px] rounded bg-white py-2 shadow"
style={{ height: contentHeight }}
@@ -152,6 +152,10 @@ export const MainScreenComponent = () => {
{selectedTab === 'notifiers' && <NotifiersComponent contentHeight={contentHeight} />}
{selectedTab === 'storages' && <StoragesComponent contentHeight={contentHeight} />}
{selectedTab === 'databases' && <DatabasesComponent contentHeight={contentHeight} />}
+
+ <div className="absolute bottom-1 left-1 mb-[0px] text-sm text-gray-400">
+ v{APP_VERSION}
+ </div>
</div>
</div>
);