laravel-generic
by unxwares-sac
Run your own Laravel application image on Kubernetes (FrankenPHP, or PHP-FPM with an nginx sidecar) with queue workers, scheduler, migrations and hardened defaults.
About this chart
Laravel (generic) Helm Chart
Run your own Laravel application image on Kubernetes, packaged by UnxWares: web pods (FrankenPHP, or PHP-FPM with an nginx sidecar), queue workers, scheduler and database migrations, with hardened defaults. The chart ships no application: you build the image, the chart runs it. The chart is maintained by UnxWares; it is not affiliated with the Laravel project.
Features
- Two runtimes:
frankenphp(the image serves HTTP itself, Octane compatible) orfpm(PHP-FPM + an unprivileged nginx sidecar sharing the public files of your image). - Queue workers (
queue:work), scheduler (CronJob runningschedule:runevery minute, or aschedule:workDeployment) and migrations before every install and upgrade (a hook Job, or an init container of the web pod with SQLite). - Secrets never in plain environment values: APP_KEY, database/Redis/mail passwords, AWS keys and
laravel.secretEnvlive in a Secret (or your own existing Secrets) and are injected withsecretKeyRef. APP_KEY is generated and kept across upgrades when you do not provide one. - Hardened by default: non-root (uid 33), read-only root filesystem, every capability dropped, seccomp
RuntimeDefault, no service account token. The directories Laravel writes to are volumes, seeded with what your image ships there. - Persistence for
storage/appand SQLite (PVC kept on uninstall), with the scheduling constraints a ReadWriteOnce volume needs. - Ingress or Gateway API HTTPRoute, HPA, PodDisruptionBudget, NetworkPolicies (ingress + optional egress lockdown),
helm test.
Architecture
<fullname> is <release>-laravel-generic, or just <release> when the release name contains laravel-generic.
| Resource | Name | Created when | Content |
|---|---|---|---|
| Deployment (web) | <fullname> | always | Container app (FrankenPHP, or PHP-FPM); with fpm, an nginx sidecar; init containers prepare, then migrate (or sqlite-init without migrations) with SQLite, then initContainers; plus sidecars. |
| Deployment | <fullname>-queue | workload.queueWorker.enabled (default) | workload.queueWorker.replicaCount pods running workload.queueWorker.command. |
| CronJob or Deployment | <fullname>-scheduler | workload.scheduler.enabled (default) | mode: cronjob: a Job per workload.scheduler.schedule running schedule:run; mode: deployment: one schedule:work pod. |
| Job + Secret (hooks) | <fullname>-migrations | workload.migrations.enabled (default), not SQLite | pre-install,pre-upgrade hook; the Secret is a copy of the chart Secret. Both are deleted when the Job succeeds. |
| Service | <fullname> | always | service.type (ClusterIP), service.port (80) to the port http of the web pods. |
| Secret | <fullname> | when it has data | app-key (unless laravel.key.existingSecret), db-password, redis-password, mail-password, aws-access-key-id, aws-secret-access-key when given as values, one key per laravel.secretEnv entry. Kept on uninstall when APP_KEY is generated. |
| ConfigMap | <fullname>-nginx | workload.runtime.type=fpm | nginx.conf of the sidecar. |
| PersistentVolumeClaim | <fullname> | persistence.enabled (default), no persistence.existingClaim | persistence.paths and the SQLite directory; helm.sh/resource-policy: keep. |
| ServiceAccount | <fullname> | serviceAccount.create (default) | No RBAC, token not mounted. |
| Ingress / HTTPRoute | <fullname> | ingress.enabled / httpRoute.enabled | |
| HorizontalPodAutoscaler | <fullname> | autoscaling.enabled | Web Deployment only. |
| PodDisruptionBudget | <fullname> | podDisruptionBudget.enabled | Web pods only. |
| NetworkPolicy | <fullname>, <fullname>-workers, <fullname>-egress | networkPolicy.enabled (-egress: networkPolicy.egress.enabled) | See NetworkPolicy. |
| Pod (test hook) | <fullname>-test-http | helm test | See Testing. |
Volumes of the Laravel pods:
| Volume | Type | Mounted at | Holds |
|---|---|---|---|
tmp | emptyDir (emptyDirSizeLimit) | /tmp | temporary files |
writable | emptyDir (emptyDirSizeLimit) | each writablePaths entry that is not on the PVC | framework cache, compiled views, file sessions, file logs, bootstrap/cache |
data | PVC | each persistence.paths entry and the SQLite directory (web, queue and scheduler pods; not the migrations Job) | uploads (storage/app), SQLite database |
caddy | emptyDir | /data and /config (FrankenPHP web container) | Caddy state and autosaved configuration |
public | emptyDir | the public path, read-only in nginx (fpm) | copy of public/ from the image |
nginx-tmp, nginx-config | emptyDir (256Mi), ConfigMap | /tmp, /etc/nginx/nginx.conf of nginx (fpm) | nginx temporary files and configuration |
How it works:
- Web pods run the
appcontainer (FrankenPHP or PHP-FPM). Withfpm, annginxsidecar listens on 8080, serves the static files and passes PHP to127.0.0.1:9000. Thepublic/directory is copied from your image into a volume mounted at the same path in nginx, soSCRIPT_FILENAMEis valid in both containers; files of thepublicdisk (storage/app/public) are served from the persistent volume when it holds them. The Service mapsservice.portto the HTTP port of the pod. - Writable paths (
writablePaths) are emptyDir volumes. Theprepareinit container seeds them with what the image contains (bootstrap/cache/packages.php, thestorageskeleton...) and creates the directories Laravel expects. Paths listed inpersistence.paths(or inside them) are stored on the PVC instead.storage/appis ephemeral unless persisted: usepersistenceor S3 for uploads. - Migrations (
workload.migrations) run in apre-install,pre-upgradehook Job, before the new pods roll out. Release resources do not exist yet at that point, so the Job uses its own copy of the Secret (deleted once it succeeds), no PVC, and the namespace default service account (orserviceAccount.namewhenserviceAccount.create=false). With SQLite, the single web pod creates the database file and migrates in an init container instead. Raisehelm --timeoutfor long migrations. - Queue workers get
terminationGracePeriodSeconds: 60to finish their current job. Scheduler: a CronJob withconcurrencyPolicy: Forbidand no retry (a retry would run the tasks of a past minute), ormode: deploymentfor a singleschedule:workpod. - ReadWriteOnce volume: the web Deployment keeps one replica with the
Recreatestrategy and the queue/scheduler pods are scheduled on the node of the web pod (required pod affinity). A ReadWriteMany volume, orpersistence.enabled=falsewith S3, lifts both limits. - Graceful shutdown: a 5 s
preStopsleep on the web containers lets endpoints drain before FrankenPHP/PHP-FPM/nginx stop. - Logs go to stderr by default (
laravel.log.channel), visible withkubectl logs. - Environment: every Laravel container (web, queue, scheduler, migrations) gets the same variables, rendered from
laravel.*(see Laravel settings).
Images
| Image | Default | Used by |
|---|---|---|
| your application image | none: image.repository and image.tag (or image.digest) are required | app, prepare, migrate/sqlite-init, queue workers, scheduler, migrations Job |
docker.io/nginxinc/nginx-unprivileged | 1.30.6-alpine-slim | the nginx sidecar (fpm runtime only) and the helm test pod (unless tests.image) |
-
The chart has no
imageProvidervalue and UnxWares builds no image for it: the application image is yours, the nginx image is the upstreamnginx-unprivileged(multi-architecture). UnxWares images (images/, rebuilt twice a week and signed with cosign) are not used by this chart. -
1.30.6-alpine-slimis nginx without the optional njs, xslt, image-filter and geoip modules. If yourworkload.nginx.configloads one of them, setworkload.nginx.image.tag: 1.30.6-alpine. -
Pin digests (they take precedence over the tags):
image: repository: registry.example.com/acme/shop digest: sha256:0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef workload: nginx: image: digest: sha256:5d8bb9437d74a600ec5dbf90c035451c724dc33eac8d3a71078f6f8612c345f6 -
The CVE watch issue tracks the nginx image. Your application image is never scanned by this repository: scan it in your own pipeline.
-
tests.imagereplaces the image of thehelm testpod: it needswgetand must run as uid 101 with a read-only root filesystem.
Requirements
Kubernetes: >=1.27.0-0
- Your application image (see Requirements for your image), pullable by the cluster
(
imagePullSecretsfor a private registry), built for the architecture of your nodes. - Storage, with the default values: a default StorageClass, or
persistence.storageClass, that provisions a 5 Gi ReadWriteOnce volume. Scaling the web pods with a persistent volume needs a ReadWriteMany storage class; without one, store files on S3 and use an external database. - Database: SQLite on the PVC by default, or an external PostgreSQL, MySQL, MariaDB or SQL Server reachable from the pods. The chart deploys no database, no Redis and no mail server.
- An Ingress controller or a Gateway API implementation (
gateway.networking.k8s.io/v1HTTPRoute) to expose the application, metrics-server forautoscaling, and a CNI that enforces NetworkPolicies fornetworkPolicy. - Pod Security: with the default values every pod satisfies the
restrictedPod Security Standard.
Requirements for your image
| FrankenPHP | PHP-FPM | |
|---|---|---|
| Base image | dunglas/frankenphp (or Octane with FrankenPHP) | php:*-fpm |
appPath (application directory) | /app (default) | usually /var/www/html |
| Listens on | workload.runtime.frankenphp.port (8000) | workload.runtime.fpm.port (9000, FastCGI) |
- The image must contain
/bin/shandcp(true for every official PHP image): an init container copies the content of the writable paths and ofpublic/into volumes. - Files must be readable by uid 33 (
www-datain the Debian images; files are world-readable by default). ChangepodSecurityContextfor another user. - The root filesystem is read-only: everything is decided at build time (
composer install --no-dev,npm run build,php artisan storage:link...). Runphp artisan optimizeat container start rather than at build time, since configuration comes from environment variables. - Laravel 11+ exposes
/up, used by the probes. Older applications: add a health route or change the probes. - FrankenPHP and capabilities: the official binary carries the
cap_net_bind_servicefile capability and cannot even start when the capability is missing from the bounding set. The chart keepsNET_BIND_SERVICEon the web container (the only capability allowed by the Pod Security Standards restricted profile). If your Dockerfile runssetcap -r /usr/local/bin/frankenphp(recommended), setworkload.runtime.frankenphp.keepNetBindService=false.
Installation
helm repo add unxwares https://helm.unxwares.studio
helm repo update
helm install shop unxwares/laravel-generic --namespace shop --create-namespace \
--set image.repository=registry.example.com/acme/shop \
--set image.tag=1.4.2
image.repository and image.tag (or image.digest) are required. The chart appVersion (12.x)
is the Laravel version the chart targets, never an image tag.
Charts are signed with the UnxWares Helm Charts OpenPGP key (fingerprint
7902 E52E A435 EF27 C643 2E53 78D6 B532 C599 DA9B, public key https://helm.unxwares.studio/pgp-public-key.asc).
To verify the package before installing:
curl -fsSL https://helm.unxwares.studio/pgp-public-key.asc | gpg --import
gpg --export 7902E52EA435EF27C6432E5378D6B532C599DA9B > ~/.gnupg/unxwares-helm.gpg
helm install shop unxwares/laravel-generic --namespace shop --create-namespace \
--verify --keyring ~/.gnupg/unxwares-helm.gpg -f values.yaml
The minimal values are the image. With nothing else, the release runs FrankenPHP with SQLite and storage/app on a
5 Gi PVC, a queue worker and the scheduler CronJob, reachable inside the cluster only. A real install usually also
sets laravel.name, laravel.url, an Ingress or HTTPRoute, and, with GitOps tools, laravel.key.existingSecret
(see Examples).
To reach the application without exposing it:
kubectl -n shop port-forward svc/shop-laravel-generic 8080:80
then open http://127.0.0.1:8080 (/up answers when Laravel boots). The chart creates no application user: create
the first one the way your application does it (registration page, seeder, artisan command), for example
kubectl -n shop exec -it deploy/shop-laravel-generic -c app -- php artisan db:seed --force.
Configuration
Runtime: FrankenPHP or PHP-FPM
workload.runtime.type: frankenphp (default): the app container serves HTTP on
`workload.runtime.f
Deploy laravel-generic with OpenTenant
Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has laravel-generic on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.
- Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
- Place the chartlaravel-generic is pinned at v2026.11.5 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
- ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below opentenant validate opentenant.yaml terraform init && terraform apply