-
-
Notifications
You must be signed in to change notification settings - Fork 155
Release 4.0: Add FrankenPHP & more Laravel optmizations #283
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
base: main
Are you sure you want to change the base?
Conversation
This would be super cool to have! Great work on this so far! |
# Conflicts: # .github/workflows/service_docker-build-and-publish.yml
Deploying serversideup-php with
|
Latest commit: |
a3d592c
|
Status: | ✅ Deploy successful! |
Preview URL: | https://1edf9384.serversideup-php.pages.dev |
Branch Preview URL: | https://280-create-a-frankenphp-vari.serversideup-php.pages.dev |
This would really be a nice addition.. |
This will be a wonderful addition! |
This would be a great feature! 🚀 |
Huge update 🥳Thank you so much for your patience, all! Just wanted to let you know that supporting FrankenPHP is very important to serversideup/php. I finally had the time to sit down and deep into this. Here's where I'm at: FrankenPHP is now compiled by source 🤓I never compiled a Go app in my life, but I was able to go through the official Dockerfiles and understand what's going on. Good news is I'm able to get Alpine and Debian to build from a single Dockerfile, making it pretty easy to maintain. 👀 Extra features compared to official FrankenPHPSince we're able to compile the binary ourselves, it opens up a ton of possibility: Compile with any OS and any PHP versionI spent a crapload of time refactoring my "php-versions.yml" file. This allows us to set advanced rules like:
This means that we can run FrankenPHP on a version pinned operating system ( We'll actually be able to run FrankenPHP on more operating systems compared to their original offering. Unprivileged by defaultRunning as the All serversideup scripts will be includedOne of my favorite things about the serversideup/php images are the automation and helper scripts that are provided. All of these scripts will be inside of and fully supported in the serversideup/php:frankenphp image 🚀 👉 Next StepsThere's still A LOT left for me to do. The first comment will continuously be updated with my task status. I want to make sure FrankenPHP is offering the same features as we do in our I pushed up my code in case someone wants to start looking at my approach so far. If you're interested in helping out, just please comment below with your proposed changes before rampaging on a PR. There's a lot of moving parts in this release, so I just want to respect your time. I need to fully understand the proposed change before it can be merged. Here's a PHP info page below to show proof that I'm not bluffing 😆 Looking forward to getting this out the door! Thanks again for your patience 👍 ![]() |
@jaydrogers, will this variation still require changing permissions during the build phase? |
Yup, it will be unprivileged by default (for best security), but you can add "USER root" if you need to gain root permissions. Also, remember, you can use "docker exec -u root" if you need to get root access to an unprivileged container for debugging 🤓 |
…ence (#527) * update franken versions and create an initial caddyfile * Caddy likes tabs over spaces * Set default env vars in the dockerfile, create webroot * update dockerfile and add healthcheck * update caddyfile. https not yet working * Refactor dependency installs to support "docker-php-serversideup-set-file-permissions" across OS's * Fix typo in SSL certificate path in 10-init-unit.sh script * Add /etc/ssl/private directory to file permissions in docker-php-serversideup-set-file-permissions script * Add script to generate self-signed SSL certificate and key for container * Update Dockerfile to copy entrypoint scripts to /etc/entrypoint.d/ for improved container initialization * Remove reference file * Add Caddy configuration options and SSL mode handling for FrankenPHP - Introduced new environment variables for Caddy configuration in the Dockerfile, including options for admin interface, public path, and HTTPS settings. - Updated the Caddyfile to support different SSL modes (off, mixed, full) with corresponding configurations. - Enhanced the SSL generation script to skip certificate generation when SSL mode is off. - Added new Caddyfile imports for structured configuration management. - Improved logging and health check responses in the Caddyfile. * Enhance Caddyfile configuration for FrankenPHP with security and caching improvements - Added trusted proxies configuration to support Docker and Cloudflare. - Introduced client IP header handling for better client identification. - Updated static file handling with improved caching headers and logging for specific files. - Implemented security headers to mitigate common web vulnerabilities. - Imported security settings into SSL mode configurations for full and mixed modes. * Add logging configuration options for Caddy in FrankenPHP - Introduced new environment variables for log formatting and log levels. - Updated the Caddyfile to import log level configurations for both global and address-specific logging. - Created separate Caddyfile configurations for various log levels (debug, info, warn, error, crit, alert, emerg) to enhance logging granularity. - Adjusted Dockerfile to include new log-level configuration files in the container. --------- Co-authored-by: Matt Hook <[email protected]> Co-authored-by: Jay Rogers <[email protected]> Co-authored-by: Jay Rogers <[email protected]>
🚀 FrankenPHP is ready for testing👇 How to testSee the top comment on this PR for latest updates, resources, and progress. 🐛 Have an issue?
Thanks for your patience and encouragement, y'all ✌️ |
A quick chat with GPT5 said this on Caddyfile. @jaydrogers Key takeaway for me is everything is good, but then the dot env side of things comes off like it needs double checking in terms of security atleast ![]() Here is what it suggested
And also hide at the file server level:
I'm no caddy expert. Just trying to help if it's any help at all to get this out as safely and soon as possible. Thanks |
I'm definitely open for discussion on how to improve the Caddyfile (because I just learned Caddy this week), but I might yield the proposals to improvements by humans with real experience. I am all for using AI as an assistant, but extremely hesitant to let it take the wheel on improvements (because I could respond with "Are you sure?" and it would likely 2nd guess itself anyways 🤪) If anyone else can help decipher these proposals, I am all ears 🙏 |
Been using this alpha for the last 40 mins and it was almost a drop in replacement for fpm-nginx. The only change I had to make was removing an explicit nginx permissions call leftover in my Dockerfile. I'm sure there are probably minor tweaks that will be made before release, but this seems pretty solid so far. Great work @jaydrogers |
Thanks @tomschlick! That means a lot hearing it from someone experienced as you 😃 Keep me posted how things run in the meantime. I might be merging a few smaller PRs next week 👍 |
Been running the image for a little bit and everything seems ok from my side! Idle memory usage has increased compared to unit, but idle CPU usage has decreased, performance has remained similar as well! Note: This probably isn't a true comparison, so not sure if this is actually useful data Unit
Franken Alpine
|
The real magic should happen with the worker mode of frankenphp, though not every app will support out of the box. I guess this example it without it? |
If someone wants to give worker mode a whirl and keep me posted of your results, I would be very interested. I left a section in the Caddyfile called docker-php/src/variations/frankenphp/etc/frankenphp/Caddyfile Lines 14 to 16 in a3d592c
Official Docs: |
…rameter for specifying the output file path. Default output path remains unchanged. Improved error handling for missing output file path argument.
…e input file path. Improved error handling for missing input file argument. Updated usage documentation accordingly.
… additional PHP variations (fpm-apache and fpm-nginx) for improved file permission management across different server configurations.
4.0 Release: Say hello to FrankenPHP 👋
🚀 What this PR does
This PR is our home base for testing our new 4.0 release. This adds the highly anticipated variation of FrankenPHP and further optimizes serversideup/php to be highly optimized for deploying and maintaining Laravel applications.
🫵 WE NEED YOU: Help us test test this release
Important
Please keep reading the notes in this post before cowboy coding and throwing this into production 🤠
php-dev
(notphp
)View Test Images on Dockerhub →
Anything tagged with
283-
will reference this PR and should be tested. Notice we're testing onphp-dev
(notphp
).🐛 Reporting Issues
👨🔬 What to test
We really need the community's help on testing these images as we progress towards stable.
1️⃣ All variations: Laravel Automations
There were huge improvements made to the 50-laravel-automations.sh script.
2️⃣ FrankenPHP: Caddyfile structure
LOG_LEVEL_OUTPUT
help you out? Are the logs too noisy?3️⃣ Test start up scripts
We made improvements to the entrypoint script.
🌎 Latest Documentation
Use the link below to reference the latest documentation (it will automatically update as we keep improving the docs).
View the latest documentation →
⚡️ What's new
🧟♂️ FrankenPHP variations now added
The highly anticipated release of FrankenPHP is now available. These images come with many enhancements compared to the official FrankenPHP images.
More operating system variations
We are able to compile FrankenPHP by source, which allows us to open up support for many operating systems.
How tagging works
There's more to it, but in general the primary principle is:
This means we're offering FrankenPHP with the following operating systems:
trixie
: Debian Trixie (13)bookworm
: Debian Bookworm (12)alpine3.22
: Alpine 3.22alpine3.21
: Alpine 3.21Images are unprivileged by default
For best security practices, we're running things as
www-data
. This dramatically reduces your security footprint when running PHP in production. Because of this, we're listening on8080 (HTTP)
and `8443 (HTTPS). This follows the same design pattern as our other images.Extremely flexible and production-grade Caddyfile by default
The default FrankenPHP Caddyfile gives you enough to get started, but we spent a ton of time making sure that we're shipping production-grade and secure configurations by default. This includes:
Designed for mass-scale production deployments
It's almost unbelievable and amazing how well FrankenPHP works with Caddy as a proxy. This tight integration allows you to do magical things like deploy trusted SSLs with Let's Encrypt. The only problem is, you probably have something else serving SSL termination and you most likely would not use that feature in a single container.
Our approach is "orchestrator first", meaning the image is designed for mass-scale in mind.
This means we're shipping the image assuming that you're doing TLS termination elsewhere. This makes it easier for you to scale and perform zero-downtime deployments:
Flexible environment configuration
Just like the experience with our other PHP variations, we also have things like
SSL_MODE
,LOG_OUTPUT_LEVEL
, changing PHP INI settings with environment variables, all our helper scripts for changing permissions, etc. that make it a breeze for you to customize how the PHP image behaves.🌎 New Environment Variables
The following environment variables are now available:
🤩 New Features
php artisan optimize
support to the Laravel Automations scriptphp artisan db:seed
support to the Laravel Automations scriptAUTORUN_DEBUG
environment variable to help diagnose issues with Laravel Automationsentrypoint.d
scripts so we can gracefully handleexit 0
in a entrypoint script🐛 Bug Fixes
docker-serversideup-php-s6-init
back for advanced S6 dependency use cases (Custom s6 services dependencies no longer works #479)✅ Jay's Checklist
These are notes to myself so I can remember where I left off as I start merging more things in:
Development
LOG_LEVEL_OUTPUT
Caddyfile
to work like ourfpm-nginx
imagePHP_
environment variables from other Server Side Up images to work with FrankenPHPset-id
andset-filepermissions
scripts work wellDocumentation