Configuration
checkship can be configured from a yaml file and/or environment variables. Environment variables will always take precedence over the configuration file.
When configured using a file, you can provide it with the -c <your_file.yml> or --config <your_file.yml>.
If the configuration file does not exist, it will be created with the initial configuration.
INFO
Environment variables can also be defined in a .env or .env.local file in the working directory when launching checkship.
Reference
| yaml path / env name(s) | Description | Default value |
|---|---|---|
| log.level LOG_LEVEL | Log level to use (info, warn or error) | info |
| log.format LOG_FORMAT | Format of the logs (json, console) | console |
| data.path DATA_PATH | Where data produced by checkship will be saved (deployment artifacts, logs, local db, …) | ~/.config/checkship |
| data.deployment_dir_template DEPLOYMENT_DIR_TEMPLATE | Go template determining the directory where the build will occur (use {{ .Number }}-{{ .Environment }} if you want to keep all application deployment sources for example) | {{ .Environment }} |
| source.archive.max_size SOURCE_ARCHIVE_MAX_SIZE | Largest archive accepted when deploying from an uploaded file, with a unit: b, kb, mb, gb or tb (powers of 1024), such as 64mb | 32mb |
| backups.helper_image BACKUPS_HELPER_IMAGE | Image that mounts each volume during a backup or a restore | busybox:1.37 |
| backups.storage_image BACKUPS_STORAGE_IMAGE | Image of the built-in backup storage | versity/versitygw:v1.11.0 |
| backups.max_upload_size BACKUPS_MAX_UPLOAD_SIZE | Largest backup archive accepted by Upload backup, with a unit: b, kb, mb, gb or tb (powers of 1024) | 5gb |
| backups.before_cleanup BACKUPS_BEFORE_CLEANUP | Back up volumes before checkship removes them: application deleted, environment moved to another target (see) | true |
| http.host HTTP_HOST | Host to listen to | 0.0.0.0 |
| http.port HTTP_PORT,PORT | Port to listen to | 8080 |
| http.secure HTTP_SECURE | Wether or not the web server is served over https. If omitted, determine this information from the EXPOSED_ON variable. It controls wether or not cookie are set with the Secure flag and the scheme used on the Location header of created resources | false |
| http.secret HTTP_SECRET | Secret key to use when signing cookies | <generated if empty> |
| runners RUNNERS_CONFIGURATION | Runners processing the background jobs, see below | see below |
| - ADMIN_EMAIL | Email of the first user account to create (ignored if a user already exists) | |
| - ADMIN_PASSWORD | Password of the first user account to create (ignored if a user already exists) | |
| - EXPOSED_ON | Url at which the checkship container will be exposed and default target url. In the form <url scheme>://<container name>@<default target url> |
Runners
Background jobs are processed by runners. Each runner checks for new jobs at a regular interval and runs up to count of them at the same time. Runners work independently, so a long queue of deployments doesn't hold up cleanups or target configurations.
A job also starts as soon as it is queued, or as soon as a worker of its runner becomes free. The poll interval is a fallback.
The default configuration has one runner for deployments, one for volume copies (backups, restores, uploads to the backup storage), which can take minutes and must not hold back cleanups, and one for every other job:
runners:
- poll_interval: 4s
count: 4
jobs:
- deployment.command.deploy
- poll_interval: 4s
count: 1
jobs:
- deployment.command.backup_volumes
- deployment.command.restore_volumes
- deployment.command.store_backup
- poll_interval: 4s
count: 2| yaml path | Description |
|---|---|
| poll_interval | Interval at which the runner checks for jobs, parsed by time.ParseDuration. At least 500ms |
| count | Number of jobs the runner can process at the same time, between 1 and 64 |
| jobs | Names of the jobs handled by this runner. Required on every runner except the last one: when the last runner has no jobs, it handles every job not listed elsewhere |
Job names:
deployment.command.deploydeployment.command.cleanup_appdeployment.command.delete_appdeployment.command.configure_targetdeployment.command.cleanup_targetdeployment.command.delete_targetdeployment.command.backup_volumesdeployment.command.restore_volumesdeployment.command.store_backupdeployment.command.configure_storage
Every job must be handled by exactly one runner. checkship refuses to start if a job is listed twice, if a name is unknown, or if a job is handled by no runner. If every job is already listed and the last runner has no jobs, that runner is not started and a warning is logged.
For example, to deploy up to 8 applications at once and configure targets apart from the cleanups:
runners:
- poll_interval: 4s
count: 8
jobs:
- deployment.command.deploy
- poll_interval: 4s
count: 1
jobs:
- deployment.command.configure_target
- poll_interval: 10s
count: 2With an environment variable
RUNNERS_CONFIGURATION replaces the runners section of the file. Each runner is written <poll_interval>;<count>;<job names separated by commas> and runners are separated by |. The default configuration is:
RUNNERS_CONFIGURATION="4s;4;deployment.command.deploy|4s;2;" checkship serveAn empty RUNNERS_CONFIGURATION is ignored.
Older settings
Before runners could be listed, the configuration had three settings. They still work, and checkship logs a warning when it finds them:
- In the file,
runners.poll_interval,runners.deploymentandrunners.cleanupare read as the default pair of runners. - The
RUNNERS_POLL_INTERVAL,RUNNERS_DEPLOYMENT_COUNTandRUNNERS_CLEANUP_COUNTvariables replace the runners with the default pair, built from their values. They are ignored whenRUNNERS_CONFIGURATIONis set.
The configuration file is not rewritten. Move to the list format when convenient.