View Source Cluster.Strategy.Droplet (libcluster_droplet v1.1.2)
A libcluster strategy for Digital Ocean Droplets. Check out the README to get started.
Link to this section Summary
Functions
Returns a specification to start this module under a supervisor.
Returns the Droplet metadata top-level index, or specific metadata values.
Makes a request to the Digital Ocean API for a list of droplets and recurses through the pages.
Runs a health check for the provided IP address.
Starts a GenServer to poll the Digital Ocean API for a list of nodes to add to the cluster.
Converts a droplet map returned from the Digital Ocean API to a node name such as
:"foobar@127.0.0.1"
.
Returns a list of node names as described in to_node_name/2
.
Link to this section Functions
Returns a specification to start this module under a supervisor.
See Supervisor
.
Returns the Droplet metadata top-level index, or specific metadata values.
See https://docs.digitalocean.com/products/droplets/how-to/retrieve-droplet-metadata/
Makes a request to the Digital Ocean API for a list of droplets and recurses through the pages.
Will return a parsed list of node names derived from the droplet objects. Expects a full URL and
a valid access token to be passed. Logs a warning and returns :error
if the API didn't return
a successful response.
Runs a health check for the provided IP address.
Starts a GenServer to poll the Digital Ocean API for a list of nodes to add to the cluster.
Any nodes currently in the cluster that are no longer returned from the API will be removed from the cluster. Filtering can be done by tag name or Droplet name, but not both. Otherwise an exception will be raised. The current Droplet will be excluded so the node doesn't try to connect to itself.
If there is an issue making the API request, the node list is kept as is with no changes. This is because we don't want all the nodes tp disconnect from each other if the Digital Ocean API goes down.
Converts a droplet map returned from the Digital Ocean API to a node name such as
:"foobar@127.0.0.1"
.
Will optionally run a health check on the node to ensure it is ready to connect to the cluster. Returns nil if the health check fails, or if the droplet doesn't have an address for the defined network type and ip version.
Returns a list of node names as described in to_node_name/2
.
Will not return node names for droplets that don't have a status of "active", or that match the provided ID of the current droplet.