Projects tigase _server server-core Issues #1431
Can not initialize postgres database (#1431)
Unknown opened 4 years ago

Describe the bug

On a fresh 8.1.1 installation, database schemas fail to initialize

To Reproduce

On a fresh installation (with or without first manually execiting sql files as per docs)

There is a single db user (so using same user/pass for root and tigase user) that has full permissions on an otherwise empty db.

config.tdsl:

admins = [
    'admin@example.vom'
]
'config-type' = 'default'
debug = [ 'server' ]
'default-virtual-host' = 'example.com'
dataSource () {
    default () {
        uri = 'jdbc:postgresql://postgres.example.com/tigase?user=abc-123&password=1234-abc&useSSL=false'
    }
}
http () {
    setup () {
        'admin-password' = 'secretsecret'
        'admin-user' = 'admin'
    }
}
pubsub () {
    trusted = [ 'http@{clusterNode}' ]
}
upload () {}
$ ./tigase.sh upgrade-schema /opt/tigase.conf -R ${DB_ROOT_USER} -A ${DB_ROOT_PASS}
Mar 11, 2021 12:55:24 PM tigase.db.util.SchemaManager loadSchemas
INFO: beginning loading schema files...
Mar 11, 2021 12:55:24 PM tigase.util.dns.DNSResolverDefault <init>
SEVERE: Retrieval of default hostnames failed! Most likely network misconfiguration problem,make sure the local hostname to whichever it is set does resolve to IP address,fallback to: localhost
java.net.UnknownHostException: 25365e843211: 25365e843211: No address associated with hostname
[...]

Mar 11, 2021 12:55:24 PM tigase.util.dns.DNSResolverDefault <init>
WARNING: Resolving default host name: localhost took: 9
[2021-03-11 12:55:25:486] [CONFIG  ] [                  main ] DBSchemaLoader.init()            : Parameters: [adminPassword: null, admins: null, dbHostname: postgres.example.com, dbName: tigase, dbPass: 1234-abc, dbRootPass: 1234-abc, dbRootUser: abc-123, dbType: postgresql, dbUser: abc-123, file: null, ingoreMissingFiles: false, logLevel: CONFIG, query: null, serverTimezone: null, useLegacyDatetimeCode: true, useSSL: false, forceReloadSchema: false, schemaDirectory: database/]
[2021-03-11 12:55:25:489] [INFO    ] [                  main ] DBSchemaLoader.validateDBConnection(): Validating DBConnection, URI: jdbc:postgresql://postgres.example.com/postgres?user=abc-123&password=1234-abc&useSSL=false
[2021-03-11 12:55:25:780] [INFO    ] [                  main ] DBSchemaLoader.validateDBConnection(): Connection OK
[2021-03-11 12:55:25:781] [INFO    ] [                  main ] DBSchemaLoader.validateDBExists(): Validating whether DB Exists, URI: jdbc:postgresql://postgres.example.com/tigase?user=abc-123&password=1234-abc&useSSL=false
[2021-03-11 12:55:25:792] [INFO    ] [                  main ] DBSchemaLoader.lambda$validateDBExists$9(): Exists OK
[2021-03-11 12:55:25:998] [CONFIG  ] [                  main ] DBSchemaLoader.init()            : Parameters: [adminPassword: null, admins: null, dbHostname: postgres.example.com, dbName: tigase, dbPass: 1234-abc, dbRootPass: 1234-abc, dbRootUser: abc-123, dbType: postgresql, dbUser: abc-123, file: null, ingoreMissingFiles: false, logLevel: CONFIG, query: null, serverTimezone: null, useLegacyDatetimeCode: true, useSSL: false, forceReloadSchema: false, schemaDirectory: database/]
[2021-03-11 12:55:25:999] [INFO    ] [                  main ] DBSchemaLoader.validateDBConnection(): Validating DBConnection, URI: jdbc:postgresql://postgres.example.com/postgres?user=abc-123&password=1234-abc&useSSL=false
[2021-03-11 12:55:26:007] [INFO    ] [                  main ] DBSchemaLoader.validateDBConnection(): Connection OK
[2021-03-11 12:55:26:007] [INFO    ] [                  main ] DBSchemaLoader.validateDBExists(): Validating whether DB Exists, URI: jdbc:postgresql://postgres.example.com/tigase?user=abc-123&password=1234-abc&useSSL=false
[2021-03-11 12:55:26:015] [INFO    ] [                  main ] DBSchemaLoader.lambda$validateDBExists$9(): Exists OK
[2021-03-11 12:55:26:016] [CONFIG  ] [                  main ] DBSchemaLoader.loadSchema()      : SchemaInfo:: id: common, repositories: 0; version: 0.0.3
[2021-03-11 12:55:26:027] [CONFIG  ] [                  main ] DBSchemaLoader.loadSchemaFromSQLFiles(): Loading schema common, version: 0.0.3 from files, current: 0.0.3
[2021-03-11 12:55:26:051] [INFO    ] [                  main ] DBSchemaLoader.loadSchema()      : Required schema is already loaded in correct version
Mar 11, 2021 12:55:26 PM tigase.db.util.SchemaManager lambda$loadSchemas$33
INFO: Required schema is already loaded in correct version
Mar 11, 2021 12:55:26 PM tigase.db.util.SchemaManager lambda$loadSchemas$33
INFO: Required schema is already loaded in correct version
Mar 11, 2021 12:55:26 PM tigase.db.util.SchemaManager lambda$loadSchemas$33
INFO: Required schema is already loaded in correct version
Mar 11, 2021 12:55:26 PM tigase.db.util.SchemaManager lambda$loadSchemas$33
INFO: Required schema is already loaded in correct version
Mar 11, 2021 12:55:26 PM tigase.db.util.SchemaManager lambda$loadSchemas$33
INFO: Required schema is already loaded in correct version
[2021-03-11 12:55:26:127] [WARNING ] [                  main ] DBSchemaLoader.addXmppAdminAccount(): Database schema is invalid
[2021-03-11 12:55:26:127] [WARNING ] [                  main ] DBSchemaLoader.postInstallation(): Database schema is invalid
Mar 11, 2021 12:55:26 PM tigase.db.util.SchemaManager loadSchemas
INFO: schema loading finished!




  =============================================================================
        Schema upgrade finished

  Data source: default with uri jdbc:postgresql://postgres.example.com/tigase?user=abc-123&password=1234-abc&useSSL=false
        Checking connection to database ok
        Checking if database exists     ok
        Loading Common Schema Files     skipped
                Message: Required schema is already loaded in correct version
        Skipping schema: Tigase Message Archiving Component, version: 2.1.0-b269/1a9d06e9 (database version: 2.1.0-b269)        skipped
        Skipping schema: Tigase XMPP Server (Core), version: 8.1.0-b5641/99fb6fd4 (database version: 8.1.0)     skipped
        Skipping schema: Tigase MUC Component, version: 3.1.1-b643/96806982 (database version: 3.1.1-b643)      skipped
        Skipping schema: Tigase HTTP API - File Upload, version: 2.1.0-b341/812469a6 (database version: 2.1.0-b341)     skipped
        Skipping schema: Tigase PubSub Component, version: 4.1.0-b715/821100fb (database version: 4.1.0)        skipped
        Adding XMPP admin accounts      error
                Message: Database schema is invalid
        Post installation action        error
                Message: Database schema is invalid
  =============================================================================

The web-gui wizard goes green or yellow on tyhe db initialization.

Impact

Can not run server

Expected behavior

DB initializes properly

Unknown commented 4 years ago

Can not run server

Could you share what error do you get when trying to start the server?

Could you also try preparing the database by running the script with complete log by adding -L ALL? i.e. /tigase.sh upgrade-schema /opt/tigase.conf -R ${DB_ROOT_USER} -A ${DB_ROOT_PASS} -L ALL?

The schema version loaded in the database seem to be ok though…

issue 1 of 1
Type
Bug
Issue Votes (0)
Watchers (0)
Reference
tigase/_server/server-core#1431
Please wait...
Page is in error, reload to recover