vognev / laravel-serverless-knative
Laravel/Serverless for Knative
Requires
- php: >=7.2.0
- ext-json: *
- ext-sockets: *
- docker-php/docker-php: ^2.0
- jane-php/open-api-runtime: ^4 <4.3
- vognev/laravel-serverless: ^0.0.1
Suggests
- aws/aws-sdk-php:~3.0: AWS SQS Queue support
Provides
- laravel/serverless: 1.0.0
Conflicts
This package is auto-updated.
Last update: 2025-03-04 22:49:07 UTC
README
Package's aim is to provide a possibility to deploy Laravel application as an Knative service.
Installation
Package can be installed into existing project using composer:
composer require vognev/laravel-serverless-knative
Also, you need docker
locally to be able to build runtume image and access to Kubernetes with Knative deployed.
It seems that most easier is to deploy Knative using Gloo.
See /manifests
for reference.
For SQS queue you have to install corresponding composer package and deploy Knative SQS EventSource.
Initialization
Run php artisan serverless:install
command.
It will publish:
config/serverless.php
This is a configuration file, where you can tweak package's behaviour. Apart from being able to define where to store package's data, it's aim is to configure which php modules should be included in runtime.
storage/serverless
On default all runtime-related assets will be published here. Inside of this location you can find context
folder, holding docker's context to build a runtime.
.php.conf.d
In this folder you can tweak php modules options, or add your own .ini
configs.
Building Runtime
./artisan serverless:runtime
will build and push image containing php and your code.
Deployment
After steps above are done, you can deploy your project into Knative using pipe:
./artisan serverless:manifest | kubectl apply -f-
Local Development
Anything you can get running: minikube, k3s etc. Or use generated runtime image with docker-compose.