Skip to main content
Skip to main content

Create & import

Create a PostgreSQL service in the GUI, or describe it in YAML and import it through the GUI or zCLI. Both paths configure the same things; the YAML route is repeatable and versionable.

Create in the GUI

Go to your project dashboard and choose Add new service in the Services block:

The wizard asks for four things:

Version

  • 18 (18.1)
  • 17 (17.7)
  • 16 (16.11)
  • 14 (14.20)

Hostname

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.

Deployment mode

Highly Available (a 3-node cluster, recommended for production) or Single container (lower cost, no redundancy). See Deployment modes for the comparison.

Scaling profile and resources

Pick a scaling profile 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 for details.

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.

Import with YAML

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.

Add a service to an existing project

zerops-import.yaml
services:
- hostname: db
# postgresql:{single|ha}@{version}
type: postgresql:single@18
# optional: autoscaling profile, see Scale & profiles
profile: oltp-staging

With zCLI:

zcli project service-import zerops-import.yaml

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:

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.

Create a new project

A project import additionally contains the project: section:

zerops-import.yaml
project:
name: my-project
# optional: project description and tags
description: A project with a PostgreSQL database
tags:
- DEMO
- ZEROPS

services:
- hostname: db
type: postgresql:ha@18
profile: oltp-production
# optional: override the profile's autoscaling defaults
verticalAutoscaling:
cpuMode: DEDICATED
minCpu: 2
maxCpu: 5
minRam: 2
maxRam: 24
minDisk: 6
maxDisk: 50
startCpuCoreCount: 3
minFreeRamGB: 0.5
minFreeRamPercent: 20
- hostname: dbstaging
type: postgresql:single@18
profile: oltp-staging
zcli project project-import zerops-import.yaml

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.

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 "./")
image
Note

The maximum size of an import YAML is 100 kB. A project import can mix PostgreSQL with any other service type.

Project parameters

The project: section is required for a project import. Only one project can be defined.

ParameterDescription
nameThe name of the new project. Duplicates are allowed.
descriptionOptional. Description of the new project. Maximum 255 characters.
tagsOptional. 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.

ParameterDescription
hostname

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

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

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

Optional. Only valid with profile: custom; overrides individual PostgreSQL configuration values. See Custom profile for the overridable keys and their units.

verticalAutoscaling

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.