Closed 2fst4u closed 6 months ago
I should also add, when I am attempting to restart the install I am deleting all pods and deleting the data PVC entirely. The only place and data might still be stored is in the postgres pods right? But if it can't even connect then why would it be incrementing the user name? Could it be the pgpool pods?
I'm also quite confused about why ocncadmin is used as the user when I am specifying "postgres" as the database user in my secret. Can anyone explain where this oc username comes from?
The postgres user is being passed to the pod:
root@nextcloud-64c4ffb77d-vwws8:/var/www/html# printenv
POSTGRES_HOST=postgres-postgresql-ha-pgpool.database:5432
POSTGRES_PASSWORD=passwordhere
NEXTCLOUD_ADMIN_USER=ncadmin
POSTGRES_USER=postgres
POSTGRES_DB=postgres
Aha new information:
root@nextcloud-64c4ffb77d-vwws8:/var/www/html# cat config/config.php
...
'dbuser' => 'oc_ncadmin48',
So it's getting it from my config.php. But why when I'm injecting the username through the helm chart?
I'm not even sure if the postgres password in the config.php is correct at this point, it seems hashed or encrypted so I can't tell.
Changing externalDatabase.existingSecret.enabled
back to false and removing the other existing secret lines injects the correct user, so something with the existing secret isn't working.
I thought I was onto something but I'm right back at square one. I decided to override the config.php with the following:
db.config.php: |-
<?php
$CONFIG = array (
'dbtype' => 'pgsql',
'dbname' => getenv('POSTGRES_DB'),
'dbuser' => getenv('POSTGRES_USER'),
'dbpassword' => getenv('POSTGRES_PASSWORD'),
'dbhost' => getenv('POSTGRES_HOST'),
);
And additional Envars:
extraEnv:
- name: POSTGRES_DB
valueFrom:
secretKeyRef:
name: nextcloud-secret
key: db-database
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: nextcloud-secret
key: db-password
- name: POSTGRES_USER
valueFrom:
secretKeyRef:
name: nextcloud-secret
key: db-username
- name: POSTGRES_HOST
valueFrom:
secretKeyRef:
name: nextcloud-secret
key: db-host
And edit the defaultConfigs:
to:
autoconfig.php: false
Which worked fine, my config.php now shows the following (relevant) values:
$CONFIG = array (
'dbtype' => 'pgsql',
'dbname' => 'postgres',
'dbuser' => 'postgres',
'dbpassword' => 'correctpasswordhere',
'dbhost' => 'postgres-postgresql-ha-pgpool.database:5432',
'dbport' => '',
'dbtableprefix' => 'oc_',
);
But when it starts and attempts to initialise I still get the following logs:
Initializing nextcloud 28.0.0.11 ...
New nextcloud instance
Installing with PostgreSQL database
=> Searching for scripts (*.sh) to run, located in the folder: /docker-entrypoint-hooks.d/pre-installation
Starting nextcloud installation
PostgreSQL username and/or password not valid
-> You need to enter details of an existing account.
Trace: #0 /var/www/html/lib/private/Setup.php(356): OC\Setup\PostgreSQL->setupDatabase('ncadmin')
#1 /var/www/html/core/Command/Maintenance/Install.php(113): OC\Setup->install(Array, NULL)
#2 /var/www/html/3rdparty/symfony/console/Command/Command.php(298): OC\Core\Command\Maintenance\Install->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#3 /var/www/html/3rdparty/symfony/console/Application.php(1040): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#4 /var/www/html/3rdparty/symfony/console/Application.php(301): Symfony\Component\Console\Application->doRunCommand(Object(OC\Core\Command\Maintenance\Install), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#5 /var/www/html/3rdparty/symfony/console/Application.php(171): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#6 /var/www/html/lib/private/Console/Application.php(206): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#7 /var/www/html/console.php(100): OC\Console\Application->run()
#8 /var/www/html/occ(11): require_once('/var/www/html/c...')
#9 {main}
Previous: Doctrine\DBAL\Exception: Failed to connect to the database: An exception occurred in the driver: SQLSTATE[08006] [7] connection to server at "postgres-postgresql-ha-pgpool.database" (10.43.251.141), port 5432 failed: FATAL: SCRAM authentication failed
DETAIL: pool_passwd file does not contain an entry for "oc_ncadmin109"
Trace: #0 /var/www/html/lib/private/Setup/PostgreSQL.php(112): OC\DB\Connection->connect()
#1 /var/www/html/lib/private/Setup.php(356): OC\Setup\PostgreSQL->setupDatabase('ncadmin')
#2 /var/www/html/core/Command/Maintenance/Install.php(113): OC\Setup->install(Array, NULL)
#3 /var/www/html/3rdparty/symfony/console/Command/Command.php(298): OC\Core\Command\Maintenance\Install->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#4 /var/www/html/3rdparty/symfony/console/Application.php(1040): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#5 /var/www/html/3rdparty/symfony/console/Application.php(301): Symfony\Component\Console\Application->doRunCommand(Object(OC\Core\Command\Maintenance\Install), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#6 /var/www/html/3rdparty/symfony/console/Application.php(171): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#7 /var/www/html/lib/private/Console/Application.php(206): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#8 /var/www/html/console.php(100): OC\Console\Application->run()
#9 /var/www/html/occ(11): require_once('/var/www/html/c...')
#10 {main}
with a new oc_ncadmin user. I do note at the start it is actually saying setupDatabase('ncadmin')
which it also was before, which is strange. Why is it not using my postgres user value now that it is correct in the config?
It seems Nextcloud just isn't compatible with pgpool. I've deleted this and can no longer troubleshoot further.
Describe your Issue
I've changed to an ha postgres setup, with pgpool using bitnami's postgresql-ha helm chart. I'm using this postgres database with another application but when I go to install nextcloud on first start it gives the following errors:
Logs and Errors
Which says
pool_passwd file does not contain an entry for "oc_ncadmin13"
but the user shouldn't be oc_ncadmin13, it should just be oc_ncadmin. I have added oc_ncadmin to the passwd file but every time I try to restart the install the user it attempts to authenticate with increments. Why is it adding a number to the end of the user each time?Describe your Environment
K3s
Helm Version (or App that manages helm): I'm not even sure, i use flux.io to create helm deployments.
helm version
says helm isn't installed on my k3s nodes so I don't know how it works. I'm using a lot of helm charts from other places though.Helm Chart Version: 4.5.9
values.yaml
:Additional context, if any
On the pgpool pods:
As you can see oc_ncadmin is there