FlyDeploy.Poller
(FlyDeploy v0.4.1)
Copy Markdown
Polls S3 for hot upgrades and applies them automatically.
This GenServer periodically checks S3 for new hot upgrades and applies them
when detected. It compares the S3 state's source_image_ref with the local
marker file to determine if an upgrade is needed.
Usage
Add to your application's supervision tree:
def start(_type, _args) do
children = [
{FlyDeploy, otp_app: :my_app},
# ... rest of your children
]
Supervisor.start_link(children, strategy: :one_for_one)
endOptions
:otp_app- The OTP application name (required):poll_interval- How often to poll S3 in ms (default: 1000):suspend_timeout- Timeout for suspending processes during upgrade in ms (default: 10_000)
Important
Place {FlyDeploy, otp_app: :my_app} at the TOP of your children list.
The poller blocks during init/1 to apply any pending hot upgrades before
the rest of the supervision tree starts.
Efficiency
Uses ETag/If-None-Match headers to minimize bandwidth. When no upgrade is available, S3 returns a 304 Not Modified response.
Version Tracking
The poller maintains a "fingerprint" of the current code version in
:persistent_term. Access it via FlyDeploy.current_vsn/0.
Summary
Functions
Returns a specification to start this module under a supervisor.
Returns the current code version fingerprint.
Returns the current poller state for debugging.
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
Returns the current code version fingerprint.
The fingerprint is a map containing:
:base_image_ref- The base Docker image (FLY_IMAGE_REF):hot_ref- The hot upgrade source image ref (nil if no hot upgrade):version- The hot upgrade version (nil if no hot upgrade):fingerprint- A short hash combining base + hot refs
Returns nil if not yet initialized.
Returns the current poller state for debugging.