View Source mix horizon.bsd.init (horizon v0.1.2)

Creates Horizon.Ops deploy scripts in bin/ and rel/ directories.

Usage

mix horizon.bsd.init [-y]

Options

  • -y - Overwrite files without asking for confirmation.

Description

Horizon.Ops.Bsd.init creates several scripts for deploying an Elixir application to a host. Horizon.Ops.Bsd is customized for FreeBSD hosts. Use Horizon.Oos.Linux for Linux hosts.

Customization

Horizon.Ops.Bsd.init uses the releases configuration in mix.exs to customize the deployment scripts. The available options are:

  • bin_path: default :bin
  • path: default: /usr/local/<app_name>
  • build_user: default: whoami
  • build_host: default: HOSTUNKNOWN
  • deploy_user: default: whoami
  • deploy_host: default: HOSTUNKNOWN
  • release_commands: default: []
  • releases_path: default: .releases

bin_path

The directory where the scripts are created. If there is a bin_path for each release, scripts are copied to each bin directory.

path

The final destination of the release on the deploy host. This will be the same on deploy only hosts and the build host.

build_user

The username on the build machine. This is used to copy the release to the build machine. This is used by the stage script to copy the release to the build machine, but may be overridden on the commandline.

build_host

The hostname of the build machine. This is used to copy the release to the build machine. This is used by the stage script to copy the release to the build machine, but may be overridden on the commandline.

deploy_user

The username on the deploy machine. This is used to copy the release to the deploy machine.

deploy_host

The hostname of the deploy machine. This is used to copy the release to the deploy machine.

release_commands

A list of commands to run after the release is copied to the deploy machine. These commands should be 0 arity functions in Release.ex.

releases_path

The directory where releases are stored on the local host. The build script places the release tarball in this directory and the deploy script copies the release from this directory.

Files Created

Running mix horizon.init creates several files in the bin_path directory. For the project my_app, these files include:

  • bsd_install.sh
  • bsd_install_args.sh
  • bsd_install_script.sh
  • horizon_helpers.sh
  • release-my_app.sh
  • build-my_app.sh
  • stage-my_app.sh
  • deploy-my_app.sh
  • deploy_script-my_app.sh

If you have multiple releases, a stage, and build and deploy script is created for each release. For example, imagine you have releases app_web and app_worker. Horizon.Ops.BSD.init will create

  • bin/stage-app_web.sh
  • bin/stage-app_worker.sh
  • bin/build-0app_web.sh
  • bin/build-0app_worker.sh
  • bin/deploy-app_web.sh
  • bin/deploy-app_worker.sh

An rc.d script is created in rel/overlays/rc_d/ for each release.