3.4. 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 user user with the password password:

    CREATE USER user WITH PASSWORD 'password';
    CREATE SCHEMA progate AUTHORIZATION user;
    GRANT ALL PRIVILEGES ON SCHEMA progate TO user;
    GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA progate TO user;
    ALTER DEFAULT PRIVILEGES IN SCHEMA progate
    GRANT ALL PRIVILEGES ON TABLES TO user;
    GRANT USAGE, CREATE ON SCHEMA progate TO user;
    GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA progate TO 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 Section 3.4.1):

    # 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. Launch the progate.service service using the following commands and add them to the system autostart:

    systemctl start progate.service
    systemctl enable progate.service
    

  4. (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 Section 3.5 for how to log in.

3.4.1. 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"

# 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 secret token. 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"

For how to set values of time environment variables, refer to Appendix A.

3.4.2. 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_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"

The configuration parameters are described in Table 3.1.

Table 3.1. Contents of the Postgres ProGate Configuration File

Cofiguration parameterEnvironment variableDescriptionExample
http_server.portPROGATE_HTTP_SERVER_PORTPort for the Postgres ProGate backend8081
http_server.static_dirPROGATE_HTTP_SERVER_STATIC_DIRPostgres ProGate backend serves static files from this directory/opt/pgpro/progate/ui
http_server.enable_debug_endpointsPROGATE_HTTP_SERVER_ENABLE_DEBUG_ENDPOINTSEnables debug endpoints of the applicationtrue
dbPROGATE_DBPostgreSQL/Postgres Pro connection stringpostgres://user:password@host:port/dbname​?sslmode=disable&search_path=progate
logs.formatPROGATE_LOGS_FORMATLog format: json / prettypretty
logs.levelPROGATE_LOGS_LEVELLog level: debug / info / warn / errorinfo
auth.access_token_secretPROGATE_AUTH_ACCESS_TOKEN_SECRETLength of the secret token. Must be greater than or equal to 32 charactersmT-Y8ICZv-zhirL_j​2K69vX_Upbo8B6rMKtplqv4U4I=
auth.access_token_lifetimePROGATE_AUTH_ACCESS_TOKEN_LIFETIMELifetime of the web interface's access token30m
auth.refresh_token_lifetimePROGATE_AUTH_REFRESH_TOKEN_LIFETIMELifetime of the web interface's access refresh token720h
transfer_work.prosync.binPROGATE_TRANSFER_WORK_PROSYNC_BINPath to the prosync binary/opt/pgpro/progate/bin/prosync
transfer_work.procopy.binPROGATE_TRANSFER_WORK_PROCOPY_BINPath to the procopy binary/opt/pgpro/progate/bin/procopy
transfer_work.working_dirPROGATE_TRANSFER_WORK_WORKING_DIRPath to the directory with procopy / prosync config files and other Postgres ProGate backend-specific support files /var/lib/progate/execution