strangebuzz / MicroSymfony

Template introduction, check out: https://www.strangebuzz.com/en/blog/introducing-the-microsymfony-application-template
https://microsymfony.ovh/
Other
84 stars 8 forks source link

docker: Error during startup #49

Closed Chr909 closed 4 months ago

Chr909 commented 4 months ago

I found the project and the strangebuzz blog:

Sadly I cannot get it running, the connection to localhost results in a timeout because of an error during startup.

I'm working on a Windows PC and I have Docker installed locally. (I also have the symfony CLI and php installed locally but they shouldn't be the problem since I'm trying to use Docker...)

Trying the FrankenPHP installation:

After installation with the following commands: docker run --rm -it -v "%cd%":/app composer:latest create-project strangebuzz/microsymfony && cd microsymfony docker run --rm -it -v "%cd%":/app composer:latest require runtime/frankenphp-symfony docker run -e FRANKENPHP_CONFIG="worker ./public/index.php" -e APP_RUNTIME=Runtime\\FrankenPhpSymfony\\Runtime -v "%cd%":/app -p 80:80 -p 443:443 -d dunglas/frankenphp

(I replaced the $PWD from the readme.md with "%cd" to get it working)

The Docker Container is running, but in the log it loops the following error message after initialization:

initialization:

2024-06-08 12:02:45 {"level":"info","ts":1717840965.2348695,"msg":"using config from file","file":"/etc/caddy/Caddyfile"}
2024-06-08 12:02:45 {"level":"info","ts":1717840965.239463,"msg":"adapted config to JSON","adapter":"caddyfile"}
2024-06-08 12:02:45 {"level":"warn","ts":1717840965.239514,"msg":"Caddyfile input is not formatted; run 'caddy fmt --overwrite' to fix inconsistencies","adapter":"caddyfile","file":"/etc/caddy/Caddyfile","line":10}
2024-06-08 12:02:45 {"level":"info","ts":1717840965.2434783,"logger":"admin","msg":"admin endpoint started","address":"localhost:2019","enforce_origin":false,"origins":["//127.0.0.1:2019","//localhost:2019","//[::1]:2019"]}
2024-06-08 12:02:45 {"level":"info","ts":1717840965.2443469,"logger":"tls.cache.maintenance","msg":"started background certificate maintenance","cache":"0xc000296a00"}
2024-06-08 12:02:45 {"level":"info","ts":1717840965.2447147,"logger":"http.auto_https","msg":"server is listening only on the HTTPS port but has no TLS connection policies; adding one to enable TLS","server_name":"srv0","https_port":443}
2024-06-08 12:02:45 {"level":"info","ts":1717840965.2447553,"logger":"http.auto_https","msg":"enabling automatic HTTP->HTTPS redirects","server_name":"srv0"}

error:

2024-06-08 12:02:46 {"level":"error","ts":1717840966.3556254,"msg":"unexpected termination, restarting","worker":"/app/public/index.php","exit_status":255}
2024-06-08 12:02:46 {"level":"error","ts":1717840966.355743,"msg":"unexpected termination, restarting","worker":"/app/public/index.php","exit_status":255}
2024-06-08 12:02:46 {"level":"error","ts":1717840966.3558831,"msg":"unexpected termination, restarting","worker":"/app/public/index.php","exit_status":255}
2024-06-08 12:02:46 {"level":"error","ts":1717840966.3561065,"msg":"unexpected termination, restarting","worker":"/app/public/index.php","exit_status":255}
2024-06-08 12:02:46 {"level":"error","ts":1717840966.3574996,"msg":"unexpected termination, restarting","worker":"/app/public/index.php","exit_status":255}
2024-06-08 12:02:46 {"level":"error","ts":1717840966.3577456,"msg":"unexpected termination, restarting","worker":"/app/public/index.php","exit_status":255}
2024-06-08 12:02:46 {"level":"error","ts":1717840966.3580017,"msg":"unexpected termination, restarting","worker":"/app/public/index.php","exit_status":255}
2024-06-08 12:02:46 {"level":"error","ts":1717840966.3582811,"msg":"unexpected termination, restarting","worker":"/app/public/index.php","exit_status":255}

Something seems to be not working correctly, but I'm running out of Ideas. Maybe it's something obvious I cannot see at the moment.

Things I've tried / found:

I found this issue, but I composer dependencies were installed in the commands above: https://github.com/dunglas/frankenphp-demo/issues/1

Another Issue suggests installing frankenphp-symfony as a solution for a similar error: https://github.com/dunglas/frankenphp/issues/101 ... but its installed by the second command listed above

This Issue says the frankenphp Runtime has to be an env-variable, but thats also the case: https://github.com/dunglas/frankenphp/issues/31

Are there any Ideas for a solution?

COil commented 4 months ago

Hello @Chr909 , thanks for the issue. Unfortunately, this seems a Windows/FrankenPHP issue. I suggest you to create a new issue or to add a comment on the FrankenPHP repository. Thanks for pointing out the correct docker env "%cd%" for Windows, I'll add a note for this in the documentation. See you (and don't forget to add a ⭐ :)).

Chr909 commented 4 months ago

I have a small update - I experimented a bit further and searched for some hints to a solution and found this in the logs:

Symfony\Component\ErrorHandler\Error\FatalError {#5132 ▼
  -error: array:4 [▼
    "type" => 1
    "message" => "Maximum execution time of 30 seconds exceeded"
    "file" => "/app/vendor/symfony/config/Resource/FileResource.php"
    "line" => 34
  ]
}

But at the moment I can't gain any new insights into the problem from this...

Chr909 commented 4 months ago

I finally solved the problem by using the base symfony/docker repo. Anyway, this repo helps setting up the rest. So this is just my individual workaround.