Skip to content

Commit

Permalink
preserving original location of amoc scenarios source code files.
Browse files Browse the repository at this point in the history
unfortunately rebar3 doesn't copy any source files from the directories other than 'src' into release

   denysgonchar@Administrators-MacBook-Pro amoc % find . -name amoc_controller.erl
   ./_build/demo/rel/amoc/lib/amoc-2.2.0+build.788.refbccbc5d/src/amoc_controller.erl
   ./src/amoc_controller.erl
   denysgonchar@Administrators-MacBook-Pro amoc % find . -name parallel_throttle_test.erl
   ./scenarios/parallel_throttle_test.erl

and source code file is required for fetching edoc description for scenario.

So currently, we are not able to get 'doc' field of scenario info, when running amoc inside a container.

when we try to fetch info for parallel_throttle_test scenario:

   http://localhost:4000/scenarios/info/parallel_throttle_test

we get:

   {
     "doc": "no documentation found",
     "parameters": {
   ...

and at the same time the error is logger in amoc console:

   Attempt to process operation: 'ScenariosInfoIdGet'
   Source file for parallel_throttle_test is not available.

If you try to check manually the source file location using docsh_beam module, you get the following:

   (amoc@5441117ebf5d)1> {ok, B1} = docsh_beam:from_loaded_module(parallel_throttle_test).
   {ok,{docsh_beam,parallel_throttle_test,
                   "/home/amoc/amoc/lib/amoc-2.2.0+build.789.ref26c2eb1/ebin/parallel_throttle_test.beam",
                   false}}
   (amoc@5441117ebf5d)2> {ok, B2} = docsh_beam:from_loaded_module(amoc_controller).
   {ok,{docsh_beam,amoc_controller,
                   "/home/amoc/amoc/lib/amoc-2.2.0+build.789.reff907221/ebin/amoc_controller.beam",
                   "/home/amoc/amoc/lib/amoc-2.2.0+build.789.reff907221/src/amoc_controller.erl"}}

however, it's working fine if we preserve source files in the original location:

  (amoc@5441117ebf5d)1> {ok,B} = docsh_beam:from_loaded_module(parallel_throttle_test).
  {ok,{docsh_beam,parallel_throttle_test,
                  "/home/amoc/amoc/lib/amoc-2.2.0+build.789.reff907221/ebin/parallel_throttle_test.beam",
                  "/amoc_build/scenarios/parallel_throttle_test.erl"}}
  • Loading branch information
DenysGonchar committed Jul 18, 2021
1 parent f907221 commit 84ad5ea
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ MAINTAINER Erlang Solutions <mongoose-im@erlang-solutions.com>
RUN useradd -ms /bin/bash amoc

COPY --from=amoc-build /amoc_build/_build/demo/rel/amoc/ /home/amoc/amoc/
COPY --from=amoc-build /amoc_build/scenarios /amoc_build/scenarios

# It seems hub.docker.com does not support --chown param to COPY directive
RUN chown -R amoc:amoc /home/amoc/amoc

Expand Down

0 comments on commit 84ad5ea

Please sign in to comment.