[erlang-questions] Modern Cuttlefish?

Code Wiget codewiget95@REDACTED
Wed Oct 31 15:01:49 CET 2018


Mariano,

I have been using rebar3_cuttlefish for all of my projects, the issue is still there. It uses cuttlefish which is very out of date and doesn’t give any useful error information.

Joe,

Cuttlefish(https://github.com/tsloughter/rebar3_cuttlefish, https://github.com/basho/cuttlefish) is a tool that takes configuration parameters and converts them to an erlang config file. For example, you could have a simple(.conf) file:

> host = 127.0.0.1
> Port = 8883

And using mappings in a schema, you can convert that to part of a system config file (.config)
> {http_app, [
>      {host, “127.0.0.1”},
>      {port, 8883}
> ]}.

It can also take multiple values from the .conf file into a larger .config file, and mutate them using translations. Its a cool tool. For example, I use it(in one use case)to set the log locations for lager using a translation. I set

> log_file = /var/log/app1/console.log
> log_level = debug


And then I translate that into


> {lager_file_backend,
>           [{file,"/var/log/app1/console.log"},
>            {level,debug},
>            {formatter,lager_default_formatter},
>            {formatter_config,
>                [date," ",time," [",severity,"] ",pid," ",message,
                "\n"]}]}

It makes for easy and dynamic configuration. The issue is that 1) it’s super old and unsupported, and 2) it gives no error information when there is an issue in configuration.

On Oct 31, 2018, 5:19 AM -0400, Mariano Guerra <mariano@REDACTED>, wrote:
> On Wed, Oct 31, 2018 at 10:15 AM Mariano Guerra <mariano@REDACTED> wrote:
> > >
> > > > On Tue, Oct 30, 2018 at 4:43 PM Code Wiget <codewiget95@REDACTED> wrote:
> > > > > Hi everyone,
> > > > >
> > > > > Do any of you use/have/know of a “modern” version of cuttlefish? Cuttlefish is great because it allows for easy user configuration, an advanced configuration, and easy mappings, but then you create a release and get errors like this with 0 context:
> > > > >
> > > >
> > > > hi, I use if for all my projects, it works pretty well with the rebar3_cuttlefish plugin (https://hex.pm/packages/rebar3_cuttlefish/)
> > > >
> > > > if you want to see a setup that works check the rebar3 riak-core template https://marianoguerra.github.io/riak-core-tutorial/setup.html#install-riak-core-rebar3-template you don't need to use it, just create the project and check rebar.config and the config folder
> >
> > I noticed that the next step is in a later section: https://marianoguerra.github.io/riak-core-tutorial/setup.html#test-that-everything-works
> >
> > to summarize here:
> >
> > mkdir -p ~/.config/rebar3/templates
> > git clone https://github.com/marianoguerra/rebar3_template_riak_core.git ~/.config/rebar3/templates/rebar3_template_riak_core
> > rebar3 new rebar3_riak_core name=akv
> > cd akv
> > make
> > make console
> >
> >
> > > >
> > > > > > Cuttlefish failed! Oh no!
> > > > >
> > > >
> > > > when I get that error I go to the script, add some prints and run the offending line by hand, usually it's some erlang version problem, format error or similar.
> > > >
> > > > that message doesn't come from cuttlefish itself but from the script that runs it, in my case it's this line:
> > > >
> > > > CUTTLEFISH_CONFIG=$($CUTTLEFISHCMD -e $RUNNER_ETC_DIR -d $RUNNER_GEN_DIR/generated.conf -s $RUNNER_BASE_DIR/share/schema/ -c $RUNNER_ETC_DIR/$CUTTLEFISH_CONF.new)
> > > >
> > > > which I print to the console
> > > >
> > > > echo "$CUTTLEFISHCMD -e $RUNNER_ETC_DIR -d $RUNNER_GEN_DIR/generated.conf -s $RUNNER_BASE_DIR/share/schema/ -c $RUNNER_ETC_DIR/$CUTTLEFISH_CONF.new"
> > > >
> > > > copy the output and run it manually to see the error details (it would be nice to print the error output with the "oh no" message, or at least a random http://webcomicname.com/ :P)
> > > >
> > > > > You uncomment what you added, and still get a failure. Then you delete the commented section, and maybe it will decide to work.
> > > > >
> > > > > Is there a more modern version of this for Erlang? I see the last development for Cuttlefish was years ago. I’m sure the kids these days are using something
> > > > > _______________________________________________
> > > > > erlang-questions mailing list
> > > > > erlang-questions@REDACTED
> > > > > http://erlang.org/mailman/listinfo/erlang-questions
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20181031/bcad212f/attachment.htm>


More information about the erlang-questions mailing list