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

Fresh installation shows DB Connection error #86

Open
lfarndt opened this issue Dec 23, 2021 · 4 comments
Open

Fresh installation shows DB Connection error #86

lfarndt opened this issue Dec 23, 2021 · 4 comments
Assignees
Labels

Comments

@lfarndt
Copy link

lfarndt commented Dec 23, 2021

Describe the bug
I just cloned the repo and edited docker-compose.yml

When i first start it witch docker-compose up i got errors
config_db.php not found.

So i copied them as in the Demo description

errors went away.

No i get errors, when i click on the gitlab button on mattermost.

nginx_1 | 2021/12/23 15:26:52 [notice] 1#1: start worker process 26 nginx_1 | 2021/12/23 15:26:52 [notice] 1#1: start worker process 27 nginx_1 | 2021/12/23 15:26:52 [notice] 1#1: start worker process 28 nginx_1 | 2021/12/23 15:26:52 [notice] 1#1: start worker process 29 nginx_1 | 2021/12/23 15:26:52 [notice] 1#1: start worker process 30 nginx_1 | 2021/12/23 15:26:52 [notice] 1#1: start worker process 31 php_1 | NOTICE: PHP message: PHP Fatal error: Uncaught PDOException: SQLSTATE[08006] [7] could not connect to server: Connection refused php_1 | Is the server running on host "127.0.0.1" and accepting php_1 | TCP/IP connections on port 5432? in /var/www/html/oauth/OAuth2/Storage/Pdo.php:67 php_1 | Stack trace: php_1 | #0 /var/www/html/oauth/OAuth2/Storage/Pdo.php(67): PDO->__construct() php_1 | #1 /var/www/html/oauth/server.php(14): OAuth2\Storage\Pdo->__construct() php_1 | #2 /var/www/html/oauth/authorize.php(11): require_once('...') php_1 | #3 {main} php_1 | thrown in /var/www/html/oauth/OAuth2/Storage/Pdo.php on line 67 php_1 | 192.168.128.4 - 23/Dec/2021:15:27:01 +0000 "GET /oauth/authorize.php" 500 nginx_1 | 2021/12/23 15:27:01 [error] 25#25: *1 FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught PDOException: SQLSTATE[08006] [7] could not connect to server: Connection refused nginx_1 | Is the server running on host "127.0.0.1" and accepting nginx_1 | TCP/IP connections on port 5432? in /var/www/html/oauth/OAuth2/Storage/Pdo.php:67 nginx_1 | Stack trace: nginx_1 | #0 /var/www/html/oauth/OAuth2/Storage/Pdo.php(67): PDO->__construct() nginx_1 | #1 /var/www/html/oauth/server.php(14): OAuth2\Storage\Pdo->__construct() nginx_1 | #2 /var/www/html/oauth/authorize.php(11): require_once('...') nginx_1 | #3 {main}

@Crivaledaz
Copy link
Owner

Hi,

You are right, there is a lack of documentation about the config_db.php and the config_ldap.php, which need to be copied before starting the docker-compose, as it is described for the Demo. These files depend on parameters defined in the environment part in the docker-compose file. Be sure values correspond with your deployment. After that, the docker-compose should work fine.

According to your logs, the php container does not reach the postgres container. Maybe the database has not been initialized or the container is not up. Can you check the container's status and the postgres logs ?

docker ps -a
docker logs db_1

Beside, have you tried the Demo docker-compose ? Do you have the same problem with it ?

Merry christmas

@lfarndt
Copy link
Author

lfarndt commented Dec 25, 2021

Hi,
starting the demo gives an error to me

`Starting demo_ldap_1 ...
demo_php_1 is up-to-date
demo_db_1 is up-to-date
demo_mattermost_1 is up-to-date
Starting demo_ldap_1 ... error

ERROR: for demo_ldap_1 Cannot start service ldap: OCI runtime create failed: container_linux.go:349: starting container process caused "process_linux.go:449: container init caused "write sysctl key kernel.domainname: open /proc/sys/kernel/domainname: permission denied"": unknown

ERROR: for ldap Cannot start service ldap: OCI runtime create failed: container_linux.go:349: starting container process caused "process_linux.go:449: container init caused "write sysctl key kernel.domainname: open /proc/sys/kernel/domainname: permission denied"": unknown
ERROR: Encountered errors while bringing up the project.`

docker ps -a |grep mattermost-ldap

2b3db0af343e nginx "/docker-entrypoint.…" 33 seconds ago Up 29 seconds 0.0.0.0:8080->80/tcp, 0.0.0.0:4430->443/tcp mattermost-ldap_nginx_1 b191cc2f7def php-ldap-pgsql "docker-php-entrypoi…" 37 seconds ago Up 33 seconds 9000/tcp mattermost-ldap_php_1 7f4bf04bff5f postgres:alpine "docker-entrypoint.s…" 37 seconds ago Up 33 seconds 5432/tcp mattermost-ldap_db_1

`docker logs mattermost-ldap_db_1

PostgreSQL Database directory appears to contain a database; Skipping initialization

2021-12-25 13:02:25.165 UTC [1] LOG: starting PostgreSQL 14.1 on x86_64-pc-linux-musl, compiled by gcc (Alpine 10.3.1_git20211027) 10.3.1 20211027, 64-bit
2021-12-25 13:02:25.165 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432
2021-12-25 13:02:25.165 UTC [1] LOG: listening on IPv6 address "::", port 5432
2021-12-25 13:02:25.580 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2021-12-25 13:02:26.042 UTC [21] LOG: database system was shut down at 2021-12-25 13:00:25 UTC
2021-12-25 13:02:26.177 UTC [1] LOG: database system is ready to accept connections
`

@lfarndt
Copy link
Author

lfarndt commented Dec 25, 2021

I solved the problem of the not starting ldap demo container with commenting ou domain and hostname in docker-compose.yml.

I installed a fresh docker host vm and cloned the repo.

The demo seems to throw the same error.

root@docker-2:/home/wolfgang/Mattermost-LDAP/Demo# docker logs demo_php_1 [25-Dec-2021 15:27:05] NOTICE: fpm is running, pid 1 [25-Dec-2021 15:27:05] NOTICE: ready to handle connections NOTICE: PHP message: PHP Fatal error: Uncaught PDOException: SQLSTATE[08006] [7] could not connect to server: Connection refused 172.18.0.3 - 25/Dec/2021:15:50:43 +0000 "GET /oauth/authorize.php" 500 Is the server running on host "127.0.0.1" and accepting TCP/IP connections on port 5432? in /var/www/html/oauth/OAuth2/Storage/Pdo.php:67 Stack trace: #0 /var/www/html/oauth/OAuth2/Storage/Pdo.php(67): PDO->__construct() #1 /var/www/html/oauth/server.php(14): OAuth2\Storage\Pdo->__construct() #2 /var/www/html/oauth/authorize.php(11): require_once('...') #3 {main} thrown in /var/www/html/oauth/OAuth2/Storage/Pdo.php on line 67 root@docker-2:/home/wolfgang/Mattermost-LDAP/Demo#

@Crivaledaz
Copy link
Owner

Hi,

I have pushed a patch for the issue #91 and I think your issue could be related.

I was also getting a database connection error and an LDAP connection error with the demo before the patch, and now it is solved. Please refer to issue #91 for more details.

Can you try with my latest commit ? Let me know if it solves your issue.

Regards

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

No branches or pull requests

2 participants