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 not accepting connections #1379

Closed
dustinleblanc opened this Issue Feb 2, 2019 · 3 comments

Comments

Projects
None yet
2 participants
@dustinleblanc
Copy link
Member

dustinleblanc commented Feb 2, 2019

Tell us about your setup

What is your lando version and operating system? v3.0.0-rc.2 on OSX

name: allura
recipe: laravel
env:
  - .env
config:
  config:
  php: '7.2'
  via: nginx
  webroot: public
  database: postgres
  cache: redis
services:
  node:
    type: node:10
tooling:
  yarn:
    service: node

Tell us about the command you were running

lando artisan migrate:refresh --seed

Tell us about the error you got

  Illuminate\Database\QueryException  : SQLSTATE[08006] [7] could not connect to server: Connection refused
        Is the server running on host "database" (172.25.0.4) and accepting
        TCP/IP connections on port 5432? (SQL: select * from information_schema.tables where table_schema = public and table_name = migrations)

  at /app/vendor/laravel/framework/src/Illuminate/Database/Connection.php:664
    660|         // If an exception occurs when attempting to run a query, we'll format the error
    661|         // message to include the bindings with SQL, which will make this exception a
    662|         // lot more helpful to the developer instead of just the database's errors.
    663|         catch (Exception $e) {
  > 664|             throw new QueryException(
    665|                 $query, $this->prepareBindings($bindings), $e
    666|             );
    667|         }
    668|

  Exception trace:

  1   PDOException::("SQLSTATE[08006] [7] could not connect to server: Connection refused
        Is the server running on host "database" (172.25.0.4) and accepting
        TCP/IP connections on port 5432?")
      /app/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:70

  2   PDO::__construct("pgsql:host=database;dbname=laravel;port=5432;sslmode=prefer", "laravel", "laravel", [])
      /app/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:70

  Please use the argument -v to see more details.

   Illuminate\Database\QueryException  : SQLSTATE[08006] [7] could not connect to server: Connection refused
        Is the server running on host "database" (172.25.0.4) and accepting
        TCP/IP connections on port 5432? (SQL: select * from information_schema.tables where table_schema = public and table_name = migrations)

  at /app/vendor/laravel/framework/src/Illuminate/Database/Connection.php:664
    660|         // If an exception occurs when attempting to run a query, we'll format the error
    661|         // message to include the bindings with SQL, which will make this exception a
    662|         // lot more helpful to the developer instead of just the database's errors.
    663|         catch (Exception $e) {
  > 664|             throw new QueryException(
    665|                 $query, $this->prepareBindings($bindings), $e
    666|             );
    667|         }
    668|

  Exception trace:

  1   PDOException::("SQLSTATE[08006] [7] could not connect to server: Connection refused
        Is the server running on host "database" (172.25.0.4) and accepting
        TCP/IP connections on port 5432?")
      /app/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:70

  2   PDO::__construct("pgsql:host=database;dbname=laravel;port=5432;sslmode=prefer", "laravel", "laravel", [])
      /app/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:70

Looks to me that postgres just isn't accepting connections from the appserver, logs seem to agree:

database_1         | mkdir: cannot create directory ‘/etc/ssh’: Permission denied
database_1         | Running command /app-entrypoint.sh /run.sh
database_1         |
database_1         | Welcome to the Bitnami postgresql container
database_1         | Subscribe to project updates by watching https://github.com/bitnami/bitnami-docker-postgresql
database_1         | Submit issues and feature requests at https://github.com/bitnami/bitnami-docker-postgresql/issues
database_1         |
database_1         | nami    INFO  Initializing postgresql
database_1         | postgre INFO  ==> postgresql.conf file found...
database_1         | postgre INFO  ==> No injected pg_hba.conf file found. Creating default pg_hba.conf file...
database_1         | postgre INFO  ==> Deploying PostgreSQL with persisted data...
database_1         | postgre INFO  ==> Cleaning stale postmaster.pid file...
database_1         | postgre INFO  ==> Configuring permissions for config files...
database_1         | postgre INFO
database_1         | postgre INFO  ########################################################################
database_1         | postgre INFO   Installation parameters for postgresql:
database_1         | postgre INFO     Persisted data and properties have been restored.
database_1         | postgre INFO     Any input specified will not take effect.
database_1         | postgre INFO   This installation requires no credentials.
database_1         | postgre INFO  ########################################################################
database_1         | postgre INFO
database_1         | nami    INFO  postgresql successfully initialized
database_1         | INFO  ==> Starting postgresql...
database_1         | [WARN  tini (14)] Tini is not running as PID 1 and isn't registered as a child subreaper.
database_1         | Zombie processes will not be re-parented to Tini, so zombie reaping won't work.
database_1         | To fix the problem, use the -s option or set the environment variable TINI_SUBREAPER to register Tini as a child subreaper, or run Tini as PID 1.
database_1         | 2019-02-02 04:20:32.872 GMT [138] LOG:  listening on IPv4 address "127.0.0.1", port 5432
database_1         | 2019-02-02 04:20:32.872 GMT [138] LOG:  could not bind IPv6 address "::1": Cannot assign requested address
database_1         | 2019-02-02 04:20:32.872 GMT [138] HINT:  Is another postmaster already running on port 5432? If not, wait a few seconds and retry.
database_1         | 2019-02-02 04:20:32.877 GMT [138] LOG:  listening on Unix socket "/tmp/.s.PGSQL.5432"
database_1         | 2019-02-02 04:20:32.913 GMT [139] LOG:  database system was interrupted; last known up at 2019-02-02 04:06:43 GMT
database_1         | 2019-02-02 04:20:33.668 GMT [139] LOG:  database system was not properly shut down; automatic recovery in progress
database_1         | 2019-02-02 04:20:33.674 GMT [139] LOG:  redo starts at 0/15C19C8
database_1         | 2019-02-02 04:20:33.674 GMT [139] LOG:  invalid record length at 0/15C1A00: wanted 24, got 0
database_1         | 2019-02-02 04:20:33.674 GMT [139] LOG:  redo done at 0/15C19C8
database_1         | 2019-02-02 04:20:33.710 GMT [138] LOG:  database system is ready to accept connections

@dustinleblanc dustinleblanc added the bug label Feb 2, 2019

@dustinleblanc dustinleblanc added this to the 3.0.0-rc.3 milestone Feb 2, 2019

@dustinleblanc dustinleblanc self-assigned this Feb 2, 2019

@pirog

This comment has been minimized.

Copy link
Member

pirog commented Feb 2, 2019

@dustinleblanc i can replicate this. Seems like our default custom config file is replacing ALL of the the config instead of just overriding the defaults.

pirog added a commit that referenced this issue Feb 2, 2019

@pirog

This comment has been minimized.

Copy link
Member

pirog commented Feb 2, 2019

@dustinleblanc fixed this in master simple problem of me not RTFM the bitnami docs :/

@pirog

This comment has been minimized.

Copy link
Member

pirog commented Feb 2, 2019

@dustinleblanc pushed this to master
2450583

@pirog pirog closed this Feb 2, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment