symfony-docker
symfony-docker copied to clipboard
Not reachable database DATABASE_URL causes infinite retries to connect and hard to find clear error
If you have an unreachable database specified in DATABASE_URL env at start, the docker-entrypoint.sh exits after 60 retries. Then the docker-compose automatically restarts it.
This gave me 2 false impressions: Something went wrong with caddy (502 caused by the missing socket). Php service was working (service was up/green) but "just" trying to connect when in fact the socket hasn't been created.
I would suggest to remove the exit 1 in the docker-entrypoint.sh in order to have a working caddy and PHP. Let PHP/Symfony handle and display the error.
Hi!
I recently had this issue with the missing socket and it was a problem with the bin/console file that didn't have execution rights (chmod +x bin/console), can you check yours?
I could not explain how it is related
I'm still having the same problem.
Rights are looking ok to me on the container:
-rwxr-xr-x 1 1000 1000 492 Sep 18 20:41 console
When i originally posted the issue, I think that the sock wasn't even there on the /var/run/php.
Now it's here but I get this:
status":502,"resp_headers":{"Server":["Caddy"],"Alt-Svc":["h3=\":443\"; ma=2592000"]}} {"level":"error","ts":1665325728.6015813,"logger":"http.log.error","msg":"dialing backend: dial unix /var/run/php/php-fpm.sock: connect: connection refused",
Can you publish a reproducer with the steps ? So that I can inspect more easily
git clone https://github.com/dunglas/symfony-docker.gitcd symfony-docker-maindocker compose build --pull --no-cachedocker compose up- https://localhost works properly
- Creating Makefile from docs/makefile.md
make composer c="require symfony/orm-pack"make downmake up- https://localhost doesn't work. Returns 502 status.
@DanielDrabik I followed your steps but unfortunately I didn't succeeds to reproduce. Here my repo : https://github.com/maxhelias/reproduce-289 and and it works as such as it is.
BTW, the require in the makefile doesn't make sense because it's not a regularly used command so you might as well run it directly : docker compose exec php composer require symfony/orm-pack
I had a similar issue, after getting orm-pack from .
1: docker compose down --remove-orphans
2: docker compose build --pull --no-cache to build one more time
3: docker compose up
And it helped for me :)
@maxhelias I was about to use your repo as skeleton cause it works perfectly, but the @toddltu's answer totally helped. Thanks for the replies.
@DanielDrabik Great! Indeed, each time you modify the Dockerfile you need to rebuild you container. This project can provides all the necessary artifacts to docker when installing a dependancy thanks to symfony/flex but you will have to do the rebuild.
Closing for lack of feedback