Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,15 @@ ENV APP_VERSION=$APP_VERSION
# Set production mode for Docker containers
ENV ENV_MODE=production

# Install PostgreSQL server and client tools (versions 13-17)
# Install PostgreSQL server and client tools (versions 12-18)
RUN apt-get update && apt-get install -y --no-install-recommends \
wget ca-certificates gnupg lsb-release sudo gosu && \
wget -qO- https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - && \
echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" \
> /etc/apt/sources.list.d/pgdg.list && \
apt-get update && \
apt-get install -y --no-install-recommends \
postgresql-17 postgresql-18 postgresql-client-13 postgresql-client-14 postgresql-client-15 \
postgresql-17 postgresql-18 postgresql-client-12 postgresql-client-13 postgresql-client-14 postgresql-client-15 \
postgresql-client-16 postgresql-client-17 postgresql-client-18 && \
rm -rf /var/lib/apt/lists/*

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
[![Docker Pulls](https://img.shields.io/docker/pulls/rostislavdugin/postgresus?color=brightgreen)](https://hub.docker.com/r/rostislavdugin/postgresus)
[![Platform](https://img.shields.io/badge/platform-linux%20%7C%20macos%20%7C%20windows-lightgrey)](https://github.com/RostislavDugin/postgresus)

[![PostgreSQL](https://img.shields.io/badge/PostgreSQL-13%20%7C%2014%20%7C%2015%20%7C%2016%20%7C%2017%20%7C%2018-336791?logo=postgresql&logoColor=white)](https://www.postgresql.org/)
[![PostgreSQL](https://img.shields.io/badge/PostgreSQL-12%20%7C%2013%20%7C%2014%20%7C%2015%20%7C%2016%20%7C%2017%20%7C%2018-336791?logo=postgresql&logoColor=white)](https://www.postgresql.org/)
[![Self Hosted](https://img.shields.io/badge/self--hosted-yes-brightgreen)](https://github.com/RostislavDugin/postgresus)
[![Open Source](https://img.shields.io/badge/open%20source-❤️-red)](https://github.com/RostislavDugin/postgresus)

Expand Down Expand Up @@ -54,7 +54,7 @@

### 🐘 **PostgreSQL Support**

- **Multiple versions**: PostgreSQL 13, 14, 15, 16, 17 and 18
- **Multiple versions**: PostgreSQL 12, 13, 14, 15, 16, 17 and 18
- **SSL support**: Secure connections available
- **Easy restoration**: One-click restore from any backup

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ func (uc *CreatePostgresqlBackupUsecase) Execute(
"--verbose", // Add verbose output to help with debugging
}

// Use zstd compression level 5 for PostgreSQL 15+ (better compression and speed)
// Fall back to gzip compression level 5 for older versions
if pg.Version == tools.PostgresqlVersion13 || pg.Version == tools.PostgresqlVersion14 ||
pg.Version == tools.PostgresqlVersion15 {
// Use zstd compression level 5 for PostgreSQL 16+ (better compression and speed)
// Fall back to gzip compression level 5 for older versions (12-15)
if pg.Version == tools.PostgresqlVersion12 || pg.Version == tools.PostgresqlVersion13 ||
pg.Version == tools.PostgresqlVersion14 || pg.Version == tools.PostgresqlVersion15 {
args = append(args, "-Z", "5")
uc.logger.Info("Using gzip compression level 5 (zstd not available)", "version", pg.Version)
} else {
Expand Down
3 changes: 3 additions & 0 deletions backend/internal/util/tools/enums.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const (
type PostgresqlVersion string

const (
PostgresqlVersion12 PostgresqlVersion = "12"
PostgresqlVersion13 PostgresqlVersion = "13"
PostgresqlVersion14 PostgresqlVersion = "14"
PostgresqlVersion15 PostgresqlVersion = "15"
Expand All @@ -32,6 +33,8 @@ const (

func GetPostgresqlVersionEnum(version string) PostgresqlVersion {
switch version {
case "12":
return PostgresqlVersion12
case "13":
return PostgresqlVersion13
case "14":
Expand Down
3 changes: 2 additions & 1 deletion backend/internal/util/tools/postgresql.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func GetPostgresqlExecutable(
return filepath.Join(basePath, executableName)
}

// VerifyPostgresesInstallation verifies that PostgreSQL versions 13-17 are installed
// VerifyPostgresesInstallation verifies that PostgreSQL versions 12-18 are installed
// in the current environment. Each version should be installed with the required
// client tools (pg_dump, psql) available.
// In development: ./tools/postgresql/postgresql-{VERSION}/bin
Expand All @@ -41,6 +41,7 @@ func VerifyPostgresesInstallation(
postgresesInstallDir string,
) {
versions := []PostgresqlVersion{
PostgresqlVersion12,
PostgresqlVersion13,
PostgresqlVersion14,
PostgresqlVersion15,
Expand Down
4 changes: 2 additions & 2 deletions backend/tools/download_linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set -e # Exit on any error
# Ensure non-interactive mode for apt
export DEBIAN_FRONTEND=noninteractive

echo "Installing PostgreSQL client tools versions 13-18 for Linux (Debian/Ubuntu)..."
echo "Installing PostgreSQL client tools versions 12-18 for Linux (Debian/Ubuntu)..."
echo

# Check if running on supported system
Expand Down Expand Up @@ -47,7 +47,7 @@ echo "Updating package list..."
$SUDO apt-get update -qq -y

# Install client tools for each version
versions="13 14 15 16 17 18"
versions="12 13 14 15 16 17 18"

for version in $versions; do
echo "Installing PostgreSQL $version client tools..."
Expand Down
5 changes: 3 additions & 2 deletions backend/tools/download_macos.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -e # Exit on any error

echo "Installing PostgreSQL client tools versions 13-18 for MacOS..."
echo "Installing PostgreSQL client tools versions 12-18 for MacOS..."
echo

# Check if Homebrew is installed
Expand Down Expand Up @@ -31,6 +31,7 @@ brew install wget openssl readline zlib

# PostgreSQL source URLs
declare -A PG_URLS=(
["12"]="https://ftp.postgresql.org/pub/source/v12.20/postgresql-12.20.tar.gz"
["13"]="https://ftp.postgresql.org/pub/source/v13.16/postgresql-13.16.tar.gz"
["14"]="https://ftp.postgresql.org/pub/source/v14.13/postgresql-14.13.tar.gz"
["15"]="https://ftp.postgresql.org/pub/source/v15.8/postgresql-15.8.tar.gz"
Expand Down Expand Up @@ -107,7 +108,7 @@ build_postgresql_client() {
}

# Build each version
versions="13 14 15 16 17 18"
versions="12 13 14 15 16 17 18"

for version in $versions; do
url=${PG_URLS[$version]}
Expand Down
5 changes: 3 additions & 2 deletions backend/tools/download_windows.bat
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@echo off
setlocal enabledelayedexpansion

echo Downloading and installing PostgreSQL versions 13-18 for Windows...
echo Downloading and installing PostgreSQL versions 12-18 for Windows...
echo.

:: Create downloads and postgresql directories if they don't exist
Expand All @@ -17,6 +17,7 @@ cd downloads
set "BASE_URL=https://get.enterprisedb.com/postgresql"

:: Define versions and their corresponding download URLs
set "PG12_URL=%BASE_URL%/postgresql-12.20-1-windows-x64.exe"
set "PG13_URL=%BASE_URL%/postgresql-13.16-1-windows-x64.exe"
set "PG14_URL=%BASE_URL%/postgresql-14.13-1-windows-x64.exe"
set "PG15_URL=%BASE_URL%/postgresql-15.8-1-windows-x64.exe"
Expand All @@ -25,7 +26,7 @@ set "PG17_URL=%BASE_URL%/postgresql-17.0-1-windows-x64.exe"
set "PG18_URL=%BASE_URL%/postgresql-18.0-1-windows-x64.exe"

:: Array of versions
set "versions=13 14 15 16 17 18"
set "versions=12 13 14 15 16 17 18"

:: Download and install each version
for %%v in (%versions%) do (
Expand Down
4 changes: 3 additions & 1 deletion backend/tools/readme.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
This directory is needed only for development and CI\CD.

We have to download and install all the PostgreSQL versions from 13 to 18 locally.
We have to download and install all the PostgreSQL versions from 12 to 18 locally.
This is needed so we can call pg_dump, pg_dumpall, etc. on each version of the PostgreSQL database.

You do not need to install PostgreSQL fully with all the components.
We only need the client tools (pg_dump, pg_dumpall, psql, etc.) for each version.

We have to install the following:

- PostgreSQL 12
- PostgreSQL 13
- PostgreSQL 14
- PostgreSQL 15
Expand Down Expand Up @@ -72,6 +73,7 @@ The final directory structure should match:

For example:

- `./tools/postgresql/postgresql-12/bin/pg_dump`
- `./tools/postgresql/postgresql-13/bin/pg_dump`
- `./tools/postgresql/postgresql-14/bin/pg_dump`
- `./tools/postgresql/postgresql-15/bin/pg_dump`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export enum PostgresqlVersion {
PostgresqlVersion12 = '12',
PostgresqlVersion13 = '13',
PostgresqlVersion14 = '14',
PostgresqlVersion15 = '15',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ export const EditDatabaseSpecificDataComponent = ({
className="max-w-[200px] grow"
placeholder="Select PG version"
options={[
{ label: '12', value: PostgresqlVersion.PostgresqlVersion12 },
{ label: '13', value: PostgresqlVersion.PostgresqlVersion13 },
{ label: '14', value: PostgresqlVersion.PostgresqlVersion14 },
{ label: '15', value: PostgresqlVersion.PostgresqlVersion15 },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ interface Props {
}

const postgresqlVersionLabels = {
[PostgresqlVersion.PostgresqlVersion12]: '12',
[PostgresqlVersion.PostgresqlVersion13]: '13',
[PostgresqlVersion.PostgresqlVersion14]: '14',
[PostgresqlVersion.PostgresqlVersion15]: '15',
Expand Down
Loading