Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing docsh dependency #138

Merged
merged 4 commits into from
Jul 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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