ConceptsJobs & cron
Run a one-off job
ferry run starts one new container of a service, runs your command in it, then removes it.
Terminal
$ ferry run api --follow -- npm run migrateJob job-48dd0201159b41c3bb58 pending, streaming output…09:46:59 ==> Running `npm run migrate`09:46:59 > node migrate.js09:46:59 migrations applied09:46:59 ==> Job succeededJob job-48dd0201159b41c3bb58 succeeded (exit code 0)Write the command after --. With --follow, the CLI shows the output. If the job fails, the CLI exits with 1.
Where the job runs
The instances of the service run.
1 / 3
A one-off job runs next to the instances of the service, not in them.
The rules
- The service needs a live deploy.
- A suspended service cannot run a job.
- The job uses the same image, variables and limits as the live deploy. See What a run uses.
The command runs with sh -c in the container.
- One argument after
--is a line for the shell of the container. Thus the shell reads'npm run a && npm run b'and'echo $HOME'. - Ferry quotes each argument when there is more than one.
ferry run api -- 'python manage.py shell -c "print(1)"'The system stops a run that goes over its memory limit. The run fails, and there is no restart.
==> Job failed: the job ran out of memory (limit 512 MiB) — raise the service's memory limitRaise the limit of the service with ferry update NAME --memory …. Then run ferry restart NAME.