Skip to content

Application Manifest (app.toml)

Every application deployed to MicroFly must contain an app.toml configuration file in its root directory. MicroFly strictly parses and validates this file prior to staging any release.

Unknown fields or invalid values cause immediate deployment rejection to prevent configuration drift.


Full Example Manifest

toml
schema_version = 1
name = "api-service"
type = "binary"
domain = ["api.example.com", "*.api.internal.net"]

[runtime]
args = ["./bin/server", "--config", "config.json", "--port", "{PORT}"]
workdir = "."
env = { "LOG_LEVEL" = "info", "CACHE_ENABLED" = "true" }

[scale]
scale_to_zero = true
idle_timeout = "2m"
min_instances = 0
max_instances = 1

[health_check]
path = "/healthz"
expected_status = 200
interval = "150ms"
timeout = "5s"
initial_delay = "0s"

[storage]
mounts = [
  { source = "sqlite.db", target = "data/app.db" },
  { source = "uploads", target = "public/uploads" }
]

[preview]
ttl = "48h"

[resources]
memory_limit = "512MB"
memory_soft = "384MB"
cpu_quota = 1.5
pids_max = 200
nofile = 2048
request_body_limit = "15MB"
storage_limit = "2GB"

[deploy]
release_command = ["./bin/server", "migrate"]

[webhook]
enabled = true
repository = "my-org/api-service"
branch = "main"
secret = "env:WEBHOOK_SECRET"

[[cron]]
name = "daily-cleanup"
schedule = "0 3 * * *"
command = ["./bin/server", "cleanup-cache"]

[[cron]]
name = "hourly-sync"
schedule = "0 * * * *"
command = ["./bin/server", "sync-metrics"]

Field Reference

Root Fields

FieldTypeRequiredDefaultDescription
schema_versionIntegerYes-Must be 1.
nameStringYes-Application identifier (1-63 lowercase alphanumeric chars and hyphens).
typeStringYes"binary"Workload type: "binary", "java" (JAR), or "static" (static web app / SPA).
domainArray of StringsYes-List of hostnames or wildcard domains (*.example.com) routed to this app.

[static]

Configures static file hosting and HTTP cache headers for type = "static".

FieldTypeDefaultDescription
directoryString"."Path to static assets relative to release root (e.g. "dist", "public").
indexString"index.html"Default directory index file name.
spaBooleanfalseWhen true, routes missing non-file paths to index.html for client-side routers.
clean_urlsBooleanfalseWhen true, resolves extensionless paths like /about to /about.html.
cache_controlString"public, max-age=3600"Default Cache-Control header for standard assets.
asset_cache_controlString"public, max-age=31536000, immutable"Long-term immutable Cache-Control for fingerprinted assets.
html_cache_controlString"no-cache, must-revalidate"Cache-Control applied to HTML entrypoints and SPA fallback routes.
asset_patternsArray of Strings["/assets/*", "*.js", ...]Glob patterns matching fingerprinted assets.
headersTable{}Custom HTTP response headers (e.g. security headers).

[runtime]

Controls process execution and startup parameters.

FieldTypeDefaultDescription
argsArray of StringsRequiredCommand line arguments. The token {PORT} is dynamically replaced with the assigned unprivileged port.
workdirString"."Working directory relative to the release root.
envTable{}Static environment key-value pairs.
uidInteger0 (Auto)Explicit POSIX UID. If 0, MicroFly resolves a stable system account (microfly-app).
gidInteger0 (Auto)Explicit POSIX GID. If 0, matches UID.

[scale]

Controls scale-to-zero and automatic lifecycle behavior.

FieldTypeDefaultDescription
scale_to_zeroBooleanfalseWhen true, stops the application when idle.
idle_timeoutDuration String"5m"Inactivity duration before stopping the process (e.g. "30s", "5m", "1h").
min_instancesInteger0Minimum active instances (0 for scale-to-zero, 1 for always running).
max_instancesInteger1Maximum active instances per application (currently fixed to 1 on single-host).

[health_check]

Configures the pre-flight health probe required before traffic switches to a new release.

FieldTypeDefaultDescription
pathString""HTTP path to probe (e.g., "/healthz"). If empty, TCP socket connect is used.
expected_statusInteger200HTTP response code required to declare the workload healthy.
intervalDuration String"100ms"Frequency of health check polling during startup.
timeoutDuration String"10s"Maximum duration allowed for the app to become healthy before rolling back.
initial_delayDuration String"0s"Grace period to wait before initiating the first probe.

[storage]

Configures persistent storage volumes that persist across releases and rollbacks.

toml
[storage]
mounts = [
  { source = "database", target = "data/db" }
]
  • source: Path relative to the application's persistent storage root (/var/lib/microfly/apps/<app>/shared/storage/).
  • target: Path inside the release directory where the volume will be mounted.

[preview]

Configures ephemeral branch preview environments.

FieldTypeDefaultDescription
ttlDuration String"48h"Time-to-live before preview applications are automatically swept by the cleaner.

[resources]

Enforces kernel-level resource limits via Linux cgroups v2.

FieldTypeDefaultDescription
memory_limitStringUnlimitedHard memory limit (e.g., "256MB", "1GB"). Exceeding triggers Linux OOM killer.
memory_softStringUnlimitedSoft memory limit (cgroup memory.high) triggering memory reclamation.
cpu_quotaFloatUnlimitedCPU cores quota (e.g., 1.0 = 1 full core, 0.5 = 50% of one core).
pids_maxIntegerUnlimitedMaximum concurrent threads/processes allowed in the unit.
nofileInteger1024Maximum open file descriptors (ulimit -n).
request_body_limitString"10MB"Maximum HTTP upload body size accepted by ingress.
storage_limitStringUnlimitedMaximum disk usage allowed for the application's persistent storage.

[network]

Configures kernel-level eBPF socket filtering and network isolation via systemd (IPAddressAllow= / IPAddressDeny=).

FieldTypeDefaultDescription
allow_outboundBooleantrueWhen false, blocks all outbound network connections; the application can only receive ingress traffic on localhost.
deny_private_networksBooleanfalseWhen true, blocks egress to RFC 1918 private subnets (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, 169.254.0.0/16).
allowed_egressArray of Strings[]Explicit list of CIDR prefixes allowed for outbound connections (e.g. ["1.1.1.1/32"]).
denied_egressArray of Strings[]Explicit list of CIDR prefixes denied for outbound connections.

[deploy]

FieldTypeDefaultDescription
release_commandArray of Strings[]One-off command executed inside the candidate release before health checks (e.g., database migrations). If it exits non-zero, deployment aborts immediately.

[webhook]

Configures Git webhook automation (GitHub / GitLab).

FieldTypeDefaultDescription
enabledBooleanfalseEnables the webhook endpoint (POST :8082/api/webhooks/<app>).
repositoryString""Expected repository name (e.g. "owner/repo").
branchString"main"Monitored branch for automatic deployments.
secretString""Webhook HMAC secret reference (e.g. "env:WEBHOOK_SECRET").

[[cron]]

Defines scheduled tasks executed in the background inside the application environment. Multiple [[cron]] tables can be defined.

FieldTypeRequiredDescription
nameStringYesName of the scheduled job.
scheduleStringYesStandard 5-field cron expression in UTC (e.g., "*/15 * * * *").
commandArray of StringsYesCommand line arguments to execute.

Released under the MIT License.