# Workloads

URL: /docs/platform/workloads

The Functions, Apps, Sites, Workflows and Jobs that run on funcd, and what they need to run.

![An App, a Function, a Workflow, a Site and a Job take their code and files from bundles in an OCI registry, pinned by digest, and rely on their configuration: ConfigMaps and Secrets, or only ConfigMaps for a Site](</assets/workloads.drawio-Ihpl0q_C.svg>)

funcd runs five kinds of workload. A Function is code, an App is a whole app in one resource, a Site is a static web
app, a Workflow runs Functions as steps, and a Job runs code once for each of its runs. Their code and files come from
bundles in an OCI registry, pinned by digest: a Function's code, a Site's static files, and the bundles of an App's
parts, of a Workflow's steps and of a Job's code. All of them rely on configuration: ConfigMaps for their settings and,
except for a Site, Secrets. The pages of this section
cover each kind, then what a workload needs to run: its artifact, its runtime and its configuration.

## Function [#function]

A [Function](/docs/platform/workloads/function.md) is the code that funcd runs. An HTTP client calls it through the edge, and another
Function, a Sensor, a Workflow step or an App's hook calls it from inside funcd. Every call goes through the invoke
chain and the activator. A Function binds the stores, the Secrets and the other Functions that it uses. Each change
to it creates an immutable Revision, and workers run that Revision, either workers of its own or a pool that it
shares with other Functions.

## App [#app]

An [App](/docs/platform/workloads/app.md) declares a whole app in one resource: its Functions, Jobs, Workflows, Sites, Routes, stores, add-on
objects, EventSources, Sensors and ConfigMaps. funcd rolls the App out as one unit, through an AppRevision for each
changed spec. It calls the App's hooks around the rollout, deletes the parts that the App no longer declares, and rolls
the App back through its revisions.

## Site [#site]

A [Site](/docs/platform/workloads/site.md) is a static web app. funcd copies its bundle into a prefix of a Bucket, and the edge serves the
files from there through the Site's Route, with no worker. When a deploy fails, the previous version keeps serving.

## Workflow [#workflow]

A [Workflow](/docs/platform/workloads/workflow.md) runs Functions as steps, in order or as their dependencies allow, along with built-in steps
and child Workflows. Each execution is a WorkflowRun, which keeps the revisions of the step Functions that it started
with. The workflow engine passes each step's output to the steps that follow, retries a failed step, and keeps the
run's progress in the run state.

## Job [#job]

A [Job](/docs/platform/workloads/job.md) is code that runs to its end. Each run is a JobRun, which pins the Job's current Revision when it
starts and runs on a worker of its own. funcd calls the handler once with the run's input, keeps its answer as the
run's result, and never runs a run again on its own.

## Artifacts [#artifacts]

The code of a Function or a Job reaches funcd as an OCI [artifact](/docs/platform/workloads/artifacts.md), together with its contract and its
runtime. The Revision pins the artifact's digest, so the code that was validated is the code that runs, and funcd pulls
it by that digest.

## Runtime [#runtime]

The code of a Function or a Job runs in a worker, where a shim in TypeScript or in Python loads it and gives it its
context. The [runtime](/docs/platform/workloads/runtime.md) driver runs each worker as a host process by default, or, on Linux, in a container of
its own.

## Configuration [#configuration]

Workloads take their settings from ConfigMaps and their secrets from Secrets. A Function, a Job's run and a Workflow's
steps receive ConfigMap keys as environment variables and read Secret values through their local API. A Lake's engine
receives both in its environment, and an add-on's engine the Secret keys that its Addon lists. A Site writes a
ConfigMap's keys into a public file, and an App declares both for its parts. The [Configuration](/docs/platform/workloads/configuration.md) page
describes each of them.
