rebar3



Build better Erlang.

Ask A Question

Questions

2

rebar3_erlydtl_plugin windows fails

After reviewing alot comments regarding usage of the rebar3_erlydtl_plugin, I am having trouble compiling the template files to the destination ebin directory. I added the DEBUG=1 setting to see the details of rebar3 build and additional tags to try to extract what erlydtl library is complaining about. Below is the setting in the local rebar.config file for subfolder that contains the "priv folder with the web content. {erlydtl_opts, [ {doc_root, "priv/templates"}, {out_dir, "ebin"}, {compiler_options, [report_errors, return, verbose, debug_info]}, {source_ext, ".dtl"}, {module_ext, "_view"}, {return, true}, {report, true} ]}. {plugins, [ {rebar3_erlydtl_plugin, ".*", {git, "https://github.com/tsloughter/rebar3_erlydtl_plugin.git", {branch, "master"}}} ]}. {provider_hooks, [ {pre, [{compile, {erlydtl, compile}}]} ]}. Below is the partial output of the rebar3 showing that it doesn't recognize the out_dir folder; however, the path is correct and I suspect that the symlinks may be the issue, since windows seem to behave as it should with them. ===> run_hooks("c:/SPRTVL/source/dashboard", pre_hooks, compile) -> no hooks defined ===> sh info: cwd: "c:/SPRTVL/source/dashboard" cmd: cmd /c mklink /j "c:\\SPRTVL\\source\\dashboard\\_build\\default\\lib\\web\\priv" "c:\\SPRTVL\\source\\dashboard\\apps\\web\\priv" ===> opts: [{use_stdout,false},return_on_error] ===> Port Cmd: cmd /q /c cmd /c mklink /j "c:\\SPRTVL\\source\\dashboard\\_build\\default\\lib\\web\\priv" "c:\\SPRTVL\\source\\dashboard\\apps\\web\\priv" Port Opts: [exit_status,{line,16384},use_stdio,stderr_to_stdout,hide,eof] ===> sh info: cwd: "c:/SPRTVL/source/dashboard" cmd: cmd /c mklink /j "c:\\SPRTVL\\source\\dashboard\\_build\\default\\lib\\web\\include" "c:\\SPRTVL\\source\\dashboard\\apps\\web\\include" ===> opts: [{use_stdout,false},return_on_error] ===> Port Cmd: cmd /q /c cmd /c mklink /j "c:\\SPRTVL\\source\\dashboard\\_build\\default\\lib\\web\\include" "c:\\SPRTVL\\source\\dashboard\\apps\\web\\include" Port Opts: [exit_status,{line,16384},use_stdio,stderr_to_stdout,hide,eof] ===> sh info: cwd: "c:/SPRTVL/source/dashboard" cmd: cmd /c mklink /j "c:\\SPRTVL\\source\\dashboard\\_build\\default\\lib\\web\\src" "c:\\SPRTVL\\source\\dashboard\\apps\\web\\src" ===> opts: [{use_stdout,false},return_on_error] ===> Port Cmd: cmd /q /c cmd /c mklink /j "c:\\SPRTVL\\source\\dashboard\\_build\\default\\lib\\web\\src" "c:\\SPRTVL\\source\\dashboard\\apps\\web\\src" Port Opts: [exit_status,{line,16384},use_stdio,stderr_to_stdout,hide,eof] ===> Compiling web ===> Running erlydtl... ===> Compiling "c:/SPRTVL/source/dashboard/apps/web/priv/templates/tl.dtl" -> "c:/SPRTVL/source/dashboard/_build/default/lib/web/ebin/tl_view.beam" with options: [{compiler_options,[report_errors,return,verbose,debug_info]}, {custom_tags_dir,"c:/SPRTVL/source/dashboard/apps/web"}, {doc_root,"c:/SPRTVL/source/dashboard/apps/web/priv/templates"}, {out_dir,"ebin"}, {compiler_options,[report_errors,return,verbose,debug_info]}, {out_dir,"c:/SPRTVL/source/dashboard/_build/default/lib/web/ebin"}, {source_ext,".dtl"}, {module_ext,"_view"}, {return,true}, {report,true}] c:/SPRTVL/source/dashboard/apps/web/priv/templates/tl.dtl: Failed to write file: no such file or directory ===> Compiling apps/web/priv/templates/tl.dtl failed c:/SPRTVL/source/dashboard/apps/web/priv/templates/tl.dtl:none: Failed to write file: no such file or directory ===> Compilation failed: {error, [["c:/SPRTVL/source/dashboard/apps/web/priv/templates/tl.dtl:none: Failed to write file: no such file or directory\n"]], []}

Posted by Jeff Starnes about a year ago

10
ANSWERED

Compilation fails because lager isn't compiled first (even though it is the first dep listed in rebar.config)

I'm sure people asked this question gazillion times already, but I couldn't find a better answer to fix below problem than first run `make compile` which fails (see below), then manually cd into `_build/default/lib/lager` and run `make all` and then go back to ../../../.. and rerun `make compile` I would greatly appreciate your feedback. My understanding is rebar3 is designed to compile dependencies in the order they are listed, but it doesn't work this way for me: >cat rebar.config {erl_opts, [debug_info, {parse_transform, lager_transform}]}. {deps, [ %% lager isn't available out of the box with embedded version of Erlang I'm using {lager, ".*", {git, "https://github.com/erlang-lager/lager", {branch, "master"}}}, ... rest of hello_app deps ]}. {cover_enabled, true}. {relx, [{release, {hello_app, "1.0"}, [lager, other apps..., hello_app ]}, . . . >make prod-release rebar3 release ===> Verifying dependencies... ===> Fetching lager ({git,"https://github.com/erlang-lager/lager", {ref,"c3970a99131c7c73de7eba3c2a569806fe47e40a"}}) ===> Fetching hello_app ({git,... ===> Fetching goldrush ({pkg,<<"goldrush">>,<<"0.1.9">>}) ===> Downloaded package, caching at /root/.cache/rebar3/hex/default/packages/goldrush-0.1.9.tar ===> Compiling hello_app <=== WHY NOT lager first? ===> Compiling _build/default/lib/hello_app/src/gen_hello.erl failed _build/default/lib/hello_app/src/gen_hello.erl:none: undefined parse transform 'lager_transform' make: *** [Makefile:38: release] Error 1

Posted by Irina Guberman about a year ago

3
ANSWERED

Relups with Rebar3

I am trying to get a super basic minimal hot code loading example running. How is the overall process supposed to work? I have tried this example as well, but got errors: https://medium.com/@kansi/hot-code-loading-with-erlang-and-rebar3-8252af16605b I make my first version, compile, create the release and run it. So far everything works fine. Now how do I make another version of my application to use in a new release version? I add another release to the rebar.config like this: {release, { testserver_rel, "0.2.0" }, [{testserver_app, "0.2.0"}, sasl ]}, I upgrade my .app file to "0.2.0", I create an appup file, I compile and release and get: ===> Failed to solve release: Unable to solve constraints, the following solutions were attempted Unable to satisfy goal constraint (testserver_app = 0.2.0), sasl due to constraint on sasl -> (testserver_app = 0.2.0) If I remove the "0.2.0" part from the rebar.config, it works, but the release uses application "0.1.0" and not "0.2.0". If on the other hand I create a completely separate folder for the release with a new rebar.config and everything (for example I download the two branches from the above example into two separate folders, I can create both releases and they run, but when I use ./rebar3 relup I get: ===> could not find app testserver {0,1,0} I am probably doing something very simple wrong, but I can't find any documentation on how to do it properly. How can I keep two versions of an application in my folders? I just want to make 2 releases with different versions of the same application and then create a relup to switch between them. I got a bunch of other error messages while trying to fix this. I would be very grateful for any help! Thanks!

Posted by LP about a year ago

2
ANSWERED

options for custom plugin from rebar3

Hi, I am writing a rebar3 plugin which will use WIX library to package a OTP release into MSI my application rebar.config (using erlpkg as plugin): ```erlang {profiles, [ {prod, [ {erlpkg_opts, [{company, "Some Company"}, {upgradecode, "ABCDEFGHIJKL1234567890"}]}, {plugins, [{erlpkg, {git, "https://github.com/.../erlpkg.git", {branch, "rebar3"}}}]}, {relx, [{dev_mode, false}]} ]} ]}. ``` erlpkg interface is like: ```sh $ DEBUG=1 rebar3 as prod help erlpkg ===> Expanded command sequence to be run: [{default,as}] ===> Expanded command sequence to be run: [{default,help}] Windows MSI and Linux RPM installer packager for erlang Usage: rebar3 erlpkg [-c <company>] [-u <upgradecode>] -c, --company Name of the company -u, --upgradecode UUID of the product ``` `rebar_state:command_parsed_args(State)` isn't getting the args from rebar.config: $ DEBUG=1 rebar3 as prod erlpkg I could, however, pass them through command line: ```sh $ DEBUG=1 rebar3 as prod erlpkg -c "SomeCompany" -u "ABCDEFGH123456" ===> Expanded command sequence to be run: [{default,as}] ===> Expanded command sequence to be run: [{default,app_discovery}, {default,erlpkg}] ===> Not adding provider default erlpkg from module erlpkg_prv because it already exists from module erlpkg_prv ===> Not adding provider default erlpkg from module erlpkg_prv because it already exists from module erlpkg_prv ===> [erlpkg_prv:50] OTP "19.3", ARCH "win32", WORD "64" profile prod Root "C:/projects/git/dderl" ReleaseDir "c:/proj/_build/prod/rel" Args {[{company,"SomeCompany"},{upgradecode,"ABCDEFGH123456"}],[]} rebar_api:console() ===> rebar_api:info() ===> rebar_api:warn() ===> rebar_api:error() ===> [erlpkg_prv:56] debug ``` What am I doing wrong?

Posted by Bikram Chatterjee about a year ago

6

Systemd service unable to start erlang service and doesn't say anything

My systemd service is - [Unit] Description=ccs-core Wants=ccs-media [Service] Type=forking TimeoutStartSec=0 User=ccsapp Group=users Environment=CCS_HOME=/opt/ccs ExecStart=/opt/ccs/core/bin/core start ExecStop= /opt/ccs/core/bin/core stop [Install] WantedBy=multi-user.target Starting and stopping from command line works fine - ccsapp@parrot:~> core start ccsapp@parrot:~> core ping pong ccsapp@parrot:~> core stop ok ccsapp@parrot:~> core ping Node core@parrot not responding to pings. However, when I try to start and stop using systemd - ccsapp@parrot:~> sudo service ccs-core start root's password: ccsapp@parrot:~> sudo service ccs-core status ccs-core.service - ccs-core Loaded: loaded (/etc/systemd/system/ccs-core.service; enabled) Active: failed (Result: exit-code) since Sun 2017-02-19 18:22:12 IST; 3s ago Process: 6734 ExecStop=/opt/ccs/core/bin/core stop (code=exited, status=1/FAILURE) Process: 6707 ExecStart=/opt/ccs/core/bin/core start (code=exited, status=0/SUCCESS) Main PID: 6732 (code=exited, status=0/SUCCESS) Feb 19 18:22:12 parrot core[6780]: Starting up ccsapp@parrot:~> core ping Node core@parrot not responding to pings. And the log says nothing - run_erl [6736] Sun Feb 19 18:22:12 2017 Args before exec of shell: run_erl [6736] Sun Feb 19 18:22:12 2017 argv[0] = sh run_erl [6736] Sun Feb 19 18:22:12 2017 argv[1] = -c run_erl [6736] Sun Feb 19 18:22:12 2017 argv[2] = exec "/opt/ccs/core/bin/core" "console" and ===== ===== LOGGING STARTED Sun Feb 19 17:48:30 IST 2017 ===== Exec: /opt/ccs/core/erts-8.2/bin/erlexec -boot /opt/ccs/core/releases/6.0.0/start -mode embedded -boot_var ERTS_LIB_DIR /opt/ccs/core/erts-8.2/../lib -config /opt/ccs/core/releases/6.0.0/sys.config -args_file /opt/ccs/core/releases/6.0.0/vm.args -- console^M Root: /opt/ccs/core^M /opt/ccs/core

Posted by Chaitanya Chalasani about a year ago