Bootleg Nginx Conf

Bootleg task to upload nginx config template to remote servers (those that belong to the :app role).

Installation

Add bootleg_nginx_conf to your list of dependencies in mix.exs:

def deps do
  [
    {:bootleg_nginx_conf, "~> 0.1.0"}
  ]
end

Configurable options are set in the config/deploy.exs.

Example:

# ./config/deploy.exs

use Bootleg.DSL

config(:nginx_config_name, "app_name")
config(:nginx_template, "./config/deploy/templates/nginx_conf.eex")
config(:nginx_sites_available_path, "/opt/nginx/sites-available")
config(:nginx_sites_enabled_path, "/opt/nginx/sites-enabled")

Example nginx template:

The config defined in config/deploy.exs can be accessed in the template file using EEx. (Example: <%= nginx_template %>)

# ./config/deploy/templates/nginx_conf.eex

upstream phoenix_app {
    server unix:/home/deploy/app/app.socket fail_timeout=0;
}

Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/bootleg_nginx_conf.