-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Installation Wizard not accepting database username and password #41074
Comments
I'm also seeing this behavior when trying to connect to a postgres instance.
Relevant portions of the version: '3.7'
services:
traefik:
image: traefik:1.7
command: --api --docker
ports:
- "80:80"
- "8080:8080" # webui
volumes:
- /var/run/docker.sock:/var/run/docker.sock
postgres:
image: postgres:10
ports:
- "5432:5432"
environment:
- POSTGRES_PASSWORD=xxx
- POSTGRES_DB=nc
- POSTGRES_USER=nc_user
volumes:
- /home/r2/docker/pg:/var/lib/postgresql/data:Z
nextcloud:
image: nextcloud:14-apache
depends_on:
- postgres
environment:
- POSTGRES_HOST=postgres
- POSTGRES_DB=nc
- POSTGRES_USER=nc_user
- POSTGRES_PASSWORD=xxx
- NEXTCLOUD_ADMIN_USER=ncadmin
- NEXTCLOUD_ADMIN_PASSWORD=xxx
volumes:
- /home/r2/docker/nc/config:/var/www/html/config:Z
labels:
- "traefik.frontend.rule=PathPrefixStrip:/cloud" It is clearing <?php
$CONFIG = array (
'htaccess.RewriteBase' => '/',
'memcache.local' => '\\OC\\Memcache\\APCu',
'apps_paths' =>
array (
0 =>
array (
'path' => '/var/www/html/apps',
'url' => '/apps',
'writable' => false,
),
1 =>
array (
'path' => '/var/www/html/custom_apps',
'url' => '/custom_apps',
'writable' => true,
),
),
'passwordsalt' => '9QepuB7yen9mfq7fI68YtEH/Xxnfh1',
'secret' => 'EUUKboZz+TazUhAoqo8qViG9qHbAdSQqd3B1JN1n87Cxqd9L',
'trusted_domains' =>
array (
0 => 'localhost',
),
'datadirectory' => '/var/www/html/data',
'dbtype' => 'pgsql',
'version' => '14.0.4.2',
'overwrite.cli.url' => 'http://localhost',
'dbname' => 'nc',
'dbhost' => 'postgres',
'dbport' => '',
'dbtableprefix' => '',
'dbuser' => 'oc_ncadmin60',
'dbpassword' => '77bzrlaciblcpn32msqh579vogykit',
); |
On a whim (suggested by #1793), I also checked with Further: I can connect to the database with |
@umardraz I think I found the culprit: nextcloud/docker#345 (comment) This worked for me (on postgres):
Since I'm on an easy test system, I didn't mind the security lapse. I have not (yet) tested with a production database, though my next step is to clone the real database and attempt an upgrade using this image. Wish me luck. For the record, I updated my version: '3.7'
services:
traefik:
image: traefik:1.7
command: --api --docker
ports:
- "80:80"
- "8080:8080" # webui
volumes:
- /var/run/docker.sock:/var/run/docker.sock
postgres:
image: postgres:9.5
ports:
- "5432:5432"
environment:
- POSTGRES_PASSWORD=xxx
- POSTGRES_DB=nc
- POSTGRES_USER=nc_user
volumes:
- /home/r2/docker/pg:/var/lib/postgresql/data:Z
nextcloud:
image: nextcloud:14-apache
depends_on:
- postgres
environment:
- POSTGRES_HOST=postgres
- POSTGRES_DB=nc
- POSTGRES_USER=nc_user
- POSTGRES_PASSWORD=xxx
- NEXTCLOUD_ADMIN_USER=ncadmin
- NEXTCLOUD_ADMIN_PASSWORD=xxx
- NEXTCLOUD_DATA_DIR=/var/lib/nextclouddata
volumes:
- /home/r2/docker/nc/config:/var/www/html/config:Z
- /home/r2/docker/nc/data:/var/lib/nextclouddata:Z
labels:
- "traefik.frontend.rule=PathPrefixStrip:/cloud" and <?php
$CONFIG = array (
'htaccess.RewriteBase' => '/',
'memcache.local' => '\\OC\\Memcache\\APCu',
'apps_paths' =>
array (
0 =>
array (
'path' => '/var/www/html/apps',
'url' => '/apps',
'writable' => false,
),
1 =>
array (
'path' => '/var/www/html/custom_apps',
'url' => '/custom_apps',
'writable' => true,
),
),
'passwordsalt' => 'k9DL+pteWJB6AaSpHiCskeb0+8CUds',
'secret' => 'YvBvUcScMOS+3pzy9m9yzs64mPb4QYrJgwXLyWQThEtMTh/F',
'trusted_domains' =>
array (
0 => 'localhost',
),
'datadirectory' => '/var/lib/nextclouddata',
'dbtype' => 'pgsql',
'version' => '14.0.4.2',
'overwrite.cli.url' => 'http://localhost/cloud',
'dbname' => 'nc',
'dbhost' => 'postgres',
'dbport' => '',
'dbtableprefix' => '',
'dbuser' => 'oc_ncadmin7',
'dbpassword' => 'NC-created-xxx',
'installed' => true,
'instanceid' => 'ocx15d26bvrw',
'overwritewebroot' => '/cloud',
); Notice that NC still over-rode my |
I have the same problem as @r2evans. This problem is only there if you choose postgresql, with MariaDB all is fine. The problem is in the |
Am also having the same issue as @r2evans . Am using postgresql, docker-compose. I appear to be unable to set a custom dbuser or dbpassword with environmental variables. Are the Environmental labels POSTGRES_USER and POSTGRES_PASSWORD as listed in the README incorrect? |
now is version 18 and no fix :-( maybe problem is that in
and
Update: |
If I specifically tell Nextcloud to use certain database credentials, why does it create a completely separate user behind my back and uses it instead? What is the logic behind this? Here is what happened as a result of it:
This is the last straw for me. Nextcloud bricked itself twice in a week. It's simply too fragile for me, and I can't sink more evenings into getting it to work again. |
@nicbou note that you may also want to go back and remove the auto-created user. FWIW, to prevent you from having to install a text editor, with some practice you can do it with sed -i -e "s/.*'dbuser'.*/'dbuser' => 'newuser',/g; s/.*'dbpassword'.*/'dbpassword' => 'newpass',/g" config/config.php This capitalizes on the assumption that each key/value pair is isolated on a line, and assumes (safely, I believe) that no other field contains the literals # docker exec -it mynextcloud bash
root@ffc242067596:/var/www/html# diff -u config/config.php <(sed -e "s/.*'dbuser'.*/'dbuser' => 'newuser',/g; s/.*'dbpassword'.*/'dbpassword' => 'newpass',/g" config/config.php)
--- config/config.php 2020-12-14 01:51:52.534286458 +0000
+++ /dev/fd/63 2020-12-14 18:07:27.032281130 +0000
@@ -40,8 +40,8 @@
'dbhost' => 'postgres',
'dbport' => '',
'dbtableprefix' => 'oc_',
- 'dbuser' => 'olduser',
- 'dbpassword' => 'oldpassword',
+'dbuser' => 'newuser',
+'dbpassword' => 'newpass',
'installed' => true,
'overwritehost' => 'oc.activedecisionsupport.com',
'overwritewebroot' => '/cloud', |
@r2evans , I updated my comment with a longer description of the catastrophe this led to. Editing the config indeed fixes the credentials, but it won't bring the data back. Nonetheless, thank you for your quick reply and assistance. |
Oooof, that's a frustrating sequence of events. I agree that NC installation seems to be a bit fragile, and I'm a bit frustrated that there has been no discussion or attention from NC on this in a couple of years, focusing instead on adding third-party integration (that will be lost when nextcloud needs to be re-instantiated). |
This seems not only related to the Docker setup but generally regarding the server – we should transfer the issue to the server repo? cc @rullzer @MorrisJobke |
This is still an issue for me. Seems to be a race condition in the entrypoint, or how the server handles the installation process. What should happen is that the installation tries again with the exact same settings. Seems like instead, it tries to get smart with it and that's causing problems. While this does seem to be an issue with how the installer handles things, the docker image could still implement a better method of waiting on the server that doesn't involve calling the installer repeatedly. I overrode the entrypoint by mounting in my own, and used wait-for-it.sh to wait on the DB connection before the installer got called. This fixed the issue for me, but overriding the entrypoint is bad practice. |
…n fails if DB is not ready in time.
…n fails if DB is not ready in time. Signed-off-by: Daniel Hodgson <toasty27@gmail.com>
Related: #36428 |
Closing this for the following reasons:
Refs: |
Hello
The Installation wizard is not picking mysql information Here is the information what I had provided through environment variables.
On the first run the installation appears and asked for crate an admin account.
But when I clicked on Finish setup button then an error appears.
Error while trying to create admin user: Failed to connect to the database: An exception occured in driver: SQLSTATE[HY000] [1044] Access denied for user ‘oc_admin15’@’%’ to database ‘client1’
Don't know why it is not accepting username and password, the other options are ok, like dbname, dbhost.
Would you please any body help me.
The text was updated successfully, but these errors were encountered: