Documentation
MatteGetting started
Updated
You install Matte the same way as any other app in the Scalpels catalog. Connect GitHub and Laravel Cloud, open Catalog, select View requirements on Matte, choose a region and deploy. Install a product describes each step and how to resume an install that fails partway.
What the install provisions
Matte's manifest asks for exactly these on your Laravel Cloud account:
| Resource | What Matte uses it for |
|---|---|
| Compute, on PHP 8.5 | The web process that receives images and answers status requests. |
| A Postgres 18 database (Neon serverless) | The matte_jobs table that records each job's status, plus the credentials used to authenticate callers. |
| A managed queue | The worker that runs each conversion. The machine-learning engine needs memory, so the queue is sized at 1 GB. |
| An object storage bucket | The originals you submit and the PNGs Matte produces. |
There is no scheduler and no cache. Laravel Cloud injects the connection settings for each resource itself, and Matte follows them: it stores files on the bucket because the bucket is the app's default disk, and it dispatches jobs to the managed queue because that is the default queue connection.
Matte needs no environment values to run. Every Matte setting has a working default, so the install writes nothing for you to review. See Configuration for what each setting does.
The build step
During the build, the install runs php artisan matte:provision-binary --force. This downloads three things into a runtime/ folder inside the build artifact:
- the
bg-removerprogram built for Laravel Cloud's Linux arm64 machines, checked against the checksum published with its release; - the ONNX Runtime library it needs to run machine-learning models;
- the default model,
isnet-general-use.onnx.
It has to run at build time. Files written during the build ship to every web and worker instance; files written after a deploy would land on one instance's disk and disappear on the next deploy.
After the deploy
Once the deploy finishes, the install runs php artisan migrate --force, which creates the job table.
Check that it works
Matte has no image work to do in a browser, so you check it from the outside.
- Is it up? Request
/upon the environment's URL. Laravel's health route answers without a credential. - Can it convert? Run
php artisan matte:doctorinside the environment, for example with the Laravel Cloud CLI:cloud command:run <environment-id> --cmd="php artisan matte:doctor". It checks that the binary is present and executable, that the ONNX Runtime library is present, that the operating system can load everything the binary links against, and then runs a real conversion. Each check printsPASS,FAILorSKIP. On a healthy instance all four sayPASS, ending withPASS Real grabcut conversion. - Does the full round trip work? Attach one of your apps (see Connecting your apps) or mint a credential and call the API yourself (see Using the API). Submit an image without
?sync=1, poll it until it reportsdone, then download the result. This is the only check that exercises the database, the bucket, the queue and the binary together, and it is the path your apps will use.
matte:doctor and ?sync=1 both convert inside the process that received them, so neither touches the queue. Do the asynchronous round trip as well.
The sign-in page
Matte includes the sign-in page (/bfc/login) and administration page (/bfc/ui) that every Built for Cloud app has, but Matte switches off every panel on it. Signed in, the page shows the product's name and description, a link to Scalpels and a log-out button, and nothing else. Member management, personal credentials, installation credentials and sessions are all turned off.
You do not need a user account to run Matte. Everything you administer on an instance, such as minting or revoking credentials and checking the runtime, you do from the command line.
Next steps
- Connect a Laravel app through Scalpels.
- Call the API directly from anything else.