Search…
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 CronJobs (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
At the end of the YAML, add a section called jobs and define any jobs you want to run following the example below.
1
jobs:
2
- name: migrate
3
command:
4
- "./run-migrations.sh"
5
from_services: backend
6
- name: setup
7
command:
8
- "./run-setup.sh"
9
from_services: backend
10
cpu:
11
limits: 100
12
requests: 100
13
memory:
14
limits: 1Gi
15
requests: 1Gi
Copied!
Press "Save as new version".
Save new configuration version
Back in your environment settings page, 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
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 an from_services to base your Job on, you can instead define image to base your Job on a Docker image. You can find more examples and the full schema in the Schema docs.