> For the complete documentation index, see [llms.txt](https://docs.release.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.release.com/guides-and-examples/running-instances/jobs.md).

# Jobs

How to create jobs

### Jobs

Jobs are used to run a command that ultimately terminates. They are distinct from services (which stay running) and cron jobs (which run on a schedule).

Some common use cases for jobs include:

* Set-up scripts
* Database migrations
* Compiling assets
* Validation scripts

### Creating jobs on Release

To create jobs in Release, edit your "Environment Configuration" under **Settings**.

![Edit environment configuration](https://585411240-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M1neGLLQ0sDXeK6ooSo%2Fuploads%2Fgit-blob-3b9aec97240fdd6463e468e92b1e8930c69ffd9f%2Fjobs-edit-evironment-configuration.png?alt=media)

At the end of the YAML, add a section called `jobs` and define any jobs you want to run following the example below.

```yaml
jobs:
- name: migrate
  command:
  - "./run-migrations.sh"
  from_services: backend
- name: setup
  command:
  - "./run-setup.sh"
  from_services: backend
  cpu:
    limits: 100
    requests: 100
  memory:
    limits: 1Gi
    requests: 1Gi
```

Press **Save as new version**.

![Save new configuration version](https://585411240-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M1neGLLQ0sDXeK6ooSo%2Fuploads%2Fgit-blob-2fb419d8e1904e4e8e8f6d86cb0027679025c09a%2Fjobs-job-configuration-block.png?alt=media)

Click **Deploy** to apply this new configuration to your environment. This will redeploy your existing instances, and also add a new one to run the job you defined.

![Apply latest configuration](https://585411240-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M1neGLLQ0sDXeK6ooSo%2Fuploads%2Fgit-blob-5fc1384287683ba6e467d6c58dad2cd8a438344d%2Fjobs-apply-latest-config.png?alt=media)

Wait for the new environment to deploy. If you used the configuration from the example above, you should see a new instance come up every five minutes. Viewing the logs of that instance will confirm that the job ran as expected.

### The jobs schema

Instead of choosing a `from_services` to base your job on, you can define `image` to base your job on a Docker image. You can find more examples and the full schema in the [schema docs](/reference-documentation/application-settings/application-template/schema-definition.md#jobs).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.release.com/guides-and-examples/running-instances/jobs.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
