Code Monkey home page Code Monkey logo

rebar3_cuttlefish's Introduction

rebar3_cuttlefish

This plugin provides cuttlefish and automatically updates the release configuration at runtime to utilize cuttlefish. There is no need to add schema files to the relx overlay, copy the cuttlefish escript or create a custom start script, it is all handled by the plugin provider.

Add the plugin to your top level rebar config under project_plugins so it can override the default release and tar providers:

{project_plugins, [rebar3_cuttlefish]}.

Now the cuttlefish release and tar providers will be run when the release or tar task are run:

$ rebar3 release

The plugin provider will tell relx to create the dirs share/schema in the release, copy the cuttlefish escript to bin/ and discover all schema files in the project apps and their dependencies. All you should need for your relx config is:

{relx, [{release, {<name>, "0.1.0"},
        [<app_name>]},

        {dev_mode, true},
        {include_erts, false},

        {overlay_vars, "config/vars.config"}]}.
%% -*- mode: erlang;erlang-indent-level: 4;indent-tabs-mode: nil -*-
%% ex: ft=erlang ts=4 sw=4 et

%% Platform-specific installation paths
{platform_data_dir, "./data"}.

%% etc/vm.args
{node,         "<name>@127.0.0.1"}.
{crash_dump,   "{{platform_log_dir}}/erl_crash.dump"}.

Configuration

The Cuttlefish plugin can take some configuration values:

{cuttlefish,
 [{file_name, "<release>.conf.example"},
  {schema_discovery, false}]}
  • file_name will define the file the config is written to. (<release>.conf is the default)
  • schema_discovery can be set to true or false to either enable or disalbe discovering all schema files in libraries. (true is the default).

Running Multiple Nodes

Somtimes for testing you want to boot multiple nodes and require separate node names or ports, rebar3 makes this easy. First add a profile entry per node you want to run:

{profiles, [
    {node1, [{relx, [{overlay_vars, ["config/vars.config", "config/vars_node1.config"]}]}]}
    {node2, [{relx, [{overlay_vars, ["config/vars.config", "config/vars_node2.config"]}]}]}
    {node2, [{relx, [{overlay_vars, ["config/vars.config", "config/vars_node2.config"]}]}]}
]}.

For each profile create the config/vars_node<#>.config

{node, "node<#>@127.0.0.1"}.

Build each separately:

$ rebar3 as node<#> release

Run separately:

$ _build/node<#>/rel/<name>/bin/<name> console

Optional Ordering of Schemas

Since cuttlefish uses sort order of the schema files by their name you may want to prepend a number to the schema file name, like 01-eleveldb.schema. While the plugin will automatically copy all schema files for you it will first check if there is already an overlay entry for each schema file. So if in overlay there is an entry {template, "schema/eleveldb.schema", "01-eleveldb.schema"} it will not make another copy.

rebar3_cuttlefish's People

Contributors

eryx67 avatar larshesel avatar licenser avatar marianoguerra avatar rj avatar tsloughter avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.