ExLoader v0.4.1 ExLoader View Source

Documentation for ExLoader.

Link to this section Summary

Functions

load a list of apps from a release (generated by distillery) to remote node

load a single beam to a remote node

load a release (generated by distillery) to remote node

Check if given file is valid or not

Link to this section Functions

Link to this function load_apps(tarball, apps) View Source
load_apps(String.t(), [atom()]) :: {:ok, atom()} | {:error, term()}

load a list of apps from a release (generated by distillery) to remote node.

Behind the scenes, it copies the tarball to remote node, extracts it, add all beam folders by using :code.add_path, load the configration from sys.config and then start the given apps.

Examples

iex> ExLoader.load_apps("example_app.tar.gz")
:ok
iex> :rpc.call(node(), ExampleApp.Server, :hello, ["world"])
"hello world"
Link to this function load_apps(tarball, apps, remote_node) View Source
load_apps(String.t(), [atom()], node()) :: {:ok, atom()} | {:error, term()}
Link to this function load_module(beam_file) View Source
load_module(String.t()) :: {:ok, atom()} | {:error, term()}

load a single beam to a remote node

Behind the scenes, it uses :code.load_abs/1.

Examples

iex> ExLoader.load_module("hello.beam")
{:ok, Hello}
iex> :rpc.call(node(), Hello, :say, ["world"])
"hello world"
Link to this function load_module(beam_file, remote_node) View Source
load_module(String.t(), node()) :: {:ok, atom()} | {:error, term()}
Link to this function load_release(tarball) View Source
load_release(String.t()) :: {:ok, atom()} | {:error, term()}

load a release (generated by distillery) to remote node.

Behind the scenes, it copies the tarball to remote node, extracts it, add all beam folders by using :code.add_path, load the configration from sys.config and then start all the apps.

Examples

iex> ExLoader.load_release("example_complex_app.tar.gz")
:ok
iex> # assume example_complex_app.tar.gz contains a http server. Now http://hostname:8888/hello is available.
nil
iex> HttpPoison.get("http://hostname:8888/hello/?msg=world")
{:ok, %HTTPoison.Response{body: "hello world", ...}}
Link to this function load_release(tarball, remote_node) View Source
load_release(String.t(), node()) :: {:ok, atom()} | {:error, term()}
Link to this function valid_file?(src) View Source
valid_file?(String.t()) :: boolean()

Check if given file is valid or not