Skip to content

Commit

Permalink
feat(monkeys): Create docker image to facilitate execution of the mon…
Browse files Browse the repository at this point in the history
…keys application [WPB-4558] (#2058)

* feat(monkeys): Create docker image to facilitate execution of the monkeys application

* fix folder
  • Loading branch information
augustocdias authored Sep 28, 2023
1 parent f75a3f3 commit 6adb534
Show file tree
Hide file tree
Showing 12 changed files with 2,001 additions and 3 deletions.
35 changes: 33 additions & 2 deletions monkeys/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,33 @@ To build, run:

A jar file will be created inside `./monkeys/build/libs` called `monkeys.jar`.

### Docker

Optionally a docker image can be built to run the app in containers. Inside the `monkeys/docker`
folder, run:

```bash
docker compose up
```

By default, it will search for a config named `config.json` inside the `monkeys/docker/config` folder. To change
which
config file to load simply set the environment variable `CONFIG`:

```bash
env CONFIG=example.json docker compose up
```

*Note*: the file must be located inside the config folder.

If the host is not an ARM based platform, the `--platform` parameter can be omitted. If building on
MacOs ARM computers, be sure to disable Rosetta emulation and containerd support in the settings
under `Features in development` from docker.

Under this stack, prometheus and grafana containers will be started, and they'll automatically
scrape metrics from the monkeys application to visualize graphs. Grafana should be available on the
port [3000](http://localhost:3000/) and prometheus on the port [9090](http://localhost:9090)

## Running

Create a configuration and execute:
Expand All @@ -28,10 +55,14 @@ java -jar monkeys.jar --help

An [example](example.json) config is in this repo and the schema can be seen [here](schema.json).

When creating teams and users automatically through Infinite Monkeys, remember to set the `authUser`
and `authPassword` with the credentials for the internal API of the respective backend.

## Current Limitations (to be fixed in the future)

* The application runs until it receives a `SIGINT` (Ctrl+C) signal. There should be a configuration
to finish the test run
* The `SIGINT` signal is not being correctly processed by the app.
* The application should run until it receives a `SIGINT` (Ctrl+C) signal. There should be a
configuration to finish the test run
* Tests need to be implemented
* Collecting metrics about the test execution
* Tracing and replaying a test run. For this the order is the important factor, so when replayed it
Expand Down
11 changes: 11 additions & 0 deletions monkeys/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM eclipse-temurin:17 AS jdk-build

COPY .. /kalium
RUN cd /kalium && ./gradlew :monkeys:build

FROM wirebot/cryptobox:1.4.0

RUN mkdir /opt/app
COPY --from=jdk-build /kalium/monkeys/build/libs/monkeys.jar /opt/app
ENTRYPOINT ["java", "-jar", "/opt/app/monkeys.jar"]
CMD ["/config.json"]
44 changes: 44 additions & 0 deletions monkeys/docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
services:
monkeys:
platform: linux/amd64
build:
context: ../../
dockerfile: ./monkeys/docker/Dockerfile
image: monkeys
volumes:
- ./config:/config
command:
- /config/${CONFIG:-config.json}
prometheus:
image: prom/prometheus
command:
- '--config.file=/etc/prometheus/prometheus.yml'
restart: unless-stopped
ports:
- 9090:9090
volumes:
- ./prometheus:/etc/prometheus
- prom_data:/prometheus
grafana:
image: grafana/grafana
ports:
- 3000:3000
restart: unless-stopped
environment:
- GF_SECURITY_ADMIN_USER=admin
- GF_SECURITY_ADMIN_PASSWORD=grafana
- GF_AUTH_ANONYMOUS_ENABLED=true
- GF_AUTH_DISABLE_LOGIN_FORM=true
- GF_AUTH_ANONYMOUS_ORG_ROLE=Admin
- GF_AUTH_DISABLE_SIGNOUT_MENU=true
- GF_AUTH_BASIC_ENABLED=false
- GF_SECURITY_ALLOW_EMBEDDING=true
- GF_EXPLORE_ENABLED=false
- GF_PROFILE_ENABLED=false
- GF_NEWS_ENABLED=false
- GF_DASHBOARDS_DEFAULT_HOME_DASHBOARD_PATH=/var/lib/grafana/dashboards/monkeys.json
volumes:
- ./grafana/provisioning:/etc/grafana/provisioning
- ./grafana/dashboards:/var/lib/grafana/dashboards
volumes:
prom_data:
Loading

0 comments on commit 6adb534

Please sign in to comment.