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

Feature request: FrankenPHP Support #5655

Open
1 task done
takielias opened this issue Dec 21, 2023 · 23 comments
Open
1 task done

Feature request: FrankenPHP Support #5655

takielias opened this issue Dec 21, 2023 · 23 comments

Comments

@takielias
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Is your feature request related to a problem?

FrankenPHP (frankenphp.dev) released its first version a few days ago. Do you have plans to integrate it with DDEV?

Describe your solution

There is a docker image available for quick setup https://frankenphp.dev/docs/docker/

Describe alternatives

No response

Additional context

No response

@rfay
Copy link
Member

rfay commented Dec 21, 2023

DDEV's goal is to simulate actual deployment environments. At this time there's no intent to work with FrankenPHP because we haven't heard of any deployment environments that use it. But as things grow over the years we'll consider it.

@rfay rfay changed the title FrankenPHP Support Feature request: FrankenPHP Support Dec 21, 2023
@ochorocho
Copy link

Here is a example for using frankenphp in ddev.

.ddev/web-build/Dockerfile.frankenphp

ARG BASE_IMAGE
FROM $BASE_IMAGE
ENV FRANKENPHP_VERSION=v1.1.0

RUN curl --fail -L -o /usr/local/bin/frankenphp https://github.com/dunglas/frankenphp/releases/download/${FRANKENPHP_VERSION}/frankenphp-linux-$(uname -m) && \
    chmod +x /usr/local/bin/frankenphp

ENTRYPOINT ["frankenphp", "run", "--resume", "--watch", "-c", "Caddyfile", "--envfile", ".env", "--pidfile", "/tmp/frankenphp.pid"]

# See if frankenphp is running
HEALTHCHECK --interval=1s --timeout=120s --retries=1 --start-period=120s CMD ps -p $(cat /tmp/frankenphp.pid) > /dev/null; exit $?

Official support would be great. But for now i'm happy to have it running this way.

@rfay
Copy link
Member

rfay commented Feb 9, 2024

Please consider creating an add-on for it!

@ochorocho
Copy link

Yea, will have a look. Need to integrate this using supervisord or some other way to ensure the process is restarted
once it crashes.

@rfay
Copy link
Member

rfay commented Feb 9, 2024

Does it crash often?

You can easily use web_extra_daemons, but if crashes a lot you'd want to put a shell script around it so it restarted.

@ochorocho
Copy link

Well, i'm trying to get TYPO3 to work with it. Once its working properly it should not crash very often.

But having some logic in place to ensure it is running makes sense to me.

As you suggested i'll try to use a bash script.

@ochorocho
Copy link

A very early stage of the addon:

https://github.com/ochorocho/ddev-frankenphp

ddev get ochorocho/ddev-frankenphp && ddev restart

Would be great if anyone could test this and give feedback.

@takielias
Copy link
Author

Thank you @ochorocho for your outstanding support. However, I'm facing CORS issues. Could you please guide me on how to resolve them?

@ochorocho
Copy link

i don't know which software you are trying to run. But you may need to set less restrictive cores headers in your app?
CORS headers are not my area of expertise. :-)

@ochorocho
Copy link

@takielias you may have a look at https://enable-cors.org/server_caddy.html
and use a custom Caddyfile to add the cors confoguration to your project.

@takielias
Copy link
Author

@ochorocho I'm using wsl2. When I use nginx/apache I do not face any problems.

@ochorocho
Copy link

@takielias I mean is it Symfony, Laravel or any other app you are trying to run on frankenphp?

@takielias
Copy link
Author

@ochorocho Laravel

@takielias
Copy link
Author

@ochorocho Do you have any updates?

@ochorocho
Copy link

@takielias no, i'm not using laravel at all. So i can't answer your quesitons on how to get it to work.

@fabianmarz
Copy link

@ochorocho, I tried using it with WordPress but get a 404 after running $ ddev get ochorocho/ddev-frankenphp && ddev restart and trying to access my page.

@ochorocho
Copy link

ochorocho commented Mar 28, 2024

@fabianmarz haven't used wordpress in a while. I guess you need to change the doc root
in .ddev/frankenphp/Caddyfile to something like root * /.

https://github.com/ochorocho/ddev-frankenphp/blob/main/frankenphp/Caddyfile#L36

@fabianmarz
Copy link

fabianmarz commented Mar 28, 2024

Thanks for the response. I copied the docroot from the nginx config and set it to /var/www/html but now I get a 502. With a / I got a 404 still.

Sorry I'm not very experienced with Caddy and or FrankenPHP to figure out what's the issue here 🙈

@ochorocho
Copy link

ddev logs -f may help to find some details about the underlying issue.

@theodoreb
Copy link

I'm trying to push Drupal to use FrankenPHP, I'm interested in adding this to DDEV too :)
ref: https://www.drupal.org/project/drupal/issues/3437187

@dunglas
Copy link

dunglas commented Apr 3, 2024

If possible, I recommend using the official FrankenPHP image (which uses the "official" PHP image) as a base instead of downloading the static binary. The static binary is compiled using musl and has poorer performance than the glibc version.

@andypost
Copy link

andypost commented Apr 3, 2024

@dunglas can you provide details about "poor perf on musl"? I heard this mantra 7 years ago and it's not true for a long time now

@dunglas
Copy link

dunglas commented Apr 3, 2024

See dunglas/frankenphp#666 for details, benchmarks (musl is 2 times slower than glibc under certain conditions), and a potential improvement by replacing the default musl allocator, which performs badly in multi-threaded environments, by mimalloc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants