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

Renaming of docker-compose.yaml in compose.yaml : postgresql does'nt work anymore #1001

Closed
sblondeau opened this issue Oct 24, 2023 · 8 comments

Comments

@sblondeau
Copy link

Hello,

My issue comes appears after that commit 46bebc3
where docker.compose.yaml has been renamed in compose.yaml

Since yesterday, when I install a new symfony project with --webapp, and then run a docker compose up, my postgresql container is created BUT when I try to use it (via a make:migration or a d:d:c in example) it crashed with this message

SQLSTATE[08006] [7] connection to server at "127.0.0.1", port 5432 failed: Connection refused  
        Is the server running on that host and accepting TCP/IP connections?                           

After long search, I have finally found that if I rename the file compose.yaml with former name docker-compose.yaml, it works well.
Maybe the problem comes from my docker compose configuration ? Do you have any idea?
Many thanks for your help

@nicolas-grekas
Copy link
Member

What does docker --version return for you?

@sblondeau
Copy link
Author

sblondeau commented Oct 24, 2023

Hello Nicolas,
It returns 24.0.6

and docker compose version return
v2.21.0

@dunglas
Copy link
Member

dunglas commented Oct 24, 2023

Can you paste your compose.yaml file? Also, do you have any override file? If yes, does it follow the same convention?

@sblondeau
Copy link
Author

Hello Kevin,
My compose and compose.override have no modification, they are generated when I start my project

version: '3'

services:
###> doctrine/doctrine-bundle ###
  database:
    image: postgres:${POSTGRES_VERSION:-15}-alpine
    environment:
      POSTGRES_DB: ${POSTGRES_DB:-app}
      # You should definitely change the password in production
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-!ChangeMe!}
      POSTGRES_USER: ${POSTGRES_USER:-app}
    volumes:
      - database_data:/var/lib/postgresql/data:rw
      # You may use a bind-mounted host directory instead, so that it is harder to accidentally remove the volume and lose all your data!
      # - ./docker/db/data:/var/lib/postgresql/data:rw
###< doctrine/doctrine-bundle ###

volumes:
###> doctrine/doctrine-bundle ###
  database_data:
###< doctrine/doctrine-bundle ###

and the override

version: '3'

services:
###> doctrine/doctrine-bundle ###
  database:
    ports:
      - "5432"
###< doctrine/doctrine-bundle ###

###> symfony/mailer ###
  mailer:
    image: schickling/mailcatcher
    ports: ["1025", "1080"]
###< symfony/mailer ###

As soon as I rename it in docker-compose.yaml, my postgre container works well :-)

@wryk
Copy link

wryk commented Oct 24, 2023

I encountered the same database issue with symfony-cli local dev server. The cause was pretty clear when running symfony var:export --debug.

ERROR: unable to find a docker-compose.yaml or docker-compose.yml for the current directory
ERROR: unable to find a compose directory for the current directory

Renaming the files fixed the issue.

@dunglas
Copy link
Member

dunglas commented Oct 24, 2023

Ok I think I got it, support for the new compose file convention probably needs to be added somewhere in Symfony CLI.

@fabpot
Copy link
Member

fabpot commented Oct 24, 2023

@dunglas Sometimes like this? symfony-cli/symfony-cli#364

@fabpot
Copy link
Member

fabpot commented Oct 25, 2023

Symfony CLI v5.6.2 has been released with the fix.

@fabpot fabpot closed this as completed Oct 25, 2023
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

5 participants