Akd v0.2.1 Akd.Publish.Distillery View Source

A native Hook module that comes shipped with Akd.

This module uses Akd.Hook.

Provides a set of operations that copies a built distillery release from the build_at location to publish_to destination, and then publishes the release (by uncompressing the released tar file).

Ensures to remove the tar.gz file created by this build.

Doesn’t have any Rollback operations.

When using SCP to transfer between two remote nodes you must ensure they can communicate. This can be done by setting up authorized keys and known hosts on the destination server, or using your local credentials (see: scp_options). You will still require known hosts. Alternatively, you can use your local computer as an intermediate destination (no examples provided yet).

Options:

  • run_ensure: boolean. Specifies whether to a run a command or not.
  • ignore_failure: boolean. Specifies whether to continue if this hook fails.
  • scp_options: string. options to pass to the SCP command, example: “-o “ForwardAgent yes””

Defaults:

  • run_ensure: true
  • ignore_failure: false
  • scp_options: ""

Link to this section Summary

Functions

Callback implementation for get_hooks/2

Link to this section Functions

Link to this function get_hooks(deployment, opts) View Source
get_hooks(Akd.Deployment.t(), Keyword.t()) :: [Akd.Hook.t()]
get_hooks(Akd.Deployment.t(), list()) :: Akd.Hook.t()

Callback implementation for get_hooks/2.

This function returns a list of operations that can be used to publish a release using distillery on the publish_to destination of a deployment.

Examples

iex> deployment = %Akd.Deployment{mix_env: "prod",
...> build_at: Akd.Destination.local("."),
...> publish_to: Akd.Destination.local("."),
...> name: "name",
...> vsn: "0.1.1"}
iex> Akd.Publish.Distillery.get_hooks(deployment, [])
[%Akd.Hook{ensure: [%Akd.Operation{cmd: "rm ./name.tar.gz",
      cmd_envs: [],
      destination: %Akd.Destination{host: :local, path: ".",
       user: :current}}], ignore_failure: false,
    main: [%Akd.Operation{cmd: "cp ./_build/prod/rel/name/releases/0.1.1/name.tar.gz .\n",
      cmd_envs: [],
      destination: %Akd.Destination{host: :local, path: ".",
       user: :current}}], rollback: [], run_ensure: true},
   %Akd.Hook{ensure: [], ignore_failure: false,
    main: [%Akd.Operation{cmd: "cd .\ntar xzf name.tar.gz\n",
      cmd_envs: [],
    destination: %Akd.Destination{host: :local, path: ".",
         user: :current}}], rollback: [], run_ensure: true}]