diff --git a/apps/docs/content/features/backup.mdx b/apps/docs/content/features/backup.mdx
index 645bde3b7..e8abbe8dd 100644
--- a/apps/docs/content/features/backup.mdx
+++ b/apps/docs/content/features/backup.mdx
@@ -7,7 +7,7 @@ Zerops provides an automated, secure backup system for supported services. This
## Supported Services
-Zerops provides automated backup functionality for the following services. For specific backup format details and restore instructions, visit each service's documentation: [MariaDB](/mariadb/how-to/backup), [PostgreSQL](/postgresql/how-to/backup), [Qdrant](/qdrant/overview), [Elasticsearch](/elasticsearch/overview), [NATS](/nats/overview), [Meilisearch](/meilisearch/overview), and [Shared Storage](/shared-storage/how-to/backup).
+Zerops provides automated backup functionality for the following services. For specific backup format details and restore instructions, visit each service's documentation: [MariaDB](/mariadb/how-to/backup), [PostgreSQL](/postgresql/how-to/manage#backups), [Qdrant](/qdrant/overview), [Elasticsearch](/elasticsearch/overview), [NATS](/nats/overview), [Meilisearch](/meilisearch/overview), and [Shared Storage](/shared-storage/how-to/backup).
## Managing Backups in the UI
diff --git a/apps/docs/content/postgresql/faq.mdx b/apps/docs/content/postgresql/faq.mdx
deleted file mode 100644
index c306b0dc4..000000000
--- a/apps/docs/content/postgresql/faq.mdx
+++ /dev/null
@@ -1,31 +0,0 @@
----
-title: Frequently Asked Questions
-description: Get quick answers to your related questions about PostgreSql from frequently asked questions by people at Zerops.
----
-
-import { FAQ, FAQItem } from '/src/components/Faq';
-
-
-
- In High Availability (HA) mode, PostgreSQL runs on multiple containers with a primary node and replicas. To get the most out of this setup:
-
- - Use port `5432` for all write operations (INSERT, UPDATE, DELETE) — this always routes to the primary node
- - Use port `5433` for read operations (SELECT) — this distributes queries across all replicas, improving performance
-
- The read replica port (`5433`) is only available in HA mode. If you're running PostgreSQL in single container (NON_HA) mode, only port `5432` is available.
-
- See [Connection Parameters](/postgresql/how-to/connect#connection-parameters) for all available ports and environment variables.
-
-
- *One possible cause:*
- The connection string in Zerops always starts with `postgresql://`. While the official PostgreSQL documentation
- states that both `postgresql://` and `postgres://` URIs are valid, some software requires the shorter `postgres://`
- version.
-
- To resolve this, create your own environment variable with the correct URI. For example, if your PostgreSQL service is named `db`, use the following format:
-
- ```
- postgres://${db_user}:${db_password}@${db_hostname}:${db_port}
- ```
-
-
\ No newline at end of file
diff --git a/apps/docs/content/postgresql/how-to/backup.mdx b/apps/docs/content/postgresql/how-to/backup.mdx
deleted file mode 100644
index 4f80ca49d..000000000
--- a/apps/docs/content/postgresql/how-to/backup.mdx
+++ /dev/null
@@ -1,51 +0,0 @@
----
-title: Backup in PostgreSQL
-description: Learn how you can work with backups in PostgreSQL service in Zerops.
----
-
-Zerops provides automated data backup for PostgreSQL services with full encryption and flexible management options.
-
-For general backup information including configuration, scheduling, and management options, see the [Zerops Backups](/features/backup) documentation, which covers:
-- Backup scheduling and retention policies
-- Tagging system and storage quotas
-- Manual backup creation and CLI tools
-- Security and encryption details
-
-This page focuses on PostgreSQL-specific backup details.
-
-## PostgreSQL Backup Format
-
-PostgreSQL backups are created using `pg_dump` and stored in `.zip` format:
-
-- **Format**: `.zip` (containing per-schema `.dump` files)
-- **Tooling**: `pg_dump`
-- **Compression**: Custom format (`-Fc`), schema files named `schemaName.dump`
-- **Storage**: Encrypted and stored in isolated object storage
-
-## Restoring PostgreSQL Backups
-
-To restore a PostgreSQL backup:
-
-1. **Download** the backup file (`.zip`) from the Zerops UI
-2. **Extract** the zip file to access the individual schema dump files
-3. **Prepare** your target environment (clean existing data or use a new instance)
-4. **Restore** using PostgreSQL native tools. Follow the [official PostgreSQL backup documentation](https://www.postgresql.org/docs/current/backup-dump.html) for detailed restore procedures, or use web-based management tools like phpMyAdmin or Adminer as described in [PostgreSQL Management](/postgresql/how-to/manage).
-
-For assistance with the restoration process, contact Zerops support.
-
-## High Availability
-
-For PostgreSQL services running in High Availability mode:
-- Backups are created on a randomly selected healthy node
-- Other nodes remain operational during the backup process
-- Manual backups typically run on the primary node
-
-## Best Practices
-
-- Always create a manual backup with a protected tag before database migrations or major schema changes
-- Test your restore process periodically in a non-production environment
-- Monitor your backup storage usage in the Project Overview
-- Use descriptive tags like `pre-migration-v2` for important snapshots
-- Consider the order of schema restoration if you have dependencies between schemas
-
-For additional best practices and troubleshooting, refer to the [main backup documentation](/features/backup).
\ No newline at end of file
diff --git a/apps/docs/content/postgresql/how-to/connect.mdx b/apps/docs/content/postgresql/how-to/connect.mdx
index ef49f549e..2fbda2e6e 100644
--- a/apps/docs/content/postgresql/how-to/connect.mdx
+++ b/apps/docs/content/postgresql/how-to/connect.mdx
@@ -1,26 +1,20 @@
---
-title: Connect to PostgreSQL in Zerops
-description: Learn how to connect to your PostgreSQL database in Zerops from various environments.
+title: Connect to PostgreSQL
+description: Connect to your PostgreSQL database in Zerops, covering ports, TLS, connection pooling, environment variables, VPN, public access, and management tools.
---
-This guide covers how to connect to your PostgreSQL database in Zerops, both from services within the same project and from outside the Zerops environment.
+This guide covers everything about reaching your PostgreSQL database in Zerops: connection details, ports and TLS, connection pooling, connecting from other services or from your workstation, and the database tools you can use.
-## Connection Options Overview
+## Connection options at a glance
-Zerops provides several ways to connect to PostgreSQL:
+- **Internal**: between services in the same project, over the private network.
+- **Remote**: from outside Zerops, either through the [VPN](#connect-via-zerops-vpn) (your machine joins the private network) or through [public IP access](#connect-via-public-ip) (TLS through pgBouncer).
-1. **Internal connections** - Between services in the same Zerops project (via private network)
-2. **Remote connections**:
- - **VPN access** - From your local machine via Zerops VPN
- - **Direct IP access** - Enables external applications to connect using TLS encryption by opening public ports on IPv6 (available by default) or IPv4 (requires add-on activation if not already enabled)
+## Connection details
-## Connection Details
+Find your connection details in the service detail page under **Peek access details** (hostname, port, user, password, connection string). The full list of connection-related environment variables lives under **Environment variables** in the same service detail.
-You'll find PostgreSQL connection details in the service detail page under the **Peek access details** button (shows hostname, port, user, password, and connection string).
-
-The full list of connection-related environment variables is available in the service detail under **Environment variables**.
-
-### Connection Parameters
+### Connection parameters
@@ -28,7 +22,7 @@ The full list of connection-related environment variables is available in the se
Parameter
Internal
-
External (TLS)
+
Public IP (TLS)
Env Variable
@@ -53,7 +47,7 @@ The full list of connection-related environment variables is available in the se
User
-
Identical to hostname
+
`db` (default)
Same as internal
`user`
@@ -77,7 +71,7 @@ The full list of connection-related environment variables is available in the se
Database name
-
db
+
`db` (default)
Same as internal
`dbName`
@@ -85,90 +79,166 @@ The full list of connection-related environment variables is available in the se
-:::tip
-If you're running PostgreSQL in High Availability (HA) mode, configure your application to route read queries to port **5433**. This distributes the load across all replicas, reducing pressure on the primary node and improving overall throughput.
-:::
-
:::warning
-Zerops creates a system user named `zps` with full privileges for maintenance purposes. Do not delete, change the password, or remove privileges from this user, as it will disrupt Zerops' ability to maintain the database cluster.
+Zerops creates a system user named `zps` with full privileges for maintenance. Do not delete it, change its password, or remove its privileges, as doing so disrupts Zerops' ability to maintain the database cluster.
:::
-:::info
-For more information about default PostgreSQL setup, users, and databases, see [Manage PostgreSQL Users and Databases](/postgresql/how-to/manage).
-:::
+## Connection ports and TLS
-## Connect from Services in the Same Project
+PostgreSQL on Zerops exposes three ports, each for a different purpose:
-All services within a Zerops project share a dedicated private network. There are two ways to implement connections between services in the same project:
+
-### Method 1: Direct Connection Parameters
+- **Ports `5432` and `5433` do not support TLS.** Connect with `sslmode=disable`. Inside a project these ports are reachable only on the private network, and over the [VPN](#connect-via-zerops-vpn) the tunnel already encrypts the traffic, so requesting TLS on them fails the handshake.
+- **Port `6432` (pgBouncer) requires TLS.** Connect with at least `sslmode=require`; the connection is always encrypted. pgBouncer presents a certificate signed by the [Zerops CA](/references/networking/zerops-ca) but does not force the client to validate it, so `sslmode=require` is enough. If you want to verify the server's identity, use `sslmode=verify-full` together with the Zerops CA. This holds whether you reach `6432` from inside the project or over a public IP.
-You can directly use the connection parameters from Peek Access Details:
+## Connection pooling with pgBouncer
-```
-host = database1
-port = 5432
-user = database1
-password = ********** (find under Peek Access Details)
-```
+Port `6432` puts [pgBouncer](https://www.pgbouncer.org/) in front of PostgreSQL and multiplexes many client connections onto a small pool of server connections. This is valuable for applications that open many short-lived connections (serverless functions, PHP-FPM, or anything with high connection churn), and **we recommend connecting through `6432` rather than `5432` for these workloads, including for internal service-to-service connections.**
+
+A few things to know:
+
+- **Transaction pooling.** A server connection is returned to the pool after each transaction, not when the client disconnects. Prepared statements are supported (cached per server connection), but session-scoped features that span transactions (session-level `SET`, advisory locks held across statements, `LISTEN`/`NOTIFY`) won't behave as expected. Use a direct `5432` connection for those.
+- **TLS is required** on `6432` (see [above](#connection-ports-and-tls)), even for internal connections.
+- **HA mode.** pgBouncer pools connections to the primary (writes). Read routing across replicas on port `5433` is separate and is not pooled.
+
+## Connect from services in the same project
-For read operations in HA mode, use port `5433` instead of `5432` with the same credentials.
+All services in a project share a private network, so other services reach PostgreSQL directly by its hostname. There are two ways to wire it up.
-### Method 2: Environment Variables (Recommended)
+### Direct connection parameters
-For better maintainability, Zerops creates environment variables for each PostgreSQL service that you can use in your application configuration. List of service environment variables is available in Zerops GUI. Go to a PostgreSQL service detail and choose **Environment variables**.
+Use the parameters from **Peek access details**:
-To use variables from one service in another, prefix the variable name with the service hostname and underscore - to access the `connectionString` variable of `postgresql1`, use `postgresql1_connectionString`.
+```ini
+host = db # your PostgreSQL service hostname
+port = 5432 # 5433 for read-only replicas in HA mode
+user = db # default user
+password = **********
+```
+
+### Environment variables (recommended)
-For read-only connections (HA mode only), use the `connectionStringReplicas` variable instead.
+Zerops generates connection environment variables for every PostgreSQL service. To use one service's variables from another, prefix the variable name with the service hostname and an underscore. For example, to read the `connectionString` of service `db`, reference `db_connectionString`.
-For more details on how to use environment variables, and instructions for adding your own custom variables, see the [Environment Variables](/features/env-variables) documentation.
+For read-only connections (HA mode only), use `connectionStringReplicas` instead.
+
+See the [Environment Variables](/features/env-variables) documentation for details and for adding your own variables.
:::caution Important notes
-- When changing passwords, update both the database user password and the environment variable separately - they don't automatically synchronize.
-- While both `postgresql://` and `postgres://` URI formats are valid, Zerops uses the `postgresql://` format. If your software requires `postgres://`, create a custom environment variable with this format.
-- Do not use SSL/TLS protocols for internal connections. Security is assured by the project's private network.
+- When changing a password, update both the database user and the environment variable, since they don't synchronize automatically.
+- Zerops uses the `postgresql://` URI scheme. If your software requires the shorter `postgres://`, create a custom environment variable with that format.
+- Internal connections on `5432`/`5433` don't use SSL/TLS. Security comes from the private network. For TLS-encrypted [connection pooling](#connection-pooling-with-pgbouncer), connect to pgBouncer on `6432`.
:::
-## Connect Remotely
+## Connect remotely
-Zerops offers two methods for connecting to your PostgreSQL database from outside the Zerops environment:
+There are two ways to reach PostgreSQL from outside Zerops: the VPN (recommended for development) and public IP access (for external applications).
-### Method 1: Connect via Zerops VPN
+### Connect via Zerops VPN
-You can securely connect to PostgreSQL from your local workstation via Zerops VPN:
+The VPN puts your workstation on the project's private network, so you connect exactly as an internal service would.
1. [Install & set up zCLI](/references/cli)
2. [Start the Zerops VPN](/references/networking/vpn#start-vpn)
-3. Use the connection details from Access Details in the PostgreSQL service detail in Zerops GUI
+3. Use the connection details from **Peek access details** in the service detail
4. When finished, [stop the Zerops VPN](/references/networking/vpn#stop-vpn)
:::warning Important notes
-* Do not use SSL/TLS protocols when connecting over VPN. Security is provided by the VPN tunnel.
-* If your connection over VPN doesn't work, try adding `.zerops` suffix to the service hostname (e.g., `database1.zerops`). For additional help, check the [VPN troubleshooting page](/references/networking/vpn#troubleshooting).
+* Connect to `5432`/`5433` without SSL/TLS over the VPN, since the tunnel already encrypts the traffic.
+* Environment variables are **not** available over the VPN; copy the access details from the GUI.
+* If a connection doesn't work, try the `.zerops` suffix on the hostname (e.g. `db.zerops`). See the [VPN troubleshooting page](/references/networking/vpn#troubleshooting).
:::
-### Method 2: Connect via Direct IP Access
-
-Direct IP Access uses [pgBouncer](https://www.pgbouncer.org/) for connection pooling and TLS termination.
+### Connect via public IP
-Internally, port `5432` is available without SSL (and port `5433` for reads in HA mode). Externally, connections are secured with TLS through pgBouncer (port `6432`) before being routed to your PostgreSQL service. The read replica port is not available for external connections.
+Public access always goes through pgBouncer on port `6432` over TLS (see [Connection ports and TLS](#connection-ports-and-tls)), which also pools your connections. The read-only replica port (`5433`) is **not** exposed publicly. Route reads through your application logic instead.
:::tip Trusting the TLS certificate
-The TLS certificate served on port `6432` is signed by the Zerops Certificate Authority. To verify it from outside Zerops, download and trust the [Zerops CA](/references/networking/zerops-ca) — e.g. `psql "... sslmode=verify-full sslrootcert=./zerops-ca.pem"`.
+The certificate on `6432` is signed by the Zerops Certificate Authority. To verify it from outside Zerops, download and trust the [Zerops CA](/references/networking/zerops-ca), for example `psql "... sslmode=verify-full sslrootcert=./zerops-ca.pem"`.
:::
-#### Enable external access
+To enable public access:
+
+1. Open your PostgreSQL service in the GUI and go to **Public Access through IP Addresses**
+2. Choose IPv6 (available by default) or IPv4 (requires the [unique IPv4](/references/networking/public-access#ipv4-configuration) add-on)
+3. Open one or more ports pointing to your service (routed through pgBouncer):
+ - Any port from 10–65435 (except 80 and 443)
+ - Each public port can map to any internal port; multiple public ports can share one internal port
+ - IPv4 and IPv6 can be configured independently
+4. Optionally enable firewall protection
+5. Click **Publish X IP access change(s)** to apply
+
+## Database management tools
+
+You can use any PostgreSQL-compatible tool to administer your database. For a zero-setup option, Zerops provides a ready-to-use recipe for [Adminer](https://www.adminer.org), a lightweight, full-featured web-based tool that supports PostgreSQL.
-1. Navigate to your PostgreSQL service in the Zerops GUI and choose the **Public Access through IP Addresses** section
-2. Choose either IPv6 (available by default) or IPv4 (requires the [unique IPv4](/references/networking/public-access#ipv4-configuration) add-on)
-3. Open one or more ports and point them to your PostgreSQL service (the system will direct them through pgBouncer)
- - Choose any port from 10-65435 (except 80 and 443)
- - Select destination service and internal port
- - Each public port can be mapped to any internal service port
- - Multiple public ports can point to the same internal port if needed
- - Port configurations can be set independently for IPv4 and IPv6
-4. Optionally enable firewall protection for additional security
-5. Click the **Publish X IP access change(s)** button to apply your settings
+### Install Adminer
+
+In the GUI, open your project, select **Import services**, and paste:
+
+```yaml title="zerops-import.yaml"
+services:
+ - hostname: adminer
+ type: php-apache@8.5
+ maxContainers: 1
+ enableSubdomainAccess: true
+ buildFromGit: https://github.com/zeropsio/recipe-adminer
+```
+
+Then [start the VPN](/references/networking/vpn) and open `http://adminer` in your browser (try `http://adminer.zerops` if it doesn't resolve).
+
+:::caution
+Do not use `https` when reaching management tools over the VPN.
+:::
+
+### Desktop tools and psql
+
+Popular desktop clients (pgAdmin, DBeaver, DataGrip, or any PostgreSQL-compatible tool) work with Zerops over the VPN:
+
+1. [Start the Zerops VPN](/references/networking/vpn) to open an encrypted tunnel to your project
+2. Copy the [connection details](#connection-details) from the GUI (environment variables aren't available over the VPN)
+3. Connect without SSL/TLS on `5432`/`5433`, since the tunnel already encrypts the connection
+
+For the `psql` command-line client:
+
+```sh
+psql -h [hostname] -U [user] -d [database_name]
+```
+
+`psql` has no password flag, so it prompts you. To pass the password non-interactively, use `PGPASSWORD`:
+
+```sh
+PGPASSWORD=[password] psql -h [hostname] -U [user] -d [database_name]
+```
+
+:::tip
+Try `[hostname].zerops` instead of `[hostname]` if you hit connection issues over the VPN.
+:::
-For database management tools and how to manage users and databases, see [Manage PostgreSQL Users and Databases](/postgresql/how-to/manage).
\ No newline at end of file
+To move data in and out with these tools, see [Export & import data](/postgresql/how-to/manage#export--import-data).
diff --git a/apps/docs/content/postgresql/how-to/create.mdx b/apps/docs/content/postgresql/how-to/create.mdx
index d84970c15..7c84de623 100644
--- a/apps/docs/content/postgresql/how-to/create.mdx
+++ b/apps/docs/content/postgresql/how-to/create.mdx
@@ -1,123 +1,96 @@
---
-title: Create a PostgreSQL service
-description: Creating and scaling PostgreSQL in Zerops with GUI and zCLI
+title: Create & import
+description: Create a PostgreSQL service in the Zerops GUI or import it with a YAML definition, including the full parameter reference.
---
-import Image from '/src/components/Image';
import data from '@site/static/data.json';
import UnorderedList from '@site/src/components/UnorderedList';
import Video from '@site/src/components/Video';
-import ResourceTable from '/src/components/ResourceTable';
-## Create PostgreSQL using Zerops GUI
+Create a PostgreSQL service in the [GUI](#create-in-the-gui), or describe it in YAML and [import](#import-with-yaml) it through the GUI or zCLI. Both paths configure the same things; the YAML route is repeatable and versionable.
-First, set up a project in Zerops GUI. Then go to the project dashboard page and choose **Add new service** in the left menu in the **Services** block. Then add a new PostgreSQL service:
+## Create in the GUI
+
+Go to your project dashboard and choose **Add new service** in the **Services** block:
-### Choose PostgreSQL version
+The wizard asks for four things:
-Following PostgreSQL versions are currently supported:
+### Version
-### Set a hostname
-
-Enter a unique service identifier like `postgresql`, `sql`, `db` etc.
-
-#### Limitations:
-
-- Duplicate services with the same name within the same project are not allowed
-- Maximum 25 characters
-- Must contain only lowercase ASCII letters (a-z) or numbers (0-9)
-
-:::caution
-The hostname is fixed after the service is created and cannot be changed later.
-:::
-
-### Configure auto scaling
+### Hostname
-Zerops automatically scales PostgreSQL services based on actual database usage. Configure the scaling parameters to match your database needs and control costs.
+A unique service identifier, like `db`, `sql`, or `postgresql`. Maximum 25 characters, lowercase ASCII letters (a-z) and numbers (0-9) only, unique within the project.
-**CPU Mode**: Choose between shared (cost-effective) or dedicated (consistent performance).
+### Deployment mode
-**Resource Limits**: Set minimum and maximum resources for CPU, RAM, and disk to control costs and ensure performance.
+**Highly Available** (a 3-node cluster, recommended for production) or **Single container** (lower cost, no redundancy). See [Deployment modes](/postgresql/overview#deployment-modes) for the comparison.
-**Deployment Mode**: Choose the reliability configuration for your PostgreSQL service:
+### Scaling profile and resources
-- **Highly Available**: Multiple containers with redundancy across different physical machines. Recommended for production environments.
-- **Single Container**: One container suitable for development and non-critical environments.
+Pick a [scaling profile](/postgresql/how-to/scale#scaling-profiles) matched to your workload (OLTP, OLAP, or write-heavy). The profile sets the autoscaling defaults and tunes the PostgreSQL configuration; on top of it you can set the CPU mode (shared or dedicated) and minimum/maximum limits for CPU, RAM, and disk. See [Scale & profiles](/postgresql/how-to/scale) for details.
-:::warning
-Deployment mode cannot be changed after service creation.
+:::caution
+The **hostname** and **deployment mode** are fixed once the service is created. The scaling **profile** and resource limits can be changed at any time.
:::
-:::tip Learn More
-For detailed scaling configuration, deployment mode details, and troubleshooting, see:
-- [How Zerops scales PostgreSQL](/postgresql/how-to/scale) - Database-specific scaling guide
-- [Automatic Scaling and High Availability](/features/scaling) - Complete technical details
-:::
+## Import with YAML
-## Create PostgreSQL using zCLI
+Zerops uses a YAML file to describe services declaratively. You can paste it in the GUI (**Import services** in the left menu of your project) or import it with the [zCLI](/references/cli).
-zCLI is the Zerops command-line tool. To create a new PostgreSQL service via the command line, follow these steps:
+### Add a service to an existing project
-1. [Install & setup zCLI](/references/cli)
-2. [Create a project description file](#create-a-project-description-file)
-3. Create a project and a PostgreSQL service
+```yaml title="zerops-import.yaml"
+services:
+ - hostname: db
+ # postgresql:{single|ha}@{version}
+ type: postgresql:single@18
+ # optional: autoscaling profile, see Scale & profiles
+ profile: oltp-staging
+```
-### Create a project description file
+With zCLI:
-Zerops uses a YAML format file to describe the project infrastructure.
+```sh
+zcli project service-import zerops-import.yaml
+```
-#### Basic example
+The command is interactive: it lists your projects and lets you pick which one to import into. You can also pass the project ID directly with `-P`:
-Create a directory `my-project`. Create a `description.yaml` file inside the directory with the following content:
+```sh
+Usage:
+ zcli project service-import importYamlPath [flags]
-```yaml
-# Basic project data
-project:
- # project name
- name: my-project
-# array of project services
-services:
- - # service name
- hostname: postgresql1
- # service type and version number in postgresql@{version} format
- type: postgresql@12
- # mode of operation "HA"/"NON_HA"
- mode: NON_HA
+Flags:
+ -h, --help Help for the project service import command.
+ -P, --project-id string If you have access to more than one project, you must specify the project ID for which the
+ command will be executed.
```
-The YAML file describes your future project infrastructure. The project will contain one PostgreSQL service in the single container mode with default [auto scaling](/postgresql/how-to/scale) configuration. The hostname will be set to `postgresql1`.
+### Create a new project
-#### Full example
+A project import additionally contains the `project:` section:
-Create a directory `my-project`. Create a `description.yaml` file inside the directory with the following content:
-
-```yaml
-# Basic project data
+```yaml title="zerops-import.yaml"
project:
- # project name
name: my-project
- # optional: project description
+ # optional: project description and tags
description: A project with a PostgreSQL database
- # optional: project tags
tags:
- DEMO
- ZEROPS
-# array of project services
+
services:
- - # first service hostname
- hostname: postgresql1
- # service type and version number in postgresql@{version} format
- type: postgresql@12
- # mode of operation "HA"/"NON_HA"
- mode: HA
- # optional: vertical auto-scaling customization
+ - hostname: db
+ type: postgresql:ha@18
+ profile: oltp-production
+ # optional: override the profile's autoscaling defaults
verticalAutoscaling:
cpuMode: DEDICATED
minCpu: 2
@@ -129,242 +102,109 @@ services:
startCpuCoreCount: 3
minFreeRamGB: 0.5
minFreeRamPercent: 20
- - # second service hostname
- hostname: postgresql2
- # service type and version number in postgresql@{version} format
- type: postgresql@12
- # mode of operation "HA"/"non_HA"
- mode: NON_HA
+ - hostname: dbstaging
+ type: postgresql:single@18
+ profile: oltp-staging
```
-The YAML file describes your future project infrastructure. The project will contain two PostgreSQL services.
+```sh
+zcli project project-import zerops-import.yaml
+```
-The hostname of the first service will be set to `postgresql1`. The [high availability](/features/scaling#highly-available-ha-mode) mode will be chosen and the custom [auto scaling configuration](/postgresql/how-to/scale) will be set.
+The project name comes from the YAML, so the command doesn't take one. If you are a member of more than one organization (called *client* in the GUI), pass the ID with `--org-id`; you'll find it under the client name on the project dashboard.
-The hostname of the second service will be set to `postgresql2`. The [single container](/features/scaling#single-container-mode) mode will be chosen and the default [auto scaling configuration](/postgresql/how-to/scale) will be set.
+```sh
+Usage:
+ zcli project project-import importYamlPath [flags]
-#### Description of description.yaml parameters
+Flags:
+ -h, --help Help for the project import command.
+ --org-id string If you have access to more than one organization, you must specify the org ID for which the
+ project will be created.
+ --working-dir string Sets a custom working directory. The default working directory is the current directory. (default "./")
+```
+
+
+
+
-The `project:` section is required. Only one project can be defined.
+:::note
+The maximum size of an import YAML is 100 kB. A project import can mix PostgreSQL with [any other service type](/references/import-yaml/type-list).
+:::
+
+### Project parameters
+
+The `project:` section is required for a project import. Only one project can be defined.
-
Parameter
-
Description
-
Limitations
+
Parameter
+
Description
-
name
+
name
The name of the new project. Duplicates are allowed.
-
-
description
-
Optional. Description of the new project.
-
Maximum 255 characters.
+
description
+
Optional. Description of the new project. Maximum 255 characters.
-
tags
-
Optional. One or more string tags. Tags do not have a functional meaning, they only provide better orientation in projects.
-
+
tags
+
Optional. One or more string tags. Tags have no functional meaning, they only provide better orientation in projects.
+### Service parameters
-At least one service in the `services:` section is required. You can create a project with multiple services. The example above contains only PostgreSQL services but you can create a `description.yaml` with [different types] of services.
+At least one service in the `services:` section is required.
-
Parameter
+
Parameter
Description
+
hostname
- hostname
-
-
- The unique service identifier.
-
-
- The hostname of the new database will be set to the `hostname` value.
-
- Limitations:
- - duplicate services with the same name in the same project are
- forbidden
-
- - maximum 25 characters
- - must contain only lowercase ASCII letters (a-z) or numbers (0-9)
-
-
-
-
- type
-
-
- Specifies the service type and version.
-
- See what [PostgreSQL service types](/references/import-yaml/type-list#database-services) are currently supported.
-
-
-
-
- mode
-
-
- Defines the operation mode of the PostgreSQL service.
-
-
- HA
-
- Creates a PostgreSQL cluster with 3 database containers and 2 free
- database proxies. This mode is suited for production.
-
-
- Zerops always keeps the 3 database containers on different physical
- machines. All your data is stored redundantly in 3 identical copies. In
- case of a failure of a container or the underlying physical machine,
- Zerops automatically disconnects the failed container from the cluster,
- creates a new container and syncs all data from the remaining 2 copies.
- Finally, the broken container is automatically deleted.
-
-
- In HA mode, a dedicated read replica port (5433) is available, allowing you to route read queries to replicas for better performance. See Connection Parameters for details.
-
-
- NON_HA
-
- Zerops will create a PostgreSQL database installed in a single
- container. Useful for non-essential data or dev environments.
-
-
- Your data is stored only in a single container. If the container or the
- the underlying physical machine fails, your data since the last backup are
- lost. Zerops doesn't provide any automatic repairs of a single node
- PostgreSQL services.
-
-
-
-
- verticalAutoscaling
-
-
- Optional. Defines custom vertical auto-scaling parameters.
- All verticalAutoscaling attributes are optional. Not specified
- attributes will be set to their default values.
+ The unique service identifier; becomes the database hostname on the project's private network. Maximum 25 characters, lowercase ASCII letters (a-z) and numbers (0-9) only, unique within the project. Fixed after creation.
+
type
- - cpuMode
-
-
- Optional. Accepts `SHARED`, `DEDICATED` values. Default is `SHARED`
+ The service type, deployment mode, and version in postgresql:{single|ha}@{version} format. The :single/:ha part selects the deployment mode and is fixed after creation; the standalone mode field is deprecated. See the list of supported types.
+
profile
- - minCpu/maxCpu
-
-
- Optional. Set the minCpu or maxCpu in CPU cores (integer).
+ Optional. The autoscaling profile: sets the autoscaling envelope and tunes the PostgreSQL configuration for your workload. Defaults to oltp-staging (single) or oltp-production (HA). Can be changed at any time in the GUI.
+
profileOverrides
- - minRam/maxRam
-
-
- Optional. Set the minRam or maxRam in GB (float).
+ Optional. Only valid with profile: custom; overrides individual PostgreSQL configuration values. See Custom profile for the overridable keys and their units.
+
verticalAutoscaling
- - minDisk/maxDisk
-
-
- Optional. Set the minDisk or maxDisk in GB (float).
+ Optional. Overrides the profile's autoscaling defaults. All attributes are optional: cpuMode (SHARED/DEDICATED), minCpu/maxCpu (cores), minRam/maxRam (GB), minDisk/maxDisk (GB), startCpuCoreCount, minFreeRamGB, minFreeRamPercent. See Configure scaling.
-
-:::caution
-The PostgreSQL service **hostname** and **mode** are fixed after the service is created. They can't be changed later.
-:::
-
-### Create a project based on the description.yaml
-
-When you have your `description.yaml` ready, use the `zcli project project-import` command to create a new project and the service infrastructure.
-
-```sh
-Usage:
- zcli project project-import importYamlPath [flags]
-
-Flags:
- -h, --help Help for the project import command.
- --org-id string If you have access to more than one organization, you must specify the org ID for which the
- project will be created.
- --working-dir string Sets a custom working directory. The default working directory is the current directory. (default "./")
-```
-
-Zerops will create a project and one or more services based on the `description.yaml` content.
-
-The maximum size of the `description.yaml` file is 100 kB.
-
-You don't specify the project name in the `zcli project project-import` command, because the project name is defined in the `description.yaml`.
-
-If you have access to more than one client, you must specify the client ID for which the project is to be created. The `clientID` is located in the Zerops GUI under the client name on the project dashboard page.
-
-
-
-
-
-### Add PostgreSQL service to an existing project
-
-#### Example
-
-Create a directory `my-project` if it doesn't exist. Create an `import.yaml` file inside the `my-project` directory with following content:
-
-```bash
-# array of project services
-services:
- -
- # service name
- hostname: postgresql1
- # service type and version number in postgresql@{version} format
- type: postgresql@12
- # mode of operation "HA"/"NON_HA"
- mode: NON_HA
-```
-
-The YAML file describes the list of one or more services that you want to add to your existing project. In the example above, one PostgreSQL service in the [single container](/features/scaling#single-container-mode) with default [auto scaling](/postgresql/how-to/scale) configuration will be added to your project. The hostname of the new service will be set to `postgresql1`.
-
-The content of the `services:` section of `import.yaml` is identical to the [project description file](#create-a-project-description-file). The `import.yaml` never contains the `project:` section because the project already exists.
-
-When your `import.yaml` is ready, use the `zcli project service-import` command to add one or more services to your existing Zerops project.
-
-```sh
-Usage:
- zcli project service-import importYamlPath [flags]
-
-Flags:
- -h, --help Help for the project service import command.
- -P, --project-id string If you have access to more than one project, you must specify the project ID for which the
- command will be executed.
-```
-
-zCLI commands are interactive, when you press enter after `zcli project service-import importYamlPath`, you will be given a list of your projects to choose from.
-
-The maximum size of the `import.yaml` file is 100 kB.
\ No newline at end of file
diff --git a/apps/docs/content/postgresql/how-to/export-import-data.mdx b/apps/docs/content/postgresql/how-to/export-import-data.mdx
deleted file mode 100644
index 6338db15e..000000000
--- a/apps/docs/content/postgresql/how-to/export-import-data.mdx
+++ /dev/null
@@ -1,52 +0,0 @@
----
-title: Export or import PostgreSQL data
-description: Learn how to export or import postgresql data in Zerops.
----
-
-## Use Adminer or phpMyAdmin to export or import data
-* [Adminer ↗](https://www.adminer.org) - an open source full-featured database management tool written in PHP
-* [phpMyAdmin ↗](https://www.phpmyadmin.net) - a free software tool written in PHP, intended to handle the administration of PostgreSQL over the Web
-
-1. [Install the tools to Zerops](/postgresql/how-to/manage#installing-management-tools)
-2. Use their standard export or import functions
-
-## Use a database management tool on your workstation to export or import data
-
-Do you already use a database management tool that supports PostgreSQL on your workstation? Connect it securely to PostgreSQL from your local workspace via Zerops VPN.
-
-Zerops VPN client is included into zCLI, the Zerops command-line tool. To start the VPN connection, read [how to connect to PostgreSQL remotely](/postgresql/how-to/connect#connect-remotely).
-:::caution
-Do not use SSL/TLS protocols when connecting to PostgreSQL over VPN. Zerops PostgreSQL is not configured to support these protocols. The security is assured by the VPN.
-:::
-
-Once the connection to PostgreSQL is established, use the standard export or import functions of your favourite management tool.
-
-## Use psql CLI to export or import data
-
-If you are using the [psql ↗](https://www.postgresql.org/docs/current/app-psql.html) command-line client to manage your PostgreSQL on your local workspace, you can connect it securely to PostgreSQL via Zerops VPN.
-
-Zerops VPN client is included into zCLI, the Zerops command-line tool. To start the VPN connection, read [how to connect to PostgreSQL remotely](/postgresql/how-to/connect#connect-remotely).
-
-Once the VPN session is established, you have the secured connection to the project's private network in Zerops. You can access all project services locally by using their hostname. The only difference is that no [environment variables](/postgresql/how-to/connect#method-2-environment-variables-recommended) are available when connected through VPN. To connect to PostgreSQL in Zerops you have to copy the [access details](/postgresql/how-to/connect#connection-details) manually from Zerops GUI.
-
-Use [psql ↗](https://www.postgresql.org/docs/current/app-psql.html) command to connect to PostgreSQL in Zerops:
-
-```sh
-psql -h [hostname] -U [user] -p [password] -d [database_name]
-```
-
-:::caution
-Do not use SSL/TLS protocols when connecting to PostgreSQL over VPN. Zerops PostgreSQL is not configured to support these protocols. The security is assured by the VPN.
-:::
-
-To export your database data and structure, use the [pg_dump ↗](https://www.postgresql.org/docs/current/backup-dump.html) command.
-
-```sh
-pg_dump [database_name] > dumpfilename.sql
-```
-
-To import your database data and structure, use the `mysql` command.
-
-```sh
-mysql [database_name] < dumpfilename.sql
-```
diff --git a/apps/docs/content/postgresql/how-to/manage.mdx b/apps/docs/content/postgresql/how-to/manage.mdx
index 48dac79c0..8cd3b7a1e 100644
--- a/apps/docs/content/postgresql/how-to/manage.mdx
+++ b/apps/docs/content/postgresql/how-to/manage.mdx
@@ -1,129 +1,43 @@
---
-title: Manage PostgreSQL Users, Databases and Plugins in Zerops
-description: Learn how to manage PostgreSQL users, databases, plugins, and use database administration tools in Zerops.
+title: Manage & data
+description: Manage PostgreSQL users, databases, and extensions in Zerops, and back up, restore, export, and import your data.
---
import { Dropdown, DropdownItem } from '/src/components/Dropdown';
-import TabbedCodeBlocks from '/src/components/TabbedCodeBlock';
-This guide covers how to manage your PostgreSQL databases in Zerops, including default setup, database management tools, plugins, and best practices.
+This guide covers the default database setup, installing extensions, backups, and moving data in and out. For connecting and management tools, see [Connect](/postgresql/how-to/connect).
-## Default Database and User
+## Default database and user
-Zerops creates a default database and user automatically when a new PostgreSQL service is [created](/postgresql/how-to/create).
+Zerops creates a default database and user automatically when a PostgreSQL service is [created](/postgresql/how-to/create).
-### Database
+- **Database name**: `db`
+- **User**: `db`
+- **Password**: randomly generated
+- **Encoding**: `UTF8` (locale `C.UTF-8`)
-- **Name**: Identical to the service hostname
-- **Encoding**: `utf8mb4`
-
-### DB User
-
-- **Username**: Identical to the service hostname
-- **Password**: Generated randomly
+Both names are fixed; they don't follow the service hostname. Besides the `db` user, Zerops also creates a `postgres` superuser for you (see [Extensions](#extensions)).
:::info
-For connection methods and environment variables, see the [Connect to PostgreSQL in Zerops](/postgresql/how-to/connect) page.
-:::
-
-:::caution Important notes
-- When changing passwords, update both the database user password and the environment variable separately - they don't automatically synchronize.
-- While both `postgresql://` and `postgres://` URI formats are valid, Zerops uses the `postgresql://` format. If your software requires `postgres://`, create a custom environment variable with this format.
-- Do not use SSL/TLS protocols for internal connections. Security is assured by the project's private network.
-:::
-
-## Database Management Tools
-
-You can use any PostgreSQL management tool of your choice to administer your databases in Zerops. For convenience, Zerops provides ready-to-use recipes for two popular web-based database management tools:
-
-* [Adminer](https://www.adminer.org) - a lightweight database management tool by Jakub Vrána
-* [phpMyAdmin](https://www.phpmyadmin.net) - a popular free database administration tool that works with both MySQL and PostgreSQL databases
-
-### Installing Management Tools
-
-You can install these tools with a simple one-click import in Zerops:
-
-1. In Zerops GUI, open your project and select **Import services** from the left menu
-2. Copy and paste one of the following YAML configurations:
-
-
-
-### Accessing Management Tools
-
-After installation, you can access these tools via VPN:
-
-1. [Start the Zerops VPN](/references/networking/vpn)
-2. Type `http://adminer` or `http://phpmyadmin` in your browser
-
-:::tip
-Try `http://adminer.zerops` or `http://phpmyadmin.zerops` if you encounter any connection issues.
+For connection methods, ports, and environment variables, see [Connect to PostgreSQL](/postgresql/how-to/connect).
:::
-:::caution
-Do not use https when connecting to management tools via VPN.
-:::
-
-## Database Tools on Your Workstation
-
-You can use various database management tools from your local workstation to connect to your PostgreSQL database in Zerops:
-
-1. **Establish a secure tunnel** using the [Zerops VPN](/references/networking/vpn) to create an encrypted connection to your Zerops project
-2. **Obtain the [connection details](/postgresql/how-to/connect#connection-details)** from Zerops GUI
- - Environment variables are not available through VPN connections
-3. Connect with your **preferred database tool**
- - Do not use SSL/TLS (security is provided by the VPN)
- - **Desktop Database Tools** - popular GUI tools like pgAdmin, DBeaver, DataGrip, or any other PostgreSQL-compatible client will work with Zerops
- - **Command Line with psql** - connect using the standard PostgreSQL command-line client with the credential obtained above:
- ```sh
- psql -h [hostname] -U [user] -d [database_name]
- ```
-
-:::tip
- Try `{hostname}.zerops` instead of just `{hostname}` if you encounter any connection issues.
-:::
+## Extensions
-## How to install and manage PostgreSQL plugins
+### List available extensions
-### Viewing available plugins
-You can list all available PostgreSQL plugins by running the following query *(superuser privileges not required)*:
+Any user can list the extensions available to install (superuser not required):
```sql
SELECT * FROM pg_available_extensions ORDER BY name;
```
-### Installing plugins (requires superuser)
-
-1. **Connect with superuser credentials**:
- - Use the `superUser` (user `postgres`) and `superUserPassword` environment variables from your PostgreSQL service
+### Install an extension (requires superuser)
-2. **Switch to your service database**:
- When logging in as the superuser, you're initially in the `postgres` database, not your service database.
+1. **Connect as the superuser.** Use the `superUser` (user `postgres`) and `superUserPassword` environment variables from your service.
+2. **Switch to your service database.** As the superuser you start in the `postgres` database, not your service database.
+3. **Create the extensions** you need:
-3. **Install required extensions**:
```sql
CREATE EXTENSION pg_stat_statements;
CREATE EXTENSION vector;
@@ -131,16 +45,14 @@ SELECT * FROM pg_available_extensions ORDER BY name;
```
:::warning
-Currently, it is not possible to add new plugins that are not already listed in `pg_available_extensions`.
+You can only install extensions already listed in `pg_available_extensions`; new extensions cannot be added.
:::
-When working with text search functionality, you'll need to reference the correct `stop`, `dict`, and `affix` files when creating dictionaries in your database. These files are essential for proper text search configuration.
-
-Zerops PostgreSQL includes the following dictionary files:
+When configuring text search dictionaries, reference the correct `stop`, `dict`, and `affix` files. Zerops PostgreSQL ships the following:
-**Stop word files** - used to remove common words that don't add significant meaning:
+**Stop word files**, used to remove common words that don't add significant meaning:
```
czech.stop
danish.stop
@@ -161,7 +73,7 @@ spanish.stop
swedish.stop
turkish.stop
```
-**Dictionary and affix files** - used for stemming and word normalization:
+**Dictionary and affix files**, used for stemming and word normalization:
```
cs_CZ.affix
cs_CZ.dict
@@ -178,4 +90,73 @@ unaccent.rules
```
-For more information on text search dictionaries, refer to the [PostgreSQL documentation](https://www.postgresql.org/docs/16/textsearch-dictionaries.html).
\ No newline at end of file
+
+See the [PostgreSQL text search documentation](https://www.postgresql.org/docs/current/textsearch-dictionaries.html) for more.
+
+## Backups
+
+Zerops automatically backs up PostgreSQL services with full encryption. For scheduling, retention, tagging, storage quotas, and manual backups (and the CLI tools), see [Zerops Backups](/features/backup). This section covers the PostgreSQL specifics.
+
+### Backup format
+
+- **Format**: `.zip` containing per-schema `.dump` files
+- **Tooling**: `pg_dump`, custom format (`-Fc`), files named `schemaName.dump`
+- **Storage**: encrypted, in isolated object storage
+
+### Restore a backup
+
+1. **Download** the backup `.zip` from the GUI
+2. **Extract** it to get the per-schema `.dump` files
+3. **Prepare** the target (clean existing data, or use a fresh instance)
+4. **Restore** each schema with `pg_restore`. The dumps are custom format (`-Fc`), so plain `psql` can't read them:
+
+ ```sh
+ pg_restore -d [database_name] schemaName.dump
+ ```
+
+ See the [official PostgreSQL backup documentation](https://www.postgresql.org/docs/current/backup-dump.html) for restore options. To use a web UI like [Adminer](/postgresql/how-to/connect#database-management-tools), first convert a dump to plain SQL with `pg_restore -f schema.sql schemaName.dump` and import that SQL file.
+
+### High availability
+
+For HA services:
+- Backups run on a randomly selected healthy node
+- Other nodes stay operational during the backup
+- Manual backups typically run on the primary node
+
+### Best practices
+
+- Take a manual backup with a protected tag before migrations or major schema changes
+- Test your restore process periodically in a non-production environment
+- Monitor backup storage usage in the Project Overview
+- Use descriptive tags like `pre-migration-v2`
+- Mind schema dependency order when restoring
+
+## Export & import data
+
+To move data in and out, first connect to your database, either over the [VPN](/postgresql/how-to/connect#connect-via-zerops-vpn) for a local tool or via [Adminer](/postgresql/how-to/connect#database-management-tools) in the browser.
+
+### With Adminer or a desktop tool
+
+Once connected, use the tool's built-in export/import functions. See [Database management tools](/postgresql/how-to/connect#database-management-tools) and [Desktop tools and psql](/postgresql/how-to/connect#desktop-tools-and-psql).
+
+### With the command line
+
+Export data and schema with [pg_dump](https://www.postgresql.org/docs/current/app-pgdump.html):
+
+```sh
+pg_dump [database_name] > dump.sql
+```
+
+Import a plain SQL dump with `psql`:
+
+```sh
+psql [database_name] < dump.sql
+```
+
+For a custom-format dump (`pg_dump -Fc`, the format Zerops backups use), use [pg_restore](https://www.postgresql.org/docs/current/app-pgrestore.html):
+
+```sh
+pg_restore -d [database_name] dump.dump
+```
+
+See [Desktop tools and psql](/postgresql/how-to/connect#desktop-tools-and-psql) for how to reach the database and pass the password with `PGPASSWORD`.
diff --git a/apps/docs/content/postgresql/how-to/scale.mdx b/apps/docs/content/postgresql/how-to/scale.mdx
index 468f2e2be..1301a103f 100644
--- a/apps/docs/content/postgresql/how-to/scale.mdx
+++ b/apps/docs/content/postgresql/how-to/scale.mdx
@@ -1,10 +1,11 @@
---
-title: How Zerops scales PostgreSQL
-description: Get to know how Zerops scales your PostgreSQL service.
+title: Scale & profiles
+description: PostgreSQL scaling profiles, autoscaling configuration, and high availability on Zerops.
---
import Image from '/src/components/Image';
import ResourceTable from '/src/components/ResourceTable';
+import { Dropdown, DropdownItem } from '/src/components/Dropdown';
Zerops automatically scales your PostgreSQL service based on actual database usage. When your database needs more power, resources increase. When demand drops, resources scale down to reduce costs.
@@ -16,6 +17,191 @@ For complete scaling details across all services, see [Automatic Scaling and Hig
PostgreSQL services use **vertical scaling** to adjust CPU, RAM, and disk resources within containers based on usage patterns. Unlike runtime services, PostgreSQL does not use horizontal scaling (adding/removing containers). Instead, PostgreSQL services use deployment modes for high availability.
+:::danger Scaling can briefly interrupt the service
+When scaling changes the service's resources, Zerops regenerates the PostgreSQL configuration and applies it with an automatic **reload**. If the new values require it, the service is **restarted** instead: rolling through the cluster in HA mode, a short outage in single mode.
+
+A restart is only needed when the granted RAM crosses a memory step: `256 MiB`, `512 MiB`, `1 GiB`, `2 GiB`, `4 GiB`, then multiples of `8 GiB`. Scaling within a step reloads only; to rule out restarts entirely, keep `minRam` and `maxRam` within one step.
+:::
+
+## Scaling profiles
+
+A **scaling profile** is the starting point for a PostgreSQL service. Each profile sets two things at once:
+
+1. **The autoscaling envelope**: the default minimum/maximum CPU, RAM, and disk, plus the free-resource headroom that controls how eagerly the autoscaler reacts.
+2. **The PostgreSQL configuration**: memory, WAL, planner, autovacuum, and replication settings tuned for a specific workload shape.
+
+A profile name combines a **workload type** with a **tier**, e.g. `oltp-production`.
+
+### Workload types
+
+
+
+
+
Type
+
Tuned for
+
Notes
+
+
+
+
+
OLTP
+
Transactional workloads like web apps, APIs, order processing, and auth. Short transactions and point lookups.
+
The default and most general-purpose type. Synchronous replication in HA.
+
+
+
OLAP
+
Analytical workloads like reporting, dashboards, and large aggregations.
+
Larger sort/hash memory, aggressive query parallelism, higher-resolution planner statistics. Asynchronous replication in HA (synchronous commits would throttle bulk loads).
+
+
+
WriteHeavy
+
High-volume ingestion like IoT telemetry, event logging, and metrics.
+
Commit batching, WAL compression, and aggressive autovacuum to keep up with write volume. Synchronous replication in HA.
+
+
+
+
+### Available profiles
+
+The tier part of the name sets the size of the autoscaling envelope (and, in HA, the replication topology). Which profiles you can pick depends on the deployment mode:
+
+
+
+
+
Profile
+
Mode
+
Use it for
+
+
+
+
+
oltp-hobby
+
Single
+
Side projects, prototypes, learning. Runs hot with minimal headroom to keep costs low.
+
+
+
oltp-staging
+
Single / HA
+
Staging, internal tools, early-stage apps. Moderate headroom. Default for single.
+
+
+
oltp-production
+
Single / HA
+
Business-critical transactional workloads. Generous headroom for traffic spikes. Default for HA.
+
+
+
oltp-enterprise
+
HA only
+
High-throughput OLTP at scale. Highest connection limits and the most aggressive headroom.
+
+
+
olap-production
+
Single / HA
+
Analytical / warehouse workloads.
+
+
+
writeheavy-production
+
Single / HA
+
Ingestion pipelines and write-heavy workloads.
+
+
+
custom
+
Single / HA
+
OLTP-based profile that lets you override individual PostgreSQL settings. See Custom profile.
+
+
+
+
+:::note
+In **HA** mode the OLTP and WriteHeavy profiles run with two synchronous standbys, so an acknowledged `COMMIT` survives a node failure. OLAP runs with asynchronous standbys, trading a small potential window of recent writes for ingest speed.
+:::
+
+### Setting a profile
+
+Set the profile when you create the service in the GUI, or with the `profile` field in your [import YAML](/postgresql/how-to/create#import-with-yaml):
+
+```yaml title="zerops-import.yaml"
+services:
+ - hostname: db
+ type: postgresql:ha@18
+ profile: oltp-production
+```
+
+If you don't set one, the default is used (`oltp-staging` for single, `oltp-production` for HA). **The profile can be changed at any time** in the GUI.
+
+### Overriding the autoscaling envelope
+
+The resource limits a profile sets are defaults. You can override any of them (CPU mode, min/max CPU/RAM/disk, and the free-resource thresholds) **without switching to the custom profile**, using the [`verticalAutoscaling`](/postgresql/how-to/create#service-parameters) block in your import YAML or the **Automatic scaling configuration** in the GUI. These overrides apply on top of any profile.
+
+### Custom profile
+
+The `custom` profile uses the **OLTP** tuning as its base and additionally lets you override individual PostgreSQL configuration values through `profileOverrides`:
+
+```yaml title="zerops-import.yaml"
+services:
+ - hostname: db
+ type: postgresql:single@18
+ profile: custom
+ profileOverrides:
+ random_page_cost: 1.1
+ default_statistics_target: 200
+ autovacuum_max_workers: 5
+ work_mem: 67108864 # bytes (64 MiB)
+ autovacuum_naptime: 120000000000 # nanoseconds (2 minutes)
+```
+
+Settings that Zerops derives from the container's resources or that are required for the managed cluster to operate (`shared_buffers`, `max_connections`, JIT on/off, the pooler limits, and the replication/Patroni settings) are managed automatically and **cannot** be overridden.
+
+Refer to the [PostgreSQL configuration documentation](https://www.postgresql.org/docs/current/runtime-config.html) for the meaning and valid range of each parameter, but **mind the units**: override values are plain numbers, with memory/disk sizes given in **bytes** and durations in **nanoseconds**. This differs from PostgreSQL's own conventions (kB, milliseconds, seconds). The table below shows which unit each key takes.
+
+
+
+
+
+
+
Key
+
Type / unit
+
Description
+
+
+
+
work_mem
bytes
Memory per sort/hash operation before spilling to disk
+
hash_mem_multiplier
integer
Multiplier applied to work_mem for hash-based operations
+
maintenance_work_mem
bytes
Memory for maintenance operations (VACUUM, CREATE INDEX, REINDEX)
+
autovacuum_work_mem
bytes
Memory used by each autovacuum worker
+
temp_buffers
bytes
Per-session memory for accessing temporary tables
+
temp_file_limit
bytes
Maximum total disk space a session may use for temporary files
+
effective_cache_size
bytes
Planner's assumption of total cache available (shared_buffers + OS cache)
+
effective_io_concurrency
integer
Estimated number of concurrent disk I/O operations the storage can handle
+
maintenance_io_concurrency
integer
Concurrent disk I/O operations for maintenance (VACUUM, prefetch)
+
random_page_cost
number
Planner's estimated cost of a non-sequential page fetch
+
default_statistics_target
integer
Default number of samples used by ANALYZE for column statistics
+
jit_above_cost
number
Query plan cost above which JIT compilation is considered
+
max_worker_processes
integer
Maximum number of background worker processes
+
max_parallel_workers
integer
Maximum parallel workers that can be active at one time cluster-wide
+
max_parallel_workers_per_gather
integer
Maximum parallel workers a single Gather node can start
+
max_parallel_maintenance_workers
integer
Maximum parallel workers for maintenance (CREATE INDEX, VACUUM)
+
wal_compression
string
Compression algorithm for full-page WAL images (off/pglz/lz4/zstd)
+
wal_buffers
bytes
Shared memory used to buffer WAL data not yet written to disk
+
wal_writer_delay
nanoseconds
Interval at which the WAL writer flushes WAL to disk
+
wal_writer_flush_after
bytes
WAL bytes written before the WAL writer triggers a flush
+
commit_delay
nanoseconds
Artificial delay before a WAL flush during commit to batch concurrent commits
+
commit_siblings
integer
Minimum number of concurrent open transactions required for commit_delay to apply
+
max_wal_size
bytes
Soft upper limit on WAL size that triggers a checkpoint
+
min_wal_size
bytes
Minimum WAL size kept for future reuse before recycling segments
+
autovacuum_max_workers
integer
Maximum autovacuum worker processes running concurrently
+
autovacuum_naptime
nanoseconds
Delay between autovacuum runs on any given database
+
autovacuum_vacuum_scale_factor
number
Fraction of table size added to the autovacuum threshold
+
autovacuum_analyze_scale_factor
number
Fraction of table size added to the auto-analyze threshold
+
autovacuum_vacuum_cost_delay
nanoseconds
Cost-based delay inserted by autovacuum between I/O operations
+
autovacuum_vacuum_cost_limit
integer
Accumulated vacuum cost at which an autovacuum worker sleeps
+
vacuum_cost_delay
nanoseconds
Cost-based delay inserted by manual VACUUM between I/O operations (0 disables)
+
idle_in_transaction_session_timeout
nanoseconds
Terminate sessions that stay idle in a transaction longer than this
+
+
+
+
+
## Configure scaling
You can configure scaling settings:
@@ -49,20 +235,13 @@ You can configure scaling settings:
- **Raise the minimum** when you need guaranteed baseline performance
- **Set minimum = maximum** to disable automatic scaling for that specific resource
-**Deployment mode**: Choose the reliability configuration for your PostgreSQL service:
-
-- **Single Container**: One container with vertical scaling only. Suitable for development environments.
-- **Highly Available**: Multiple containers with built-in redundancy. Recommended for production environments.
+**Deployment mode** (single container vs. highly available) is chosen when the service is created and cannot be changed later. See [Deployment modes](/postgresql/overview#deployment-modes).
-:::warning
-Deployment mode cannot be changed after service creation.
-:::
+### High availability
-:::tip HA Mode
-In HA mode, a dedicated read replica port (`5433`) is available for routing read queries to replicas. This improves performance by distributing load across all database containers. See [Connection Parameters](/postgresql/how-to/connect#connection-parameters) for details.
-:::
+In HA mode, Zerops runs a 3-node cluster across separate physical machines, fronted by two database proxy containers (free of charge) that route traffic. When a container fails, Zerops automatically replaces it on a different machine and synchronizes data from the healthy copies.
-When a container fails in HA mode, Zerops automatically replaces it with a new container on a different physical machine and synchronizes data from healthy copies.
+A dedicated **read-replica port (`5433`)** lets you route read-only queries to the replicas, taking load off the primary and improving throughput. See [Connection parameters](/postgresql/how-to/connect#connection-parameters) and [Connection ports and TLS](/postgresql/how-to/connect#connection-ports-and-tls).
### Advanced settings
@@ -97,7 +276,7 @@ Navigate to your PostgreSQL service and select **Service containers & Overview**
## Technical details
-Zerops monitors database usage and automatically adjusts resources based on predefined thresholds and timing parameters. The scaling behavior follows the same principles as other services in the platform.
+Zerops monitors database usage and automatically adjusts resources based on predefined thresholds and timing parameters. The scaling behavior follows the same principles as other services on the platform.
For complete technical specifications including:
- Resource monitoring intervals and thresholds
diff --git a/apps/docs/content/postgresql/overview.mdx b/apps/docs/content/postgresql/overview.mdx
index 7f6730b63..e8d01b40a 100644
--- a/apps/docs/content/postgresql/overview.mdx
+++ b/apps/docs/content/postgresql/overview.mdx
@@ -1,118 +1,129 @@
---
-title: PostgreSQL overview
-description: Learn about working with PostgresSql with ease in Zerops.
+title: PostgreSQL on Zerops
+description: Managed PostgreSQL on Zerops with automated backups, vertical autoscaling, optional high availability, and workload-tuned configuration.
---
import DocCardList from '@theme/DocCardList';
import Icons from '@theme/Icon';
-import LargeCardList from '@site/src/components/LargeCardList';
-import LargeCard from '@site/src/components/LargeCard';
+import data from '@site/static/data.json';
+import UnorderedList from '@site/src/components/UnorderedList';
-[PostgreSQL ↗](https://www.postgresql.org/) is a powerful, open source object-relational database system with over 35 years of active development that has earned it a strong reputation for reliability, feature robustness, and performance.
+[PostgreSQL ↗](https://www.postgresql.org/) is a powerful, open-source object-relational database with a 35-year track record for reliability, robustness, and performance. On Zerops it runs as a **fully managed service**: automated encrypted backups, vertical autoscaling, optional high availability with automatic failover, and a configuration tuned to your workload, with no server to administer.
-## Feature Highlights
+## Quick start
-
+Add a PostgreSQL service to your project with a `zerops-import.yaml`:
-### Connect to PostgreSQL service
+```yaml title="zerops-import.yaml"
+services:
+ - hostname: db
+ # type is postgresql:{mode}@{version}
+ type: postgresql:single@18
+ # workload-tuned autoscaling profile
+ profile: oltp-staging
+```
+
+Import it with the zCLI:
+
+```bash
+zcli project service-import zerops-import.yaml
+```
+
+The moment the container boots you have a working database. See [Create & import](/postgresql/how-to/create) for the GUI flow and the full configuration reference.
+
+## What you get out of the box
+
+- **A default database and user**, both named `db` (encoding `UTF8`, locale `C.UTF-8`), with a randomly generated password.
+- **Connection details and environment variables**, including hostname, ports, and ready-made connection strings. See [Connect](/postgresql/how-to/connect).
+- **Workload-tuned configuration** via the [scaling profile](/postgresql/how-to/scale#scaling-profiles) you choose (OLTP, OLAP, or write-heavy).
+- **Automated, encrypted backups** stored in isolated object storage. See [Manage & data](/postgresql/how-to/manage#backups).
+- **Vertical autoscaling** that grows and shrinks CPU, RAM, and disk with real usage.
+
+### Supported versions
+
+
+
+## Deployment modes
+
+Choose the reliability model when you create the service. It is set through the service `type` and is **fixed for the life of the service**.
+
+
+
+
+
Mode
+
type
+
What it is
+
+
+
+
+
Highly Available
+
postgresql:ha@N
+
A 3-node cluster spread across separate physical machines, with data stored redundantly, automatic failover, and a read-replica port. Recommended for production.
+
+
+
Single container
+
postgresql:single@N
+
One container, so lower cost but no redundancy. Data since the last backup is lost if it fails. Good for development and non-critical workloads.
+
+
+
+
+:::tip
+In HA mode, route read-only queries to the replica port (`5433`) to take load off the primary. See [Scale & profiles](/postgresql/how-to/scale#high-availability) and [Connection ports and TLS](/postgresql/how-to/connect#connection-ports-and-tls).
+:::
+
+## Next steps
-
-### Others
-
-
-## When in doubt, reach out
-
-Don't know how to start or got stuck during the process? You might not be the first one, visit the FAQ section to find out.
-
-In case you haven't found an answer (and also if you have), we and our community are looking forward to hearing from you on Discord.
+## Need help?
-Have you build something that others might find useful? Don't hesitate to share your knowledge!
+Stuck, or want to share what you built? Our core team and community are on Discord.
-
-## Popular Guides
-
-:6380 -verify_return_error (null);
const [height, setHeight] = useState(0);
@@ -40,7 +41,11 @@ export function DropdownItem({ title, children }: DropdownItemProps) {
style={{ height: height }}
role="region"
>
-