To be more precise about the errors you reported till now:
Are you really sure that the database instance you created has the user MxAdmin with T3stP4ssword?
In postgres-deployment.yaml file, the DB related env must be set properly. The same username and password must be used in your DB end point URL.
Also please check the database URL.
env:
- name: POSTGRES_DB
value: db0
- name: POSTGRES_USER
value: mendix
- name: POSTGRES_PASSWORD
value: mendix
Thanks for your response. When I use the username and password then I get the following error:
INFO - Services: Adding 0 authority certificate(s)
ERROR - M2EE: An error occurred while initializing the Runtime: Error on initializing database connection.
ERROR - M2EE: com.mendix.m2ee.api.AdminException: An error occurred while initializing the Runtime: Error on initializing database connection.
at com.mendix.basis.impl.MxRuntimeImpl.start(MxRuntimeImpl.java:428)
Caused by: com.mendix.connectionbus.ConnectionBusRuntimeException: Error on initializing database connection.
at com.mendix.connectionbus.ConnectionBusInitializer.throwDefault$1(ConnectionBusInitializer.scala:58)
Caused by: org.postgresql.util.PSQLException: FATAL: database "mendix" does not exist
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2440)
at org.postgresql.core.v3.QueryExecutorImpl.readStartupMessages(QueryExecutorImpl.java:2559)
at org.postgresql.core.v3.QueryExecutorImpl.<init>(QueryExecutorImpl.java:133)
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:250)
at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:49)
at org.postgresql.jdbc.PgConnection.<init>(PgConnection.java:195)
at org.postgresql.Driver.makeConnection(Driver.java:454)
at org.postgresql.Driver.connect(Driver.java:256)
at java.sql/java.sql.DriverManager.getConnection(Unknown Source)
at java.sql/java.sql.DriverManager.getConnection(Unknown Source)
at org.postgresql.ds.common.BaseDataSource.getConnection(BaseDataSource.java:94)
at org.postgresql.ds.common.BaseDataSource.getConnection(BaseDataSource.java:79)
at org.apache.commons.dbcp2.DataSourceConnectionFactory.createConnection(DataSourceConnectionFactory.java:83)
at org.apache.commons.dbcp2.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:355)
at org.apache.commons.pool2.impl.GenericObjectPool.create(GenericObjectPool.java:874)
at org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:417)
at org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:346)
at org.apache.commons.dbcp2.PoolingDataSource.getConnection(PoolingDataSource.java:134)
at com.mendix.connectionbus.connections.jdbc.ConnectionManager.getConnection(ConnectionManager.java:49)
at com.mendix.connectionbus.ConnectionBusInitializer.$anonfun$createConnection$1(ConnectionBusInitializer.scala:52)
at scala.util.Try$.apply(Try.scala:213)
at com.mendix.connectionbus.ConnectionBusInitializer.retry(ConnectionBusInitializer.scala:60)
at com.mendix.connectionbus.ConnectionBusInitializer.createConnection(ConnectionBusInitializer.scala:52)
at com.mendix.connectionbus.ConnectionBusInitializer.initialize(ConnectionBusInitializer.scala:42)
at com.mendix.connectionbus.ConnectionBusImpl.initialize(ConnectionBusImpl.java:350)
at com.mendix.basis.impl.MxRuntimeImpl.initializeConnectionBus(MxRuntimeImpl.java:569)
at com.mendix.basis.impl.MxRuntimeImpl.start(MxRuntimeImpl.java:396)
at com.mendix.m2ee.appcontainer.actions.StartAction.startRuntime(StartAction.java:49)
at com.mendix.m2ee.appcontainer.actions.StartAction.execute(StartAction.java:30)
at com.mendix.m2ee.appcontainer.server.handler.HttpAdminHandler.handle(HttpAdminHandler.java:129)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
at org.eclipse.jetty.server.Server.handle(Server.java:502)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:364)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:260)
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:305)
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103)
at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:118)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:333)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:310)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:168)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:126)
at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:366)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:765)
at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:683)
at java.base/java.lang.Thread.run(Unknown Source)
ERROR: Executing start did not succeed: result: 1, message: An error occurred while initializing the Runtime: Error on initializing database connection., caused by: Error on initializing database connection.
WARNING: start failed, stopping
INFO: stopping app...
INFO: Waiting for the application to shutdown...
INFO - Core: Mendix Runtime is shutting down now...
INFO - Core: Mendix Runtime is now shut down.
INFO: The application has been stopped successfully.
And for reference here are my postgres env:
env:
- name: POSTGRES_DB
value: db0
- name: POSTGRES_USER
value: mendix
- name: POSTGRES_PASSWORD
value: mendix
& in my mendix-app yaml:
env:
- name: ADMIN_PASSWORD
value: mendix
- name: DATABASE_ENDPOINT
value: postgres://mendix:mendix@172.17.0.4:5432/mendix
In the postgres env, you configured the database as db0. Change that value to mendix.
Or change the database_endpoint to postgres://mendix:mendix@172.17.0.4:5432/db0
Then it should work
Thanks for your help so far. I get the same error as in my first post, unfortunately. I initially got an error that the password needed 8 characters, so I changed it from mendix to MendixP4ssword! .
Logs from mendix pod:
WARNING - ConnectionBus: Database connections: 0 active, 0 idle.
ERROR - ConnectionBus: Opening JDBC connection to Some(172.17.0.4:5432) failed with SQLState: 28P01 Error code: 0 Message: FATAL: password authentication failed for user "mendix" Retrying...(1/4)
WARNING - ConnectionBus: Database connections: 0 active, 0 idle.
ERROR - ConnectionBus: Opening JDBC connection to Some(172.17.0.4:5432) failed with SQLState: 28P01 Error code: 0 Message: FATAL: password authentication failed for user "mendix" Retrying...(2/4)
WARNING - ConnectionBus: Database connections: 0 active, 0 idle.
ERROR - ConnectionBus: Opening JDBC connection to Some(172.17.0.4:5432) failed with SQLState: 28P01 Error code: 0 Message: FATAL: password authentication failed for user "mendix" Retrying...(3/4)
WARNING - ConnectionBus: Database connections: 0 active, 0 idle.
ERROR - ConnectionBus: Opening JDBC connection to Some(172.17.0.4:5432) failed with SQLState: 28P01 Error code: 0 Message: FATAL: password authentication failed for user "mendix", giving up...(4/4)
ERROR - M2EE: An error occurred while initializing the Runtime: Error on initializing database connection.
ERROR - M2EE: com.mendix.m2ee.api.AdminException: An error occurred while initializing the Runtime: Error on initializing database connection.
at com.mendix.basis.impl.MxRuntimeImpl.start(MxRuntimeImpl.java:428)
Logs from postgres pod:
$ kubectl logs postgres-76546884d7-p2ccw
2020-08-03 09:40:42.375 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432
2020-08-03 09:40:42.375 UTC [1] LOG: listening on IPv6 address "::", port 5432
2020-08-03 09:40:42.383 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2020-08-03 09:40:42.390 UTC [22] LOG: database system was shut down at 2020-08-03 09:39:26 UTC
2020-08-03 09:40:42.393 UTC [1] LOG: database system is ready to accept connections
2020-08-03 09:41:15.382 UTC [30] FATAL: password authentication failed for user "mendix"
2020-08-03 09:41:15.382 UTC [30] DETAIL: Password does not match for user "mendix".
Connection matched pg_hba.conf line 95: "host all all all md5"
& my mendix-app.yaml:
env:
- name: ADMIN_PASSWORD
value: MendixP4ssword!
- name: DATABASE_ENDPOINT
value: postgres://mendix:MendixP4ssword!@172.17.0.4:5432/db0
& my postgres-deployment.yaml:
env:
- name: POSTGRES_DB
value: db0
- name: POSTGRES_USER
value: mendix
- name: POSTGRES_PASSWORD
value: MendixP4ssword!