28.3. Настройте менеджер #

На сервере экземпляра СУБД Postgres Pro:

  1. Подключите репозиторий пакетов PPEM:

    1. Получите ключ доступа к репозиторию:

      1. Откройте свой личный кабинет на портале технической поддержки.

      2. Перейдите на страницу Администрирование → Набор лицензий → Репозитории.

      3. Найдите и скопируйте ключ доступа.

        Ключи доступны только администраторам набора лицензий.

    2. Скачайте bash-скрипт pgpro-repo-add.sh:

      wget --user 'значение_ключа_доступа' --password='' https://repo.postgrespro.ru/ppem/ppem/keys/pgpro-repo-add.sh

      Примечание

      Значение ключа доступа нужно указывать в --user, не в --password. Этот последний параметр должен быть пустым.

      Этот скрипт подключает репозиторий Postgres Pro, чтобы менеджер пакетов операционной системы хоста мог использовать его.

    3. (Необязательно) При необходимости проверьте содержимое скрипта.

    4. Сделайте файл скрипта исполняемым и запустите его:

      
      chmod +x pgpro-repo-add.sh && ./pgpro-repo-add.sh
      
      

      Скрипт установит ключи GPG Postgres Pro, подключит репозиторий и настроит менеджер пакетов.

    5. При запросе введите указанные выше учётные данные для доступа:

      Важно

      Если учётные данные не предоставлены или неверны, скрипт предлагает добавить репозиторий без учётных данных.

      Если вы решите подключить репозиторий без учётных данных, вам потребуется вручную ввести их позже для доступа к репозиторию.

  2. Установите менеджер:

    # apt install ppem ppem-gui

    Файл конфигурации менеджера ppem-manager.yml будет загружен на ваше локальное устройство.

  3. Создайте пользователя СУБД, от имени которого менеджер будет подключаться к базе данных репозитория:

    # sudo -u postgres createuser --pwprompt ppem

    При выполнении этой команды укажите пароль пользователя СУБД.

  4. Создайте базу данных репозитория:

    # sudo -u postgres createdb -O ppem ppem
  5. Убедитесь, что пользователь СУБД может подключиться к базе данных:

    # psql -h localhost -U ppem -d ppem

    При проблемах с подключением убедитесь, что в файл конфигурации pg_hba.conf добавлено правило HBA, разрешающее пользователю СУБД подключаться к базе данных, а также указан метод авторизации.

    Например, чтобы разрешить менеджеру подключаться к базе данных репозитория ppem от имени пользователя ppem, можно настроить следующие правила HBA:

    host    ppem  ppem  ::1/128       trust
    host    ppem  ppem  127.0.0.1/32  trust

    За подробной информацией обратитесь к официальной документации Postgres Pro по файлу конфигурации pg_hba.conf.

  6. При подключении к базе данных репозитория ppem от имени пользователя ppem выдайте право пользователю СУБД на чтение системного каталога pg_statistic:

    GRANT SELECT ON pg_catalog.pg_statistic TO ppem;
  7. В файле конфигурации менеджера ppem-manager.yml:

    • repo.url

      Укажите следующие значение и замените необходимые данные:

      postgres://ppem:пароль_пользователя_СУБД@localhost/ppem
  8. Настройте запуск службы менеджера от имени пользователя операционной системы:

    1. Начните редактирование модуля systemd:

      # systemctl edit ppem
    2. В разделе [Service] укажите имя пользователя операционной системы:

      [Service]
      User=ppem
    3. Убедитесь, что пользователь операционной системы имеет право чтения файла конфигурации менеджера ppem-manager.yml.

      Если право отсутствует, выполните запрос:

      # chown ppem:ppem /etc/ppem-manager.yml
      # chmod 400 /etc/ppem-manager.yml
    4. Сохраните параметры модуля systemd, затем перезагрузите его:

      # systemctl daemon-reload
  9. Запустите службу менеджера и добавьте её в автозагрузку сервера:

    # systemctl start ppem
    # systemctl enable ppem

Веб-приложение будет установлено на сервере.

28.3. Configure the Manager #

On the Postgres Pro DBMS instance server:

  1. Add the PPEM package repository:

    1. Get the access key for the repository:

      1. Open your personal account in the technical support portal.

      2. Go to Administration → License Set → Repositories.

      3. Locate and copy the access key.

        Access keys are available only to license set administrators.

    2. Download the pgpro-repo-add.sh Bash script:

      wget --user 'access_key_value' --password='' https://repo.postgrespro.com/ppem/ppem/keys/pgpro-repo-add.sh
      

      Note

      Specify the access key value in --user, not --password. The latter option must be empty.

      This script adds the Postgres Pro repository so that the package manager of the host operating system can use it.

    3. (Optional) Examine the content of the script, if necessary.

    4. Make the script file executable and run it:

      
      chmod +x pgpro-repo-add.sh && ./pgpro-repo-add.sh
      
      

      The script will install the Postgres Pro GPG keys, add the repository, and configure the package manager.

    5. When prompted, enter the same access credentials as above:

      Important

      If no credentials are provided or they are invalid, the script offers to add the repository without credentials.

      If you proceed without credentials, you must manually provide the credentials later in order to access the repository.

  2. Install the manager:

    # apt install ppem ppem-gui
    

    The ppem-manager.yml manager configuration file will be downloaded to your local device.

  3. Create the DBMS user on behalf of which the manager will connect to the repository database:

    # sudo -u postgres createuser --pwprompt ppem
    

    When executing this command, specify the DBMS user password.

  4. Create the repository database:

    # sudo -u postgres createdb -O ppem ppem
    
  5. Ensure that the DBMS user can connect to the database:

    # psql -h localhost -U ppem -d ppem
    

    In case of connection issues, ensure that the HBA rule allowing the DBMS user to connect to the database, as well as the authorization method, are specified in the pg_hba.conf configuration file.

    For example, to allow the manager to connect to the ppem repository database on behalf of the ppem user, the following HBA rules may be configured:

    host    ppem  ppem  ::1/128       trust
    host    ppem  ppem  127.0.0.1/32  trust
    

    For more information, refer to the official Postgres Pro documentation on the pg_hba.conf configuration file.

  6. While connected to the ppem repository database on behalf of the ppem user, grant the DBMS user the privilege to read the pg_statistic system catalog:

    GRANT SELECT ON pg_catalog.pg_statistic TO ppem;
    
  7. In the ppem-manager.yml manager configuration file:

    • repo.url

      Specify the following value and substitute the necessary data:

      postgres://ppem:DBMS_user_password@localhost/ppem
      
  8. Configure the manager service to start under the operating system user:

    1. Start editing the systemd unit:

      # systemctl edit ppem
      
    2. In the [Service] section, specify the name of the operating system user:

      [Service]
      User=ppem
      
    3. Ensure that the operating system user is granted the privilege to read the ppem-manager.yml manager configuration file.

      If the privilege is not granted, execute:

      # chown ppem:ppem /etc/ppem-manager.yml
      # chmod 400 /etc/ppem-manager.yml
      
    4. Save systemd unit parameters, then reload it:

      # systemctl daemon-reload
      
  9. Start the manager service and add it to the server startup:

    # systemctl start ppem
    # systemctl enable ppem
    

The web application will be installed on the server.

FAQ