Skip to content
homeport

Docs · Configure

Queues and background jobs

When your app queues background jobs, homeport works them on demand: a drain starts when there may be work, runs the jobs until the queue is empty, and exits. Nothing runs, and nothing is billed, while nothing is queued. Your app can sleep the whole time.

What homeport finds

homeport never reads your queue itself: your framework’s own worker does, in your environment’s Postgres database. At each build it looks for a queue it knows.

Queues homeport finds by itself
The appFound byIts drain
LaravelA class in app/ that implements ShouldQueue, or the jobs table’s migrationhomeport’s runner, which boots the app once and runs queue:work --stop-when-empty while jobs are ready
pg-bosspg-boss in package.jsonYours: a queue:drain script, or an rsc-kit queue:drain command
Graphile Workergraphile-worker in package.jsonA queue:drain script, else Graphile Worker’s own --once
  • Laravel’s queue runs on its database driver, in your database. Options after the runner go to queue:work: --queue=high,default, say. With a build command of your own, the drain is php-cli artisan queue:work --stop-when-empty.
  • pg-boss has no drain of its own: drain() from @homeport-sh/queue is one. pg-boss runs schedule() jobs only while a worker runs, so move them to cron jobs.
  • Laravel Horizon, BullMQ and Bee-Queue need Redis, which homeport doesn’t offer. Run their worker as an always-on process with a Redis of your own, or use one of the queues above.
  • Any other queue works too: say its drain command in homeport.yaml.
src/commands/queue:drain.ts (pg-boss in an rsc-kit app)
import { PgBoss } from "pg-boss";
import { drain } from "@homeport-sh/queue";
import { handlers } from "../jobs";

export default async () => {
  const boss = new PgBoss(process.env.DATABASE_URL!);
  await boss.start();
  await drain(boss, { handlers });
  await boss.stop();
};

How it is worked

A drain is a run of its own, from your app’s live release, like a cron job’s. It doesn’t wake your web.

  • A drain starts after your app is used, when a delayed job is due, and, in case something was missed, on an idle queue now and then.
  • A drain that leaves jobs waiting is followed at once by another. A drain that fails is run once more 30 seconds later. One that runs past its timeout is stopped, and its job is tried again by the next.
  • An app has one drain at a time.
  • Its last line says what is left, so homeport knows when to drain again: homeport-queue: processed=12 failed=1 waiting=0 next_due=1793481600. homeport’s Laravel runner and @homeport-sh/queue print it. A drain that prints nothing still works; it just can’t say when a delayed job is due.
How often drains start, per plan
PlanAfter activity or a due jobAn idle queueLongest drain
FreeEvery 15 minutes at mostOnce a day5 minutes
StarterEvery 5 minutes at mostEvery 6 hours15 minutes
GrowthEvery 5 minutes at mostEvery 6 hours1 hour
BusinessEvery 5 minutes at mostEvery 6 hours1 hour

Jobs within seconds: homeport/laravel

Without help, a job waits for the next drain. Add the homeport/laravel package (Laravel 12 and 13) and your app asks for a drain as soon as a job is queued. On a paid plan it starts within seconds; on Free it still waits out the 15 minutes.

composer require homeport/laravel

Settings → Queue

Each environment’s Settings → Queue shows the queue homeport found, and whether it was found by the build or set in homeport.yaml.

Queue settings
SettingWhat it does
How it runsOn demand: drains, as above. Always on: your app’s own worker process works jobs as they come, and homeport doesn’t drain (paid plans). Off: nothing works the queue.
Drain commandArguments to your app’s binary, with no shell. Blank runs the one detected.
Timeout1 minute to the plan’s longest drain. A drain past it is stopped.
AlertsEmail the team’s owners when a drain fails or the queue is stuck (three drains in a row with jobs waiting and none done), and when it is well again.
  • Drain now starts one, and Retry failed jobs runs the queue’s retry command (Laravel’s queue:retry all) and drains after it.
  • The queue’s page shows what is waiting, when the next delayed job is due, and the last day’s drains: why each started, how long it took, and what it processed and failed. Failed jobs stay in your database, where your framework keeps them.
  • An app with a process named worker, workers, queue, jobs or horizon, or one running the detected worker, is Always on by default, so the same jobs are never worked twice. Running a worker and draining on demand would do that.

What it costs

A drain is billed as a cron run is: for the time it runs, at the memory it uses, at the compute rate of $0.015 per GB-hour, on its own Queue line. Drains use what your app and its cron jobs leave of the plan’s included compute. On Free they count toward Free’s compute cap and are never billed. An always-on worker is a process, billed as the app’s processes are.

The queue key in homeport.yaml

queue: says the queue instead of detection. none means the app has none. A map sets any of four keys over what was detected:

homeport.yaml
queue:
  backend: postgres     # postgres (the default) or redis
  drain: php-cli artisan queue:work --stop-when-empty --queue=high,default
  timeout: 20m          # 1m to 60m, 10m by default
  retry: php-cli artisan queue:retry all
  • drain and retry are arguments to your app’s binary, run without a shell, as the release command is.
  • Any other key is an error. How the queue runs is chosen in Settings, not here.

From the CLI and your agent

homeport queue status                 # how it runs, what's waiting, the recent drains
homeport queue drain --remote         # start a drain on homeport
homeport queue retry-failed --remote  # retry the failed jobs on homeport
homeport queue drain                  # run the drain here, against your local .env

Without --remote, drain and retry-failed run the app’s own command on your computer, with its .env. Each takes --env, and --team and --app, like the other commands. Through homeport mcp, your coding agent’s queue_status tool reads the same: the mode, the backend, the drain command and timeout, what is waiting and the recent drains. It changes nothing.