Skip to main content

Running via Docker

PgSmart Docker images offer a simple and quick way to start a PostgreSYS environment without the need to install packages.

Load Docker Images

In this quick start guide, we will use Docker Compose to start a PostgreSYS environment.

  1. Run login on the repository (use your email and password registered on the Tecnisys website):
Terminal input
docker login -u <seu email> repo.tecnisys.com.br
  1. Download the latest version (latest) of the PgSmart Docker images.
  • PgSmart Client Image (CLI + Web)

    Terminal input
    docker pull repo.tecnisys.com.br/pgsys/pgsmart-client:latest
  • PgSmart Agent Image

    Terminal input
    docker pull repo.tecnisys.com.br/pgsmart-agent:latest

Create Docker Compose

Through Docker Compose it is possible to initialize the PgSmart containers in an integrated way and pre-configure PostgreSYS services.

To better organize the files, create a dedicated directory for the PgSmart Docker Compose. Access the created directory and use a text editor to create the .env file with the credentials to access the PostgreSYS repository:

.env
PGSYS_USERNAME=your_tecnisys_access_email
PGSYS_PASSWORD=your_tecnisys_access_password

Next, create the compose.yml file with the following content:

compose.yml
networks:
local-net:
driver: bridge

services:

agent:
image: repo.tecnisys.com.br/pgsys/pgsmart-agent:latest
container_name: pgsmart-agent
privileged: true
cap_add:
- ALL
networks:
- local-net
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:rw
tmpfs:
- /run
- /tmp
stop_signal: SIGRTMIN+3
ports:
# Exposed ports for accessing components installed in the container (adjust to avoid host port conflicts)
- "4432:4432" # PgSmart Agent
- "5432:5432" # PostgreSQL Instance
- "6432:6432" # PgBouncer
- "8008:8008" # Patroni
- "2379:2379" # etcd
- "7001:7000" # HAProxy
- "9090:9090" # Prometheus
- "3000:3000" # Grafana
- "4433:4433" # PostgreSYS PostgreSQL
- "9093:9093" # Alertmanager
- "9095:9095" # Karma
post_start:
- command: /opt/create-pgsys-repo.sh ${PGSYS_USERNAME} ${PGSYS_PASSWORD}
user: root
- command: /opt/configure-postgresql-instance.sh 17 postgres /data /wal 5432 UTF8 C # PostgreSQL instance configuration
user: root

client:
image: repo.tecnisys.com.br/pgsys/pgsmart-client:latest
container_name: pgsmart-client
networks:
- local-net
ports:
- "4435:4435"
depends_on:
- agent
environment:
# OPTIONAL: By default, the PostgreSYS environment will be initialized with the credentials provided in the .env file.
- PGSYS_USERNAME=${PGSYS_USERNAME}
- PGSYS_PASSWORD=${PGSYS_PASSWORD}
post_start:
# Pre register agent
- command: /opt/register-agent.sh pgsmart-agent 9dbaff1aafb9e7ed609cf015
user: pgsmart
# IMPORTANT: If you only want an initial/clean environment (without pre-install services), REMOVE the commands below
# Pre-install Pool Service
- command: script -c "pgsmart install --quiet --agent pgsmart-agent --pgversion 17 --service pool" /dev/null
user: pgsmart
# Pre-install Backup Service
- command: script -c "pgsmart install --quiet --agent pgsmart-agent --pgversion 17 --service backup" /dev/null
user: pgsmart
# Pre-install HA Service
- command: script -c "pgsmart install --quiet --agent pgsmart-agent --pgversion 17 --service ha --ha-components dcs agent proxy" /dev/null
user: pgsmart
# Pre-install Observability Service
- command: script -c "pgsmart install --quiet --agent pgsmart-agent --pgversion 17 --service obs --obs-inet 127.0.0.1" /dev/null
user: pgsmart

Start PostgreSYS Environment

Prerequisites
  • You must have Docker Compose version 2.30 or higher installed on your system to ensure compatibility with all features used.
  • Define the PGSYS_USERNAME and PGSYS_PASSWORD environment variables in the .env file, or in the compose.yml file, or pass them as parameters in the docker-compose up -d command.

Before running Docker Compose, verify that the names and tags (for example, latest) of the PgSmart images defined in the compose.yml file match the images downloaded to your local Docker repository.

In the directory of the compose.yml file, run the command below to start your PostgreSYS environment:

Terminal input
docker-compose up -d

Done! Now just wait for the PgSmart containers to initialize.

As a next step, access PgSmart Web in your browser:

https://<ip or hostname of the PgSmart Client container host>:4435

To log in to PgSmart Web, use the default credentials:

  • User: pgsmart
  • Password: pgsmart