Uploaded image for project: 'OpenNMS'
  1. OpenNMS
  2. NMS-13715

Install script fails when using Azure PostgreSQL Services

    XMLWordPrintable

Details

    Description

      The Azure PostgreSQL Service only accepts username in the form of "username@hostname", and Liquibase fails when creating the user for OpenNMS. For instance, if I use the following:

        <jdbc-data-source name="opennms"
                          database-name="opennms"
                          class-name="org.postgresql.Driver"
                          url="jdbc:postgresql://14.0.1.5:5432/opennms"
                          user-name="opennms"
                          password="opennms" />
      
        <jdbc-data-source name="opennms-admin"
                          database-name="template1"
                          class-name="org.postgresql.Driver"
                          url="jdbc:postgresql://14.0.1.5:5432/template1"
                          user-name="postgres@qa-env1-onms"
                          password="0p3nNM5;" />
      

      The IP 14.0.1.5 comes from an Azure Private Endpoint associated with the Azure PostgreSQL Service to avoid exposing the database to the Internet.

      I get the following error when executing the install script:

      11:02:37.377 [Main] WARN  org.opennms.install.Installer - Could not create file: /opt/opennms/etc/libraries.properties
      11:02:37.542 [Main] INFO  org.opennms.install.Installer - * using 'postgres@qa-env1-onms' as the PostgreSQL user for OpenNMS
      11:02:37.542 [Main] INFO  org.opennms.install.Installer - * using 'opennms' as the PostgreSQL database name for OpenNMS
      11:02:37.542 [Main] INFO  org.opennms.core.schema.Migrator - validating database version
      11:02:38.025 [Main] INFO  org.opennms.core.schema.Migrator - validating database version
      11:02:38.543 [Main] INFO  org.opennms.core.schema.Migrator - adding PL/PgSQL support to the database, if necessary
      java.lang.reflect.InvocationTargetException
      ...
      Caused by: org.opennms.core.schema.MigrationException: an error occurred getting the version from the database
      	at org.opennms.core.schema.Migrator.createLangPlPgsql(Migrator.java:402)
      	at org.opennms.core.schema.Migrator.prepareDatabase(Migrator.java:868)
      	at org.opennms.core.schema.Migrator.setupDatabase(Migrator.java:978)
      	at org.opennms.install.Installer.install(Installer.java:240)
      	at org.opennms.install.Installer.main(Installer.java:987)
      	... 6 more
      Caused by: org.postgresql.util.PSQLException: FATAL: Invalid Username specified. Please check the Username and retry connection. The Username should be in <username@hostname> format.
      

      If I change the user-name for OpenNMS:

        <jdbc-data-source name="opennms"
                          database-name="opennms"
                          class-name="org.postgresql.Driver"
                          url="jdbc:postgresql://14.0.1.5:5432/opennms"
                          user-name="opennms@qa-env1-onms"
                          password="opennms" />
      

      I get:

      11:04:24.324 [Main] INFO  org.opennms.install.Installer - * using 'postgres@qa-env1-onms' as the PostgreSQL user for OpenNMS
      11:04:24.325 [Main] INFO  org.opennms.install.Installer - * using 'opennms' as the PostgreSQL database name for OpenNMS
      11:04:24.325 [Main] INFO  org.opennms.core.schema.Migrator - validating database version
      11:04:24.800 [Main] INFO  org.opennms.core.schema.Migrator - validating database version
      11:04:25.098 [Main] INFO  org.opennms.core.schema.Migrator - creating OpenNMS user, if necessary
      java.lang.reflect.InvocationTargetException
      ...
      Caused by: org.opennms.core.schema.MigrationException: an error occurred creating the OpenNMS user
      	at org.opennms.core.schema.Migrator.createUser(Migrator.java:457)
      	at org.opennms.core.schema.Migrator.prepareDatabase(Migrator.java:865)
      	at org.opennms.core.schema.Migrator.setupDatabase(Migrator.java:978)
      	at org.opennms.install.Installer.install(Installer.java:240)
      	at org.opennms.install.Installer.main(Installer.java:987)
      	... 6 more
      Caused by: org.postgresql.util.PSQLException: ERROR: syntax error at or near "@"
        Position: 20
      

      Attachments

        Activity

          People

            yangli Yang Li
            agalue Alejandro Galue
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: