mix fly_deploy.hot (FlyDeploy v0.1.13)
Performs a hot code upgrade without restarting the application.
Quick Start
# Zero configuration - everything auto-detected from fly.toml
mix fly_deploy.hot
# Use staging config
mix fly_deploy.hot --config fly-staging.toml
# Pass Docker build arguments
mix fly_deploy.hot --build-arg ELIXIR_VERSION=1.18.2 --build-arg OTP_VERSION=27.1.2
# Preview without executing
mix fly_deploy.hot --dry-runConfiguration
Configuration is merged from multiple sources with priority:
CLI options > Mix config > fly.toml > Auto-detected defaultsfly.toml (or --config custom fly toml file)
The [env] section is automatically read and passed to orchestrator machines:
[env]
AWS_ENDPOINT_URL_S3 = "https://fly.storage.tigris.dev"
AWS_REGION = "auto"
AWS_BUCKET = "my-app-staging"Mix Config
In config/config.exs:
config :fly_deploy,
bucket: "my-releases",
max_concurrency: 10,
env: %{
"CUSTOM_VAR" => "value"
}CLI Options
--config- Path to fly.toml file (default: "fly.toml")--skip-build- Skip building and use existing image (requires --image)--image- Use specific pre-built image--build-arg- Pass build-time variables to Docker (can be used multiple times)--dry-run- Show what would be done without executing--force- Override deployment lock (use with caution)--lock-timeout- Lock expiry timeout in seconds (default: 300)
Required Setup
- Fly CLI must be authenticated:
fly auth login - App secrets must include
AWS_ACCESS_KEY_IDandAWS_SECRET_ACCESS_KEYfor Tigris/S3 - App secrets must include
FLY_API_TOKEN(used by orchestrator machine)
How It Works
- Build Phase: Builds Docker image with
fly deploy --build-only - Orchestrator Phase: Spawns temporary machine with new image
- Tarball Phase: Orchestrator creates tarball of all .beam files
- Upload Phase: Uploads tarball to Tigris/S3
- Reload Phase: Each app machine downloads and extracts tarball
- Upgrade Phase: Processes are upgraded using :sys.change_code/4
The orchestrator machine automatically has access to app secrets and
environment variables from the [env] section of your fly.toml.
Safety
- Processes are suspended before code loading (prevents race conditions)
- Only proc_lib processes are upgraded (filters out Tasks)
- Machines can be upgraded concurrently or sequentially
- Each process upgrade is isolated with error handling
- Rollback support (coming soon)