Gatling v1.0.0 Mix.Tasks.Gatling.Deploy

  • Create a release of the last commit using EXRM
  • Create a init script for the app so it will reboot on a server reboot
  • Start the app
  • Configure Nginx go serve it

Summary

Functions

Wrapper function for every action

Executes :before or :after callback function defined in /deploy

Create an nginx.cong file to configure a reverse proxy to the deploying application. Install the file in

Copy the generated release into the deployment directory

Expand the generated Distillery release

Create a system.d script and install it in /etc/init.d/<project> If the server restarts, the deploying project will boot automatically

Create a directory in the build path of the project

Compile the application being deployed

Run the mix task mix deps.get in the project being deployed

Create static phoenix files if the project is a phoenix project

If the task mix ecto.create is available (it is assumed the deploying application has Ecto) then create the database, run migrations, and run the seeds file

Generate a release of the deploying project with Distillery

Look look for /rel/config.exs If it doesn’t exist, run mix release.init

Callback implementation for c:Mix.Task.run/1

Start the newly created service with $ service <project> start

Types

gatling_env :: %Gatling.Env{available_port: term, available_tasks: term, build_dir: term, built_release_path: term, deploy_callback_module: term, deploy_dir: term, deploy_path: term, domains: term, etc_dir: term, etc_path: term, git_hook_path: term, nginx_available_path: term, nginx_dir: term, nginx_enabled_path: term, nginx_template: term, project: term, release_config_path: term, releases: term, script_template: term, upgrade_callback_module: term, upgrade_dir: term, upgrade_path: term, version: term}
project :: binary

Functions

call(env, action)

Specs

call(gatling_env, :before | :after) :: gatling_env

Wrapper function for every action.

Executes the :before_<action> and :after_<action> functions defined in /deploy.

callback(env, action, type)

Specs

callback(gatling_env, atom, :before | :after) :: gatling_env

Executes :before or :after callback function defined in /deploy.

configure_nginx(env)

Specs

configure_nginx(gatling_env) :: gatling_env

Create an nginx.cong file to configure a reverse proxy to the deploying application. Install the file in:

/etc/nginx/sites-available/<project>

and symlink it in:

  • /etc/nginx/sites-enabled/<project>

Then reload nginx’s configuration Note: if you already have an nginx.conf file in /etc/nginx/sites-available/<project> this will not run.

copy_release_to_deploy(env)

Specs

copy_release_to_deploy(gatling_env) :: gatling_env

Copy the generated release into the deployment directory

deploy(project)

Specs

deploy([project]) :: gatling_env

The main function of Mix.Tasks.Gatling.Deploy

expand_release(env)

Specs

expand_release(gatling_env) :: gatling_env

Expand the generated Distillery release

install_init_script(env)

Specs

install_init_script(gatling_env) :: gatling_env

Create a system.d script and install it in /etc/init.d/<project> If the server restarts, the deploying project will boot automatically.

Also makes the following comands (created by distillery) available in your deployment server:

$ sudo service <project> start|start_boot <file>|foreground|stop|restart|reboot|ping|rpc <m> <f> [<a>]|console|console_clean|console_boot <file>|attach|remote_console|upgrade|escript|command <m> <f> <args>
make_deploy_dir(env)

Specs

make_deploy_dir(gatling_env) :: gatling_env

Create a directory in the build path of the project

mix_compile(env)

Specs

mix_compile(gatling_env) :: gatling_env

Compile the application being deployed

mix_deps_get(env)

Specs

mix_deps_get(gatling_env) :: gatling_env

Run the mix task mix deps.get in the project being deployed

mix_digest(env)

Specs

mix_digest(gatling_env) :: gatling_env

Create static phoenix files if the project is a phoenix project

mix_ecto_setup(env)

Specs

mix_ecto_setup(gatling_env) :: gatling_env

If the task mix ecto.create is available (it is assumed the deploying application has Ecto) then create the database, run migrations, and run the seeds file.

mix_release(env)

Specs

mix_release(gatling_env) :: gatling_env

Generate a release of the deploying project with Distillery

mix_release_init(env)

Specs

mix_release_init(gatling_env) :: gatling_env

Look look for /rel/config.exs If it doesn’t exist, run mix release.init

run(list)

Specs

run([project]) :: gatling_env

Callback implementation for c:Mix.Task.run/1.

start_service(env)

Specs

start_service(gatling_env) :: gatling_env

Start the newly created service with $ service <project> start