# Deploying with Distillery

* :otp_app has to be set in config/config.exs || config/prod.exs
* `priv/static` can be used for public assets instead of `public`
* Distillery config has to be provided


# Considerations

* Backwards compat with nginx public asset serving
* Backwards compat with Plug static asset serving
* Webpack config update

# How to test newly scaffolded app

## Scenario - Distillery Build

* Build the installer
* Run mix kitto.new something
* Build assets with `yarn run build`
* Build the release with `MIX_ENV=prod mix release --env=prod`
* Try the release

## Scenario - MIX_ENV=prod mix kitto.server

* Build it `mix deps.compile`
* Try it `MIX_ENV=prod mix kitto.server`

# TODOs

* Setup a pre-release hook to compile assets ✔️
* Setup a pre-release hook to copy `dashboards` and `jobs` to priv ✔️
* Set Kitto.root to Application.app_dir for distillery (Add comment in installer template) ✔️
* Try the --executable flag


## Usage Instructions

* Add distillery 1.3.1 as a dependency in your mix.exs and `mix deps.get`
* Change config/prod.exs to have `config :kitto, root: :otp_app
* Run `MIX_ENV=prod mix release --env=prod` to create the release

## Testers Instructions

1. Install 0.6.0-rc0 installer `mix archive.install https://github.com/kittoframework/archives/raw/master/kitto_new-0.6.0-rc0.ez`
1. Generate a new dashboard application `mix kitto.new something`
1. `cd something`
1. Change `mix.exs` to point to kitto at version `0.6.0-rc0`
* Add distillery 1.3.1 as a dependency in your mix.exs and `mix deps.get`
* Change config/prod.exs to have `config :kitto, root: :otp_app
* Run `MIX_ENV=prod mix release --env=prod` to create the release
