Skip to content
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

(Postgres) User does not have CONNECT privilege. #287

Closed
tateisu opened this issue Mar 21, 2018 · 2 comments
Closed

(Postgres) User does not have CONNECT privilege. #287

tateisu opened this issue Mar 21, 2018 · 2 comments

Comments

@tateisu
Copy link

tateisu commented Mar 21, 2018

from nextcloud/server#8915

Steps to reproduce

when trying '13-apache' docker image with database container 'postgres:9.6-alpine'.
I was experienced error on setup form.

Error while trying to create admin user: 
Failed to connect to the database: An exception occured in driver: 
SQLSTATE[08006] [7] FATAL: permission denied for database "postgres" 
DETAIL: User does not have CONNECT privilege. 

form parameters:
admin name: tateisu_admin
admin password: (randomly generated password)
data folder: /var/www/html/data
database type] postgres
db user: postgres
db password: (pre-defined password for postgres database user )
db name: postgres
db host: db (same as service name in docker-compose.yml )

then checking detabase user, app creates role for admin user for each I try setup.

postgres=# \du
                                       List of roles
     Role name     |                         Attributes                         | Member of 
-------------------+------------------------------------------------------------+-----------
 oc_tateisu_admin  | Create DB                                                  | {}
 oc_tateisu_admin2 | Create DB                                                  | {}
 oc_tateisu_admin3 | Create DB                                                  | {}
 oc_tateisu_admin4 | Create DB                                                  | {}
 postgres          | Superuser, Create role, Create DB, Replication, Bypass RLS | {}

How to avoid this error?

Expected behaviour

  • complete setup page.

Actual behaviour

  • setup form raises error.

Server configuration

my docker-compose.yml is here.

version: '2'
services:

  db:
    restart: always
    image: postgres:9.6-alpine
    volumes:
      - ../postgres:/var/lib/postgresql/data

  nextcloud:
    image: nextcloud:13-apache
    restart: always
    ports:
      - "172.17.0.1:8003:80"
    volumes:  
      - /etc/localtime:/etc/localtime:ro
      - ../data:/var/www/html
    depends_on:
      - db

Operating system:
Ubuntu 16.04.2 LTS x64

Web server:
nginx

Database:
'postgres:9.6-alpine' container

PHP version:
Nextcloud version: (see Nextcloud admin page)
official docker container '13-apache'

Updated from an older Nextcloud/ownCloud or fresh install:
fresh install

@tilosp
Copy link
Member

tilosp commented Mar 21, 2018

The problem is that you use postgres as the user and database. The build in root user of PostgreSQL is called postgres. And the db called postgres is used by PostgreSQL to store users and other stuff.

Because of this you have to create a user and a database for nextcloud. This can be done using environment variables. Take a look at https://hub.docker.com/_/postgres/ and https://github.com/nextcloud/docker/blob/master/.examples/ our example section.

@tateisu
Copy link
Author

tateisu commented Mar 21, 2018

Thanks, the problem is solved with trying https://github.com/nextcloud/docker/blob/master/.examples/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants