laravel-generic

by unxwares-sac

Helm chartv2026.11.5App 12.xMITVerified publisher

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) or fpm (PHP-FPM + an unprivileged nginx sidecar sharing the public files of your image).
  • Queue workers (queue:work), scheduler (CronJob running schedule:run every minute, or a schedule:work Deployment) 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.secretEnv live in a Secret (or your own existing Secrets) and are injected with secretKeyRef. 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/app and 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.

ResourceNameCreated whenContent
Deployment (web)<fullname>alwaysContainer 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>-queueworkload.queueWorker.enabled (default)workload.queueWorker.replicaCount pods running workload.queueWorker.command.
CronJob or Deployment<fullname>-schedulerworkload.scheduler.enabled (default)mode: cronjob: a Job per workload.scheduler.schedule running schedule:run; mode: deployment: one schedule:work pod.
Job + Secret (hooks)<fullname>-migrationsworkload.migrations.enabled (default), not SQLitepre-install,pre-upgrade hook; the Secret is a copy of the chart Secret. Both are deleted when the Job succeeds.
Service<fullname>alwaysservice.type (ClusterIP), service.port (80) to the port http of the web pods.
Secret<fullname>when it has dataapp-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>-nginxworkload.runtime.type=fpmnginx.conf of the sidecar.
PersistentVolumeClaim<fullname>persistence.enabled (default), no persistence.existingClaimpersistence.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.enabledWeb Deployment only.
PodDisruptionBudget<fullname>podDisruptionBudget.enabledWeb pods only.
NetworkPolicy<fullname>, <fullname>-workers, <fullname>-egressnetworkPolicy.enabled (-egress: networkPolicy.egress.enabled)See NetworkPolicy.
Pod (test hook)<fullname>-test-httphelm testSee Testing.

Volumes of the Laravel pods:

VolumeTypeMounted atHolds
tmpemptyDir (emptyDirSizeLimit)/tmptemporary files
writableemptyDir (emptyDirSizeLimit)each writablePaths entry that is not on the PVCframework cache, compiled views, file sessions, file logs, bootstrap/cache
dataPVCeach persistence.paths entry and the SQLite directory (web, queue and scheduler pods; not the migrations Job)uploads (storage/app), SQLite database
caddyemptyDir/data and /config (FrankenPHP web container)Caddy state and autosaved configuration
publicemptyDirthe public path, read-only in nginx (fpm)copy of public/ from the image
nginx-tmp, nginx-configemptyDir (256Mi), ConfigMap/tmp, /etc/nginx/nginx.conf of nginx (fpm)nginx temporary files and configuration

How it works:

  • Web pods run the app container (FrankenPHP or PHP-FPM). With fpm, an nginx sidecar listens on 8080, serves the static files and passes PHP to 127.0.0.1:9000. The public/ directory is copied from your image into a volume mounted at the same path in nginx, so SCRIPT_FILENAME is valid in both containers; files of the public disk (storage/app/public) are served from the persistent volume when it holds them. The Service maps service.port to the HTTP port of the pod.
  • Writable paths (writablePaths) are emptyDir volumes. The prepare init container seeds them with what the image contains (bootstrap/cache/packages.php, the storage skeleton...) and creates the directories Laravel expects. Paths listed in persistence.paths (or inside them) are stored on the PVC instead. storage/app is ephemeral unless persisted: use persistence or S3 for uploads.
  • Migrations (workload.migrations) run in a pre-install,pre-upgrade hook 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 (or serviceAccount.name when serviceAccount.create=false). With SQLite, the single web pod creates the database file and migrates in an init container instead. Raise helm --timeout for long migrations.
  • Queue workers get terminationGracePeriodSeconds: 60 to finish their current job. Scheduler: a CronJob with concurrencyPolicy: Forbid and no retry (a retry would run the tasks of a past minute), or mode: deployment for a single schedule:work pod.
  • ReadWriteOnce volume: the web Deployment keeps one replica with the Recreate strategy and the queue/scheduler pods are scheduled on the node of the web pod (required pod affinity). A ReadWriteMany volume, or persistence.enabled=false with S3, lifts both limits.
  • Graceful shutdown: a 5 s preStop sleep on the web containers lets endpoints drain before FrankenPHP/PHP-FPM/nginx stop.
  • Logs go to stderr by default (laravel.log.channel), visible with kubectl logs.
  • Environment: every Laravel container (web, queue, scheduler, migrations) gets the same variables, rendered from laravel.* (see Laravel settings).

Images

ImageDefaultUsed by
your application imagenone: image.repository and image.tag (or image.digest) are requiredapp, prepare, migrate/sqlite-init, queue workers, scheduler, migrations Job
docker.io/nginxinc/nginx-unprivileged1.30.6-alpine-slimthe nginx sidecar (fpm runtime only) and the helm test pod (unless tests.image)
  • The chart has no imageProvider value and UnxWares builds no image for it: the application image is yours, the nginx image is the upstream nginx-unprivileged (multi-architecture). UnxWares images (images/, rebuilt twice a week and signed with cosign) are not used by this chart.

  • 1.30.6-alpine-slim is nginx without the optional njs, xslt, image-filter and geoip modules. If your workload.nginx.config loads one of them, set workload.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.image replaces the image of the helm test pod: it needs wget and 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 (imagePullSecrets for 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/v1 HTTPRoute) to expose the application, metrics-server for autoscaling, and a CNI that enforces NetworkPolicies for networkPolicy.
  • Pod Security: with the default values every pod satisfies the restricted Pod Security Standard.

Requirements for your image

FrankenPHPPHP-FPM
Base imagedunglas/frankenphp (or Octane with FrankenPHP)php:*-fpm
appPath (application directory)/app (default)usually /var/www/html
Listens onworkload.runtime.frankenphp.port (8000)workload.runtime.fpm.port (9000, FastCGI)
  • The image must contain /bin/sh and cp (true for every official PHP image): an init container copies the content of the writable paths and of public/ into volumes.
  • Files must be readable by uid 33 (www-data in the Debian images; files are world-readable by default). Change podSecurityContext for 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...). Run php artisan optimize at 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_service file capability and cannot even start when the capability is missing from the bounding set. The chart keeps NET_BIND_SERVICE on the web container (the only capability allowed by the Pod Security Standards restricted profile). If your Dockerfile runs setcap -r /usr/local/bin/frankenphp (recommended), set workload.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.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartlaravel-generic is pinned at v2026.11.5 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. 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