Re: access issue with postgresql 14 docker image on MacOS Sonoma

From: Richard Welty <rwelty(at)salesium(dot)com>
To: "pgsql-general" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: access issue with postgresql 14 docker image on MacOS Sonoma
Date: 2024-02-20 02:19:02
Message-ID: 18dc44f372c.102bbdc291801129.4736708415103967507@salesium.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

ok, sorted it out. one of two things happened, either docker got

fussier about correct environment settings on the upgrade, or i

screwed up an edit of the environment file. i prefer to blame

docker rather than myself for obvious reasons...

richard

---- On Mon, 19 Feb 2024 17:00:10 -0500 Richard Welty <rwelty(at)salesium(dot)com> wrote ---

we're using Postgresql 14 with our Laravel/Php appliction. it is working well

in EC2 and in a Docker image on my Ubuntu 22.04 desktop at work. however,

a while back it stopped working with Docker on my Macbook Air in response

to a major OS upgrade. wondering if anyone knows what i might need to change to fix

this.

the docker image is launching, i can open a terminal in docker-desktop and use psql

to connect to it and poke about with a stick. i can also access it via pgadmin using

localhost with port 5432 as expected.

but when i try to migrate the db schema using Laravel Sail, i get the following error:

  SQLSTATE[08006] [7] connection to server at "localhost" (127.0.0.1), port 5432 failed: Connection refused

Is the server running on that host and accepting TCP/IP connections?

connection to server at "localhost" (::1), port 5432 failed: Cannot assign requested address

Is the server running on that host and accepting TCP/IP connections? (SQL: select tablename, concat('"', schemaname, '"."', tablename, '"') as qualifiedname from pg_catalog.pg_tables where schemaname in ('public'))

this suggests that postgresql is not being configured properly for access from the container

containing the web app. i have included the configurations from docker-compose.yml below -

but this is the same docker-compose.yml that is currently working on Ubuntu and was working

until the MacOS upgrade, so i'm kind of baffled.

TIA, richard

--------------

Docker compose snippet

   salesium.test:

        build:

            context: ./vendor/laravel/sail/runtimes/8.1

            dockerfile: Dockerfile

            args:

                WWWGROUP: '${WWWGROUP}'

        image: sail-8.1/app

        extra_hosts:

            - 'host.docker.internal:host-gateway'

        ports:

            - '${APP_PORT:-80}:80'

            - '${HMR_PORT:-8080}:8080'

        environment:

            WWWUSER: '${WWWUSER}'

            LARAVEL_SAIL: 1

            XDEBUG_MODE: '${SAIL_XDEBUG_MODE:-off}'

            XDEBUG_CONFIG: '${SAIL_XDEBUG_CONFIG:-client_host=host.docker.internal}'

        volumes:

            - '.:/var/www/html'

        networks:

            - sail

        depends_on:

            - pgsql

    pgsql:

        image: 'postgres:14'

        ports:

            - '${FORWARD_DB_PORT:-5432}:5432'

        environment:

            PGPASSWORD: '${DB_PASSWORD:-secret}'

            POSTGRES_DB: '${DB_DATABASE}'

            POSTGRES_USER: '${DB_USERNAME}'

            POSTGRES_PASSWORD: '${DB_PASSWORD:-secret}'

        volumes:

            - 'sail-pgsql:/var/lib/postgresql/data'

            - './vendor/laravel/sail/database/pgsql/create-testing-database.sql:/docker-entrypoint-initdb.d/10-create-testing-database.sql'

        networks:

            - sail

        healthcheck:

            test: ["CMD", "pg_isready", "-q", "-d", "${DB_DATABASE}", "-U", "${DB_USERNAME}"]

            retries: 3

            timeout: 5s

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Greg Sabino Mullane 2024-02-20 04:25:28 Re: Partitioning, Identity and Uniqueness (given pg 16 changes)
Previous Message David Rowley 2024-02-20 01:40:52 Re: Partitioning, Identity and Uniqueness (given pg 16 changes)