Skip to main content

Job Mode

A Fibe template runs in one of four execution shapes. Pick first; everything else follows.

The four shapes

ShapeMarkerLifecycle
Long-running HTTP(nothing — default)Stays up; serves requests; healthchecks monitor.
Job-mode (Trick)x-fibe.gg.metadata.job_mode: true + fibe.gg/job_watch: "true" on at least one serviceStarts, runs, all watched services exit, tear down.
Scheduled jobJob-mode + x-fibe.gg.metadata.schedule_configCron-driven launch of a job-mode template.
Triggered jobJob-mode + x-fibe.gg.metadata.trigger_configVCS event-driven launch (push, pull_request).

You can combine schedule + trigger on one template — Fibe will launch on either.

Choosing

input intent
├─ "deploy a web app"
│ └─ long-running, with fibe.gg/expose

├─ "run a one-off task that exits"
│ └─ job-mode (Trick), with fibe.gg/job_watch

├─ "run a one-off task every N minutes/hours/days"
│ └─ job-mode + schedule_config (cron)

└─ "run tests / CI when someone pushes to a repo"
└─ job-mode + metadata.trigger_config (push or pull_request)

Long-running HTTP (the default)

Don't add anything special. The presence of fibe.gg/expose is enough. Examples: Rails web app, WordPress, Wiki.js, nginx, Flask, FastAPI. See convert-compose-to-fibe for the standard flow.

Job-mode

Add both:

  1. x-fibe.gg.metadata.job_mode: true.
  2. fibe.gg/job_watch: "true" label on the service whose exit decides success/failure.
services:
test:
image: node:22
working_dir: /app
labels:
fibe.gg/repo_url: https://github.com/owner/repo
fibe.gg/source_mount: /app
fibe.gg/start_command: npm test
fibe.gg/job_watch: "true"
fibe.gg/production: "false"
db:
image: postgres:16
environment:
POSTGRES_PASSWORD: secret
x-fibe.gg:
metadata:
description: "Run npm test against the repo"
category: "CI"
job_mode: true

Job-mode constraints (runtime-enforced):

  • No fibe.gg/expose anywhere — job services are not user-facing.
  • Watched services must exit (not run a dev server / sleep loop).
  • Unwatched services (DB, queue, cache) just need to start; they get torn down when all watched services finish.
  • Fibe forces restart: "no" and deploy.replicas: 1 on every service in a job-mode template.
  • Fibe uses service labels to prepare the run; the job itself should behave like ordinary Compose services once started.

See mode-job-trick.

Scheduled (cron)

Add schedule_config under x-fibe.gg.metadata:

x-fibe.gg:
metadata:
description: "Nightly cleanup job"
category: "Operations"
job_mode: true
schedule_config:
enabled: true
cron: "0 3 * * *" # daily at 3:00 UTC
marquee_id: 1 # required, positive integer or its string form

Cron is the 5-field POSIX form. marquee_id must be a Marquee the Player owns. Fibe resolves the ID at scheduling time.

See mode-schedule-cron.

Triggered (VCS events)

Add trigger_config:

x-fibe.gg:
metadata:
description: "Run tests on every push to main"
category: "CI"
source_defaults: true
job_mode: true
trigger_config:
enabled: true
event_type: push # or "pull_request"
repo_url: https://github.com/owner/repo
branch: main
prop_id: 1 # the Prop that wires the source
marquee_id: 1

event_type is enum: push or pull_request. source_defaults: true on the metadata tells Fibe to auto-fill repo_url/branch from the source Prop when imported via a source-backed mechanism.

See mode-trigger-vcs.

Compatibility matrix

Template shapeCan have fibe.gg/expose?Must have job_watch somewhere?restart honored?Replicas honored?
Long-running HTTPyesnoyesyes
Job-modenoyesforced to noforced to 1
Schedulednoyesforced to noforced to 1
Triggerednoyesforced to noforced to 1

Pitfalls

  • "I want a scheduled HTTP service" — Fibe does not do this. Long-running services serve continuously; if you want periodic work behind an HTTP endpoint, use a long-running service that runs a job internally (cron in-app), OR run a job-mode template alongside.
  • "I want a triggered HTTP preview environment" — use fibe_resource_mutate(resource: "playground", operation: "create") from a webhook, not the template's trigger_config. Trigger config only fires the job-mode template, not arbitrary long-running ones.
  • Forgetting metadata.job_mode: true — services with job_watch may still not enter job lifecycle. Set both metadata job mode and a watched service label.

mode-job-trick, mode-schedule-cron, mode-trigger-vcs, reference-x-fibe-gg-namespace, playbook-test-runner, playbook-cron-scheduled.