-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Unable to connect to Postgres with docker-compose #345
Comments
I got it to work with the following compose file:
I was initially giving the As I understand you have to pass a postgres superuser to the nextcloud image. The installer will create the database and even a specific user to access it. |
Just ran into the same issue, thank you for the explanation 😁 |
This issue is apparently present in our examples section and comes up a couple of times. I will join the bug requests in this issue. |
@SnowMB Hey, Marc. I just saw your commits to fix this bug with set |
@SnowMB for the record, with the same docker-compose file, I have machines where I have this problem and others where I don't. I have no idea what is the difference between those (they use the same version of docker, and those failing are using docker-compose 1.21.1 while the working one is using 1.22.0 but I don't think this is the source of the problem...). This is with The docker-compose is:
(nginx is for example https://raw.githubusercontent.com/nextcloud/docker/master/.examples/docker-compose/insecure/mariadb/fpm/web/nginx.conf). |
To be completely clear, I'm having the same error as in #287. |
@victornoel Yeah. I also found there is a little probability of success. Sometimes failed, sometimes succeeded. Of course, usually failed. But if you have succeeded, it would be no problems for a long time. Very interesting and confused. Not easy to reproduce. |
A big thank you to Beenje for his docker-compose.yml file ! Like him, instead of using a single db.env file, as suggested in docker-compose examples, I use one per service : db-app.env and db-db.env
Below the docker-compose.yml that works:
I tried different solutions for several hours, but still in vain ... for example, the following db.env, used in both services, db and app:
generates the following error:
And in /var/www/html/data/nextcloud.log, we can observe the absence of user ("user":"--"), that the variable POSTGRES_USER is set to postgres or to nextcloud. {"reqId":"DWMRPtu3TjDtVoiSY09H","level":2,"time":"2018-10-23T10:54:36+00:00","remoteAddr":"172.18.0.1","user":"--","app":"no app in context","method":"POST","url":"/index.php","message":"Error occurred while checking PostgreSQL version, assuming >= 9","userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/69.0.3497.81 Chrome/69.0.3497.81 Safari/537.36","version":"13.0.7.2"} which probably explains the error: "User does not have CONNECT privilege." |
Based on this issue in upstream Nextcloud Server(nextcloud/server#11311), the bug is triggered by some 10.X update in postgres docker images, which fixed another bug. The current workaround, until Nextcloud Server is fixed, is to add an environment variable to the postgres container. It is important that the variable is only applied to the postgres container, as that is the whole workaround. The environment variable to add to the postgres container ONLY is the following; Same problem seems to occur with postgres:9, so some 9.X update affected this as well. |
@oddsund did sum it up pretty well. My pr just aims to add the workaround for our existing examples so that they work out of the box. Nothing more, nothing less. For a real solution to this issue we have to wait for upstream to fix this. |
I got the same issue with the example postgres/fpm docker-compose.yml. Adding Another workaround is:
|
following nextcloud/docker#345 I changed some setting in nextcloud in order to have it writing on postgis
It does NOT work for me:
Results in:
|
Anyone already found a solution? Tried to setup nextcloud with the docker-compose example in ".examples/docker-compose/with-nginx-proxy/postgres/fpm", but failed. |
We have the same problem with and if the database already exists in the postgres, then the installer failed. If the database does not yet exist, the installer will run without any problem. In earlier installations the installer ran with an existing database without any problems. Is there a time point to fix this in the installer for postgres? |
Facing same issue when trying to run nextcloud on k8s with postgres as a data source. I could probably live without creating database by postgres container (thus having extra instance of postgres only for nextcloud purposes) but nextcloud should be able to at least reuse database which has been created by his other pod (for example if original pod fails). |
@Ofinka here's a working environment using postgresql
I'm proxying the dockerized nginx into an external (local nginx installed on the server + letsencrypt) keep in mind that you must keep POSTGRES_USER in both containers set to hope this helps P.S: i know working with the user |
there is something very wrong with user/password handling on either the nextcloud or the postgres side. So this doesn't actually work. I suspect I've hit nextcloud/docker#345
When trying to set up nextcloud it keeps telling me that it can't connect to the database, or that password authentication failed for user 'postgres'. (I can connect via psql so the username/password is correct)
The text was updated successfully, but these errors were encountered: