Commands and overrides

The commands.start key is required to launch commands with the worker application. You can use any valid shell command, although it is ideal to use the language of your application. If the command specified by the start key terminates, it restarts automatically.

IMPORTANT
The deploy and post_deploy hooks and crons commands only run on the web container, not in worker instances.

Inheritance

Definitions for the size, relationships, access, disk and mount, and variables properties are inherited by a worker, unless explicitly overridden.

The following properties are the most commonly used to override top-level settings:

  • size—allocate fewer resources to a single background process
  • variables—instruct the application to run differently

Timing and queueing

Though each worker queues behind another, the following configuration produces a consistent two-second separation in time stamps in the var/time.txt file, regardless of the eight-second sleep within the PHP code:

workers:
    time1:
        commands:
            start: 'php -r "sleep(8); echo time() . PHP_EOL;" >> var/time.txt& sleep 2'
Next pageSet cache for static files

Commerce