> ## Documentation Index
> Fetch the complete documentation index at: https://developer.upsun.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Workers

> Defines the list of worker names, which are alternate copies of the application to run as background processes.

Optional in [single-runtime](https://developer.upsun.com/docs/configure-apps/app-reference/single-runtime-image.md#primary-application-properties) and [composable](https://developer.upsun.com/docs/configure-apps/app-reference/composable-image.md#primary-application-properties) images.

Workers require resource definition using `upsun resources:set`, same as application containers.
For more information, see how to [manage resources](https://developer.upsun.com/docs/manage-resources.md).

Workers are exact copies of the code and compilation output as a `web` instance after a [`build` hook](https://developer.upsun.com/docs/configure-apps/image-properties/hooks).
They use the same container image.

Workers can't accept public requests and so are suitable only for background tasks.
If they exit, they're automatically restarted.

> [tab] Single-runtime image
>
> The keys of the `workers` definition are the names of the workers.
> You can then define how each worker differs from the `web` instance using
> the [primary application properties](https://developer.upsun.com/docs/configure-apps/app-reference/single-runtime-image.md#primary-application-properties).
>
> Each worker can differ from the `web` instance in all properties *except* for:
>
> * `build` and `dependencies` properties, which must be the same
> * `crons` as cron jobs don't run on workers
> * `hooks` as the `build` hook must be the same
>   and the `deploy` and `post_deploy` hooks don't run on workers.
>
> A worker named `queue` that was small and had a different start command could look like this:
>
> &#x20;       applications:
> &#x20;         \<APP\_NAME>:
> &#x20;           type: 'python:\{\{version:python:latest}}'
> &#x20;           source:
> &#x20;             root: "/"
> &#x20;           workers:
> &#x20;             queue:
> &#x20;               commands:
> &#x20;                 start: |
> &#x20;                   ./worker.sh

> [tab] Composable image
>
> The keys of the `workers` definition are the names of the workers.
> You can then define how each worker differs from the `web` instance using
> the [primary application properties](https://developer.upsun.com/docs/configure-apps/app-reference/composable-image.md#primary-application-properties).
>
> Each worker can differ from the `web` instance in all properties *except* for:
>
> * `crons` as cron jobs don't run on workers
> * `hooks` as the `build` hook must be the same
>   and the `deploy` and `post_deploy` hooks don't run on workers.
>
> A worker named `queue` that was small and had a different start command could look like this:
>
> &#x20;       applications:
> &#x20;         \<APP\_NAME>:
> &#x20;           type: "composable:\{\{version:composable:latest}}"
> &#x20;           source:
> &#x20;             root: "/"
> &#x20;           stack:
> &#x20;             runtimes: \[ "python@\{\{version:python:latest}}" ]
> &#x20;           workers:
> &#x20;             queue:
> &#x20;               commands:
> &#x20;                 start: |
> &#x20;                   ./worker.sh


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.