Skip to content

Commit 66eb4d4

Browse files
authored
Merge pull request #145 from esl/amoc_core
Amoc core
2 parents d3e1016 + 107c0c0 commit 66eb4d4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+261
-1739
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,3 @@ jobs:
2727
run: make integration_test
2828
env:
2929
OTP_RELEASE: ${{ matrix.otp_vsn }}
30-
REBAR_RELEASE: ${{ matrix.rebar_vsn }}

Dockerfile

Lines changed: 14 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,20 @@
1-
FROM phusion/baseimage:focal-1.0.0 as base-image
2-
FROM base-image as amoc-build
1+
ARG otp_vsn=25.3
2+
FROM erlang:${otp_vsn}-slim AS builder
3+
MAINTAINER Erlang Solutions <mongoose-im@erlang-solutions.com>
34

4-
RUN apt-get update
5-
RUN apt-get -y install gnupg2
5+
WORKDIR /amoc_build
66

7-
ARG DEBIAN_FRONTEND=noninteractive
8-
ARG otp_vsn=24.0
9-
ARG rebar_vsn=3.16.1
7+
COPY ./rebar.config ./rebar.lock ./
8+
RUN rebar3 deps && rebar3 compile -d
109

11-
ADD https://packages.erlang-solutions.com/erlang-solutions_2.0_all.deb /tmp/
12-
RUN dpkg -i /tmp/erlang-solutions_2.0_all.deb
13-
RUN apt-get update
10+
COPY ./integration_test integration_test
11+
COPY ./scenarios scenarios
12+
COPY ./priv priv
13+
COPY ./rel rel
14+
COPY ./src src
1415

15-
RUN apt-get -y install esl-erlang=1:${otp_vsn}-1
16+
RUN rebar3 as demo release
1617

17-
RUN apt-get -y install git make wget
18+
ENV PATH "/amoc_build/_build/demo/rel/amoc/bin:${PATH}"
1819

19-
COPY . /amoc_build
20-
21-
ADD https://github.com/erlang/rebar3/releases/download/${rebar_vsn}/rebar3 /bin
22-
RUN chmod u+x /bin/rebar3
23-
24-
RUN cd /amoc_build && \
25-
git clean -ffxd && \
26-
make rel
27-
28-
FROM base-image
29-
30-
RUN useradd -ms /bin/bash amoc
31-
32-
COPY --from=amoc-build /amoc_build/_build/demo/rel/amoc/ /home/amoc/amoc/
33-
COPY --from=amoc-build /amoc_build/scenarios /amoc_build/scenarios
34-
35-
# It seems hub.docker.com does not support --chown param to COPY directive
36-
RUN chown -R amoc:amoc /home/amoc/amoc
37-
38-
EXPOSE 4000
39-
40-
RUN mkdir /etc/service/amoc
41-
COPY docker/amoc.sh /etc/service/amoc/run
42-
43-
CMD ["/sbin/my_init"]
20+
CMD ["amoc", "foreground"]

Makefile

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.PHONY: default rel compile clean ct test integration_test dialyzer xref console lint
1+
.PHONY: default rel compile clean ct test integration_test dialyzer xref console
22

33
REBAR = rebar3
44

@@ -25,7 +25,7 @@ ct:
2525
## eunit and ct commands always add a test profile to the run
2626
$(REBAR) ct --verbose $(SUITE_OPTS)
2727

28-
test: compile xref lint dialyzer ct
28+
test: compile xref dialyzer ct
2929

3030
integration_test:
3131
./integration_test/stop_demo_cluster.sh
@@ -54,6 +54,3 @@ console:
5454
@echo "tests can be executed manually using ct:run/1 function:\n" \
5555
' ct:run("test").'
5656
$(REBAR) as test shell
57-
58-
lint:
59-
$(REBAR) as elvis lint

doc/configuration.md

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -23,27 +23,6 @@ Amoc supports the following generic configuration parameters:
2323
* default value - empty list (`[]`)
2424
* example: `AMOC_EXTRA_CODE_PATHS='["/some/path", "/another/path"]'`
2525

26-
In addition to that, `amoc_metrics` allow to configure a Graphite reporter
27-
using the following environment variables:
28-
29-
* ``graphite_host`` - a graphite host address (string or `undefined`):
30-
* default value - `undefined` (amoc_metrics do not try to initialise a metrics reporter)
31-
* example: `AMOC_GRAPHITE_HOST='"graphite"'`
32-
33-
* ``graphite_port`` - graphite port:
34-
* default value - `2003`
35-
* example: `AMOC_GRAPHITE_PORT='2003'`
36-
37-
* ``graphite_prefix`` - graphite prefix:
38-
* default value - `net_adm:localhost()`
39-
* example: `AMOC_GRAPHITE_PREFIX='"amoc"'`
40-
41-
In order to initialise some preconfigured metrics, other applications can declare
42-
the `predefined_metrics` environment variable (in their own `*.app.src` file):
43-
```
44-
{predefined_metrics, [{gauge, some_metric}, {times, another_metric}]}
45-
```
46-
4726
In the same manner you can also define your own entries to configure the scenario.
4827

4928
The ``amoc_config:get/1`` and ``amoc_config:get/2`` interfaces can be used to get

doc/http-api.md

Lines changed: 0 additions & 19 deletions
This file was deleted.

doc/telemetry.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
## Telemetry
2+
3+
Amoc also exposes the following telemetry events:
4+
5+
### Scenario
6+
7+
A telemetry span of a full scenario execution
8+
```erlang
9+
event_name: [amoc, scenario, user]
10+
measurements: #{}
11+
metadata: #{}
12+
```
13+
14+
### Controller
15+
16+
Indicates the number of users added or removed
17+
```erlang
18+
event_name: [amoc, controller, users]
19+
measurements: #{count => non_neg_integer()}
20+
metadata: #{type => add | remove}
21+
```
22+
23+
### Throttle
24+
25+
#### Rate
26+
27+
Raised when a throttle mechanism is initialised or its configured rate is changed.
28+
29+
```erlang
30+
event_name: [amoc, throttle, rate]
31+
measurements: #{rate => non_neg_integer()}
32+
metadata: #{name => atom()}
33+
```
34+
35+
#### Request
36+
37+
Raised when a process client requests to be allowed pass through a throttled mechanism.
38+
39+
```erlang
40+
event_name: [amoc, throttle, request]
41+
measurements: #{count => 1}
42+
metadata: #{name => atom()}
43+
```
44+
45+
#### Execute
46+
47+
Raised when a process client is allowed to execute after a throttled mechanism.
48+
49+
```erlang
50+
event_name: [amoc, throttle, execute]
51+
measurements: #{count => 1}
52+
metadata: #{name => atom()}
53+
```
54+
55+
### Coordinate
56+
57+
Indicates when a coordinating event was raised, like a callback index being reached or a timeout being triggered
58+
59+
#### Event
60+
```erlang
61+
event_name: [amoc, coordinator, event]
62+
measurements: #{count => 1}
63+
metadata: #{type => atom()}
64+
```

docker/amoc.sh

Lines changed: 0 additions & 3 deletions
This file was deleted.

elvis.config

Lines changed: 0 additions & 26 deletions
This file was deleted.

integration_test/build_docker_image.sh

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,7 @@ source "$(dirname "$0")/helper.sh"
44
enable_strict_mode
55
cd "$git_root"
66

7-
otp_vsn="${OTP_RELEASE:-24.0}"
8-
rebar_vsn="${REBAR_RELEASE:-3.16.1}"
7+
otp_vsn="${OTP_RELEASE:-25.3}"
98
echo "ERLANG/OTP '${otp_vsn}'"
10-
echo "REBAR '${rebar_vsn}'"
119

12-
docker build \
13-
-f Dockerfile \
14-
-t amoc:latest \
15-
--build-arg "otp_vsn=${otp_vsn}" \
16-
--build-arg "rebar_vsn=${rebar_vsn}" \
17-
.
10+
docker_compose build --build-arg otp_vsn=${otp_vsn}
Lines changed: 6 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,31 @@
1-
version: "3.4"
2-
31
x-amoc-defaults: &amoc-defaults
4-
image: "amoc:latest"
2+
build:
3+
context: ../
4+
dockerfile: Dockerfile
55
networks:
66
- amoc-test-network
77
volumes:
88
- type: bind
99
source: ./extra_code_paths
1010
target: /extra_code_paths
1111
environment:
12-
AMOC_GRAPHITE_HOST: '"graphite"'
1312
AMOC_NODES: "['amoc@amoc-master']"
1413
AMOC_EXTRA_CODE_PATHS: '["/extra_code_paths/test1", "/extra_code_paths/test2"]'
1514
healthcheck:
16-
test: "/home/amoc/amoc/bin/amoc status"
15+
test: "amoc status"
1716

1817
services:
1918
amoc-master:
2019
<<: *amoc-defaults
2120
hostname: "amoc-master"
22-
ports:
23-
- "4000:4000"
2421
amoc-worker-1: &amoc-worker
2522
<<: *amoc-defaults
2623
hostname: "amoc-worker-1"
27-
ports:
28-
- "4001:4000"
29-
amoc-worker-2:
24+
amoc-worker-2:
3025
<<: *amoc-defaults
3126
hostname: "amoc-worker-2"
32-
ports:
33-
- "4002:4000"
34-
amoc-worker-3:
27+
amoc-worker-3:
3528
<<: *amoc-defaults
3629
hostname: "amoc-worker-3"
37-
ports:
38-
- "4003:4000"
39-
graphite:
40-
image: "graphiteapp/graphite-statsd:1.1.7-2"
41-
ports:
42-
- "8080:80"
43-
networks:
44-
- amoc-test-network
45-
grafana:
46-
image: "grafana/grafana:6.7.3"
47-
ports:
48-
- "3000:3000"
49-
networks:
50-
- amoc-test-network
5130
networks:
5231
amoc-test-network:

0 commit comments

Comments
 (0)