Deployment

Using without Releases

It's recommended to create an escript or mix task to perform the Realbook operations. Guidelines for this process will be forthcoming.

Deployment using Mix Releases

With scripts in a generic location.

  1. Create an entrypoint function (e.g. MyApp.go/1). Let's say this function takes the :script_dir as a parameter and sets that application, then launches the script(s)
  2. Upload your scripts (and assets) to your provisioning server (for example ~/my_scripts)
  3. Perform a release and transfer your application to the provisioning server.
  4. Execute the realbooks.
    > path/to/release/my_app eval 'MyApp.go "~/my_scripts"'

With scripts and assets in the priv/ directory

  1. store your scripts and assets in, for example priv/scripts and priv/assets

  2. create an entrypoint function that sets :script_dir as follows:

    script_dir = :my_app
    |> :code.priv_dir
    |> Path.join("scripts")
    Application.put_env(:realbook, :script_dir, script_dir)
  3. repeat with :assets_dir

  4. Perform a release and transfer the application to the provisioning server.

  5. Execute the realbooks.

    > path/to/release/my_app eval 'MyApp.go'

The advantage to the latter method is that it allows you to package your scripts with your deployment. If for some reason you want to keep them separate, (for example, if they are shared in a repo between multiple projects) then you should use the former method.