Job
A Job in Maand is a deployable folder containing configuration and execution logic. Jobs are assigned to workers based on matching labels.
Job Structure
A job folder must include:
manifest.json
- Defines the labels the job applies to.
Makefile
- Includes targets (
start
,stop
,restart
) that define the job's lifecycle operations.
- Includes targets (
Job Allocation
- Label vs Selector: When the selectors in
manifest.json
match the labels assigned to a worker, Maand allocates the job folder to that worker. - Dynamic Variable Replacement: Variables assigned to workers (based on selectors) are stored in a key-value (KV) database when
maand build
is called. These variables are replaced with actual values duringmaand deploy
.
Makefile Targets
Maand expects the following targets in the job's Makefile
:
start
Defines the logic to initialize/start or run the job.stop
Handles stopping/cleaning up the job.restart
Combines thestop
andstart
targets for job restarts.
Important Note:
- These targets must not be long-running tasks. They should execute quickly and complete within a reasonable timeframe.
Workflow
-
Build Configuration:
$ maand build
- Generates variables for agents based on roles and updates the KV database.
-
Deploy Job:
$ maand deploy
- Allocates the jobs to matching workers and replaces variables in the configuration with actual values.