You can define zero or multiple work instances for each application. A worker instance runs as a container, independent from the web instance and without a running Nginx instance. Also, you do not need to set up a web server on the worker instance (using Node.js or Go) because the router cannot direct public requests to the worker.
A worker instance has the exact same code and compilation output as a web instance. The container image is built once and deployed multiple times if needed using the same
build hook and
dependencies. You can customize the container and allocated resources.
Use worker instances for background tasks including:
A basic, common worker configuration could look like this:
workers: queue: size: S commands: start: | php worker.php
This example defines a single worker named queue, with a “small” container, and runs the command
php worker.php on startup. If
worker.php exits, it is automatically restarted.