jdecool/scaleway-runtimepublic Fork
⑂ main
Commits
⬇ Clone ▾
git clone https://git.rickub.com/jdecool/scaleway-runtime.git
git clone ssh://git@rickub.com/jdecool/scaleway-runtime.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

Download ZIP
Merge pull request #4 from jdecool/ci/catalogue-credentials-check 445b945Unverified · on main · Jérémy DECOOL · yesterday
README.md

Scaleway Runtime

A Symfony Runtime that runs Symfony and PHP applications on Scaleway Serverless Functions.

Scaleway calls a PHP function handle($event, $context) for each Invocation.
This package provides that function, boots your unchanged public/index.php once per Warm Process, turns each Event into a Symfony Request and each Response back into a Function Response.
It also ships the tools to package the function and to run it locally.

Vocabulary (Invocation, Event, Warm Process...) is defined in GLOSSARY.md, design decisions in docs/adr.

[!IMPORTANT]
The platform facts the runtime relies on were measured on Scaleway with the probe, see docs/probe-results.md.
The example application runs on Scaleway: its scenarios, CRON triggers and Command Invocations were checked on a deployment.

Requirements

  • The Scaleway PHP runtimes php84 or php85 (PHP 8.4 or later).
  • Symfony 7.4 or 8.x components (symfony/runtime, symfony/http-kernel, symfony/http-foundation).
  • To build the deployment zip: the zip PHP extension.
  • macOS or Linux for the packaging and Emulator tools (see Windows).

Installation

composer require jdecool/scaleway-runtime
vendor/bin/scaleway-init

scaleway-init writes handler.php at the root of your application:

<?php

require __DIR__.'/vendor/autoload.php';

function handle(array $event, mixed $context): array
{
    return JDecool\ScalewayRuntime\Handler::handle($event, $context);
}

Commit it.
scaleway-init refuses to replace a handler.php that differs from this stub, unless run with --force.

Your Front Controller stays as it is, require_once dirname(__DIR__).'/vendor/autoload_runtime.php' included.
That file is generated by the symfony/runtime Composer plugin, so the plugin must be allowed (config.allow-plugins.symfony/runtime), as Symfony Flex applications already do.
The Handler has already loaded vendor/autoload.php when the Front Controller runs, so autoload_runtime.php returns early and the runtime of this package takes over.

Documentation

The documentation index lists every guide. The usual path:

  1. Configuration: the function handler, the Front Controller, environment variables and the host.
  2. Supported Applications: what a Front Controller may return, from a Kernel to a raw callable.
  3. Local development with the Emulator: running the function on your machine.
  4. Packaging and Deployment: shipping it to Scaleway, after a compatibility check.
  5. Logs: seeing what the function did.

Contributing

See CONTRIBUTING.md.

License

Released under the MIT License.