Initial Setup

To start working with the Postgres ProGate web interface, execute the following steps:

  1. Create a database, user, and schema.

    The Postgres ProGate web interface requires a PostgreSQL/Postgres Pro database. In this database, create a dedicated schema where the web interface will store its support data and a user to work with this schema. For example, create the dbname database, the progate schema in it, and the progate_user user with the password password:

    CREATE USER progate_user WITH PASSWORD 'password';
    CREATE SCHEMA progate AUTHORIZATION progate_user;
    GRANT ALL PRIVILEGES ON SCHEMA progate TO progate_user;
    GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA progate TO progate_user;
    ALTER DEFAULT PRIVILEGES IN SCHEMA progate
    GRANT ALL PRIVILEGES ON TABLES TO progate_user;
    GRANT USAGE, CREATE ON SCHEMA progate TO progate_user;
    GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA progate TO progate_user;
  2. Specify the database for the service.

    To specify the database, in the environment file /opt/pgpro/progate/etc/env_progate, edit the line under the comment below so that it looks as follows (for details, refer to Setting up Postgres ProGate with the Environment File):

    # PostgreSQL/Postgres Pro connection string
    PROGATE_DB="postgres://user:password@host:port/dbname?sslmode=disable&search_path=progate"

    Set the value of search_path above to the name of the dedicated schema.

    When composing the connection string, double-check that:

    • The user specified in the connection string has permissions for the progate schema.

    • The schema is in the specified database.

  3. If the web interface is accessed over HTTP rather than HTTPS, edit the /opt/pgpro/progate/etc/env_progate environment file as follows:

    PROGATE_HTTP_SERVER_ENABLE_SECURE_COOKIES="false"

    By default, this parameter is set to true. In this case, the progate_access_token and progate_refresh_token authentication cookies have the Secure and Partitioned attributes, and the Postgres ProGate backend sends the Strict-Transport-Security (HSTS) header. When set to false, both cookie attributes are removed and the HSTS header is no longer sent, while the HttpOnly and SameSite=Strict attributes are preserved. If the web interface is available over HTTPS, including through a reverse proxy server, keep the default value.

    When accessed over HTTP, user credentials and tokens are transmitted without encryption. The web interface and the API must be available through a single origin: the same protocol, server name, and port. If a reverse proxy server is used, make sure it does not redirect HTTP to HTTPS and does not add the HSTS header itself.

    If a browser previously received the HSTS header for this server name over HTTPS, the stored policy will not be removed when the header is disabled. Before switching to HTTP, send the Strict-Transport-Security: max-age=0 header over HTTPS. For example, temporarily configure the web server that decrypts HTTPS requests to send this header and open the site in a browser.

    This procedure clears the HSTS policy only for this particular server name. It has no effect if HSTS was set for a parent domain with the includeSubDomains attribute, or if the domain is included in the HSTS preload list. Such policies must be removed at their source. Stale authentication cookies can also prevent access over HTTP. Clear the cookies of this site in the browser or use a different server name to access the web interface.

  4. Launch the progate.service service using the following commands and add them to the system autostart:

    systemctl start progate.service
    systemctl enable progate.service
  5. (Optional) If a firewall is used, allow network connections on the TCP/8081 port.

If all the steps are performed without errors, the Postgres ProGate management service is launched successfully. The Postgres ProGate web interface is available at http://<server_IP_address>:8081. See Logging in to the Web Application for how to log in.

Setting up Postgres ProGate with the Environment File

For the service to work properly, in the environment file, which is created automatically, edit the PROGATE_DB setting to specify your user, password, host port, dbname, and search_path. search_path must contain the name of the schema where the support information is stored. The environment file is located at /opt/pgpro/progate/etc/env_progate and has the contents that may look like these:

# Port for Postgres ProGate backend
PROGATE_HTTP_SERVER_PORT="8081"

# Postgres ProGate backend serves static files from given directory
PROGATE_HTTP_SERVER_STATIC_DIR="/opt/pgpro/progate/ui"

# Set to false to allow HTTP access: disables authentication cookies
# with the Secure/Partitioned attributes and the HSTS header
PROGATE_HTTP_SERVER_ENABLE_SECURE_COOKIES="true"

# PostgreSQL/Postgres Pro connection string
PROGATE_DB="postgres://user:password@host:port/dbname?sslmode=disable&search_path=progate"

# Log format: json | pretty
PROGATE_LOGS_FORMAT=pretty

# Log level: debug | info | warn | error
PROGATE_LOGS_LEVEL=info

# Length of the access token secret. Must be greater than or equal to 32 characters
PROGATE_AUTH_ACCESS_TOKEN_SECRET="mT-Y8ICZv-zhirL_j2K69vX_Upbo8B6rMKtplqv4U4I="

# Lifetime of the web interface's access token
PROGATE_AUTH_ACCESS_TOKEN_LIFETIME="168h"

# Lifetime of the web interface's access refresh token
PROGATE_AUTH_REFRESH_TOKEN_LIFETIME="720h"

# Path to prosync bin
PROGATE_TRANSFER_WORK_PROSYNC_BIN="/opt/pgpro/progate/bin/prosync"

# Path to procopy bin
PROGATE_TRANSFER_WORK_PROCOPY_BIN="/opt/pgpro/progate/bin/procopy"

# Path to directory with procopy/prosync configs and other Postgres ProGate backend-specific support files
PROGATE_TRANSFER_WORK_WORKING_DIR="/var/lib/progate/execution"

Be sure to replace the default value of the PROGATE_AUTH_ACCESS_TOKEN_SECRET environment variable with your own secret to avoid unauthorized access to the web interface. To generate your own access token secret, you can use, for example, the following command:

openssl rand -base64 48

The secret length must be greater than or equal to 32 characters.

For how to set values of time environment variables, refer to Setting Time Values.

Setting up Postgres ProGate with the Configuration File

In addition to environment variables, Postgres ProGate can be set up by means of the .yaml configuration file. Pass the path to this file with the -c flag. For example:

/opt/pgpro/progate/bin/progate -c path/to/config.yaml

The configuration file defines the same characteristics as the environment variables and may look as follows:

http_server:
  port: 8081
  static_dir: "/opt/pgpro/progate/ui"
  enable_secure_cookies: false  # For HTTP access; use true for HTTPS
  enable_debug_endpoints: false
db: "postgres://user:password@host:port/dbname?sslmode=disable&search_path=progate"
logs:
  format: pretty
  level: info
auth:
  access_token_secret: "mT-Y8ICZv-zhirL_j2K69vX_Upbo8B6rMKtplqv4U4I="
  access_token_lifetime: 168h
  refresh_token_lifetime: 720h
transfer_work:
  prosync:
    bin: "/opt/pgpro/progate/bin/prosync"
  procopy:
    bin: "/opt/pgpro/progate/bin/procopy"
  working_dir: "/var/lib/progate/execution"

Be sure to replace the default value of the PROGATE_AUTH_ACCESS_TOKEN_SECRET environment variable with your own secret to avoid unauthorized access to the web interface. To generate your own access token secret, you can use, for example, the following command:

openssl rand -base64 48

The secret length must be greater than or equal to 32 characters.

The configuration parameters are described in Contents of the Postgres ProGate Configuration File.

Table 1. Contents of the Postgres ProGate Configuration File
Configuration parameter Environment variable Description Example

http_server.port

PROGATE_HTTP_SERVER_PORT

Port for the Postgres ProGate backend

8081

http_server.static_dir

PROGATE_HTTP_SERVER_STATIC_DIR

Postgres ProGate backend serves static files from this directory

/opt/pgpro/progate/ui

http_server.enable_debug_endpoints

PROGATE_HTTP_SERVER_ENABLE_DEBUG_ENDPOINTS

Enables debug endpoints of the application

true

http_server.enable_secure_cookies

PROGATE_HTTP_SERVER_ENABLE_SECURE_COOKIES

Enables the Secure and Partitioned attributes of authentication cookies and sending of the Strict-Transport-Security (HSTS) header. The default value is true. Set to false to allow access over plain HTTP

true

db

PROGATE_DB

PostgreSQL/Postgres Pro connection string

postgres://user:password@host:port/dbname?sslmode=disable&search_path=progate

logs.format

PROGATE_LOGS_FORMAT

Log format: json / pretty

pretty

logs.level

PROGATE_LOGS_LEVEL

Log level: debug / info / warn / error

info

auth.access_token_secret

PROGATE_AUTH_ACCESS_TOKEN_SECRET

Length of the access token secret. Must be greater than or equal to 32 characters

mT-Y8ICZv-zhirL_j2K69vX_Upbo8B6rMKtplqv4U4I=

auth.access_token_lifetime

PROGATE_AUTH_ACCESS_TOKEN_LIFETIME

Lifetime of the web interface’s access token

30m

auth.refresh_token_lifetime

PROGATE_AUTH_REFRESH_TOKEN_LIFETIME

Lifetime of the web interface’s access refresh token

720h

transfer_work.prosync.bin

PROGATE_TRANSFER_WORK_PROSYNC_BIN

Path to the prosync binary

/opt/pgpro/progate/bin/prosync

transfer_work.procopy.bin

PROGATE_TRANSFER_WORK_PROCOPY_BIN

Path to the procopy binary

/opt/pgpro/progate/bin/procopy

transfer_work.working_dir

PROGATE_TRANSFER_WORK_WORKING_DIR

Path to the directory with procopy / prosync config files and other Postgres ProGate backend-specific support files

/var/lib/progate/execution