Skip to content

Commit

Permalink
Merge pull request #138 from esl/fixing_docsh_dependency
Browse files Browse the repository at this point in the history
Fixing docsh dependency

As explained in PR: Because when we use amoc (or any other app) as a dependency, we expect it to have a proper list of its own dependencies. Previously we were only including docsh in amoc release, which is now can be used solely for demo purposes. But amoc-arsenal-release didn't have it, and attempts to extract edoc during scenario/info REST calls were crashing.
  • Loading branch information
NelsonVides authored Jul 19, 2021
2 parents 44fc97e + 84ad5ea commit 18be5c4
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 20 deletions.
28 changes: 17 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,34 +1,40 @@
FROM phusion/baseimage:focal-1.0.0 as amoc-build
FROM phusion/baseimage:focal-1.0.0 as base-image
FROM base-image as amoc-build

RUN apt-get update && \
apt-get install -y --no-install-recommends \
git make wget gnupg
RUN apt-get update
RUN apt-get -y install gnupg2

ARG DEBIAN_FRONTEND=noninteractive
ARG otp_vsn=24.0-1

RUN wget https://packages.erlang-solutions.com/erlang-solutions_2.0_all.deb && \
dpkg -i erlang-solutions_2.0_all.deb && \
apt-get update && \
apt-get install -y esl-erlang=1:${otp_vsn}
ADD https://packages.erlang-solutions.com/erlang-solutions_2.0_all.deb /tmp/
RUN dpkg -i /tmp/erlang-solutions_2.0_all.deb
RUN apt-get update

RUN apt-get -y install esl-erlang=1:${otp_vsn}

RUN apt-get -y install git make wget

COPY . /amoc_build

RUN cd amoc_build && \
git clean -ffxd && \
make rel

FROM phusion/baseimage:focal-1.0.0
FROM base-image
MAINTAINER Erlang Solutions <mongoose-im@erlang-solutions.com>

RUN useradd -ms /bin/bash amoc

COPY --from=amoc-build /amoc_build/_build/prod/rel/amoc/ /home/amoc/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

EXPOSE 4000

RUN mkdir /etc/service/amoc
ADD docker/amoc.sh /etc/service/amoc/run
COPY docker/amoc.sh /etc/service/amoc/run

CMD ["/sbin/my_init"]
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ endif
all: rel

rel: rebar3
./rebar3 as prod tar
./rebar3 as demo tar

compile:
$(REBAR) as prod compile
$(REBAR) as demo compile

clean:
$(REBAR) clean
Expand Down Expand Up @@ -45,10 +45,10 @@ rebar3:
chmod u+x rebar3

dialyzer:
$(REBAR) as prod dialyzer
$(REBAR) as demo dialyzer

xref:
$(REBAR) as prod xref
$(REBAR) as demo xref

console:
@echo "tests can be executed manually using ct:run/1 function:\n" \
Expand Down
2 changes: 1 addition & 1 deletion doc/local-run.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Everything you need to do is to create the release. To achieve that run:
`make rel`. Now you are ready to test our scenario locally with one Amoc node;
to start the node run `_build/prod/rel/amoc/bin/amoc console`.
to start the node run `_build/demo/rel/amoc/bin/amoc console`.

Start `my_scenario` spawning 10 amoc users with IDs from range (1,10) inclusive.
```erlang
Expand Down
9 changes: 6 additions & 3 deletions rebar.config
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,14 @@
]}
]},
{elvis, [{plugins, [{rebar3_lint, "0.1.11"}]}]},
{prod, [
{erl_opts, [{src_dirs, ["src", "scenarios"]}]},
{demo, [
{erl_opts, [debug_info, {src_dirs, ["src", "scenarios"]}]},
{relx, [
{release, {amoc, git}, [amoc, runtime_tools, compiler, docsh]},
{release, {amoc, git}, [amoc, runtime_tools]},
{debug_info, keep},
{include_src, true},
{include_erts, true},
{dev_mode, false},
{extended_start_script, true},
{sys_config, "rel/app.config"}
]}]}
Expand Down
3 changes: 2 additions & 1 deletion src/amoc.app.src
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
compiler,
exometer_core,
exometer_report_graphite,
amoc_rest
amoc_rest,
docsh
]},
{mod, {amoc_app, []}},
{env, [{exometer_predefined, [
Expand Down

0 comments on commit 18be5c4

Please sign in to comment.