Gatling v1.0.0 Gatling.Utilities

Used by Gatling to generate the %Gatling.Env{}

Summary

Functions

Find an open port

Path to the git repo for given project

Location of the release after it’s been generated. Located inside the build_dir

Module defined in the project under ./upgrade.exs or ./deploy.exs

Directory to running applications

Path to deployed project

Read the projects ./domains file to be used when configuring nginx

Default system path to linux init.d scripts

Path to project’s init.d script

Path to the projects git post-update hook

Template used when loading a new project for the git post-update hook

List of all available mix tasks that can be run by the given project

Default system path to nginx sites-available

Default system path to nginx

Default system path to nginx sites-enabled

Template used to configure nginx

Path to Distillery’s config.exs file which is generated when calling mix release.init

List all releases found in ~//rel//releases

Template used for the init.d script

Path to put the “upgrade” releases

Path to put the “upgrade” release’s .tar file

Find the version number of the project being deployed

Types

project :: binary

Functions

available_port()

Specs

available_port :: integer

Find an open port

build_dir(project)

Specs

build_dir(project) :: binary

Path to the git repo for given project

This the build steps heppen here:

  • Install dependencies
  • Compile
  • Generate release

~/<project>/

built_release_path(project)

Specs

built_release_path(project) :: binary

Location of the release after it’s been generated. Located inside the build_dir

~/<project>/rel/<project>/releases/<version>/<project>.tar.gz

callback_module(project, list)

Specs

callback_module(project, [{:task, :upgrade | :deploy}]) :: module

Module defined in the project under ./upgrade.exs or ./deploy.exs

deploy_dir(project)

Specs

deploy_dir(project) :: binary

Directory to running applications

~/deployments/

deploy_path(project)

Specs

deploy_path(project) :: binary

Path to deployed project

~/deployments/<project>

domains(project)

Specs

domains(project) :: binary
domains(project) :: binary

Read the projects ./domains file to be used when configuring nginx

etc_dir()

Specs

etc_dir :: binary

Default system path to linux init.d scripts

/etc/init.d/

etc_path(project)

Specs

etc_path(project) :: binary

Path to project’s init.d script

/etc/init.d/<project>

git_hook_path(project)

Path to the projects git post-update hook

~/<project>/.git/hooks/post-update

git_hook_template(assigns)

Specs

git_hook_template(domains: list, port: integer) :: binary

Template used when loading a new project for the git post-update hook

#!/bin/sh

unset GIT_DIR
exec sudo mix gatling.receive <%=@project%>
mix_tasks(project)

Specs

mix_tasks(project) :: [binary]

List of all available mix tasks that can be run by the given project

nginx_available_path(project)

Specs

nginx_available_path(project) :: binary

Default system path to nginx sites-available

/etc/nginx/sites-available/

nginx_dir()

Specs

nginx_dir :: binary

Default system path to nginx

/etc/nginx

nginx_enabled_path(project)

Specs

nginx_enabled_path(project) :: binary

Default system path to nginx sites-enabled

/etc/nginx/sites-enabeld

nginx_template(assigns)

Specs

nginx_template(domains: list, port: integer) :: binary

Template used to configure nginx

server {
  listen 80;
  server_name <%= @domains %>;

  location / {
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $http_host;
    proxy_redirect off;
    proxy_pass http://localhost:<%=@port%>;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
  }

}
release_config_path(project)

Specs

release_config_path(project) :: binary

Path to Distillery’s config.exs file which is generated when calling mix release.init

~/<project>/rel/config/exs

releases(project)

Specs

releases(project) :: [binary]

List all releases found in ~//rel//releases

script_template(assigns)

Specs

script_template(project_name: project, port: integer) :: binary

Template used for the init.d script.

If/when the server starts, this will boot your project

#!/bin/sh

### BEGIN INIT INFO
# Provides:          <%= @project_name %>
# Required-Start:    $local_fs $network $named $time $syslog
# Required-Stop:     $local_fs $network $named $time $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Description:       Plug Application: <%= @project_name %>
### END INIT INFO

export MIX_ENV=prod
export PORT=<%= @port %>
export HOME=<%= System.user_home %>/deployments/<%= @project_name %>

<%= System.user_home %>/deployments/<%=@project_name%>/bin/<%=@project_name%> "$1" "$2"
upgrade_dir(project)

Specs

upgrade_dir(project) :: binary

Path to put the “upgrade” releases

~/deployments/<project>/releases/<version>

upgrade_path(project)

Specs

upgrade_path(project) :: binary

Path to put the “upgrade” release’s .tar file

~/deployments/<project>/releases/<version>/<project>.tar.gx

version(project)

Specs

version(project) :: binary

Find the version number of the project being deployed