dunglas / frankenphp

🧟 The modern PHP app server
https://frankenphp.dev
MIT License
6.56k stars 215 forks source link

Can I run frankenphp with supervisor? #633

Open kilwir76 opened 5 months ago

kilwir76 commented 5 months ago

Describe you feature request

I'd like to be able to run daemon jobs via supervisor.

Is this possible or not?

I've tried, but I can't run supervisor with frankenphp, even though it's installed in a Dockerfile.

dunglas commented 5 months ago

Yes, for instance Laravel Sail runs FrankenPHP using supervisord: https://laravel.com/docs/10.x/octane#frankenphp-via-laravel-sail

kilwir76 commented 5 months ago

i need to run without laravel sail + octane. Its possible ?

dunglas commented 5 months ago

Definitely!

sneycampos commented 5 months ago

i need to run without laravel sail + octane. Its possible ?

You can see the docs (link) to install supervisor. Something like this:

Dockerfile

FROM dunglas/frankenphp

RUN apt update && apt install supervisor

COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf

ENTRYPOINT ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]

supervisord.conf

[program:octane]
command=php /app/artisan octane:frankenphp --host=127.0.0.1 --port=80 --admin-port=2019 --workers=16
sneycampos commented 5 months ago

@kilwir76 solved your problem? could you close the issue? :)

kilwir76 commented 4 months ago

Thanks ! yes sorry for the wait

kilwir76 commented 2 months ago

its a same fonctionnality on symfony ?

sneycampos commented 2 months ago

its a same fonctionnality on symfony ?

Yes. you only need to set your entrypoint command in supervisord configuration.

Supervisor is a process control system. It's not exclusive for laravel or anything. You can control any command with.

thdebay commented 2 weeks ago

What would be the supervisor command to run a Laravel app in the same way as the default Frankenphp image does? (without Octane)

For instance, does the base image do more than something like this:

[program:frankenphp]
directory = /srv
command=/usr/local/bin/frankenphp run --config /etc/caddy/Caddyfile

Does it run in worker mode by default, and how to run in worker mode with supervisor?