Skip to content

Use agent docker image #10

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

Merged
merged 8 commits into from
May 7, 2020
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
19 changes: 17 additions & 2 deletions testing/environments/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,26 @@
Firstly, refresh docker images:
Before using the Package Registry, remember to `mage build` the project to prepare the volume with packages
(`public` directory).

Refresh docker images:

```bash
$ docker-compose -f snapshot.yml pull
```

Run docker containers:
Run docker containers (Elasticsearch, Kibana, Package Registry):

```bash
$ docker-compose -f snapshot.yml -f local.yml up --force-recreate
```

... or with Elastic Agent:

```bash
$ docker-compose -f snapshot.yml -f local.yml -f agent.yml up --force-recreate
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First time I run this I got:

Creating environments_package-registry_1 ... done
Creating environments_elasticsearch_1    ... done

ERROR: for kibana  Container "82665ad5fd87" is unhealthy.
ERROR: Encountered errors while bringing up the project.

I assume the timeout was too low.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm.. you can try to wipe out docker images. Anyway, this one is weird. If it's not a one-time issue, would be good to reproduce it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be nice to have a mage command for this, easier to remember (at least for me).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well it all depends what do you need, either entire fleet with enrolled agent or you prefer to keep the agent aside on your host.

I can add one or two default mage targets, but it will limit configurability of available docker-compose options.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets wait with it and see what most of us use frequently.

```

Use this command to spawn more agents:

```bash
$ docker-compose -f snapshot.yml -f local.yml -f agent.yml up --scale elastic-agent=10 --no-recreate -d
```
15 changes: 15 additions & 0 deletions testing/environments/agent.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# This should start the environment with the latest snapshots.

version: '2.3'
services:
elastic-agent:
image: docker.elastic.co/beats/elastic-agent:8.0.0-SNAPSHOT
depends_on:
elasticsearch:
condition: service_healthy
kibana:
condition: service_healthy
environment:
- "FLEET_ENROLL=1"
- "FLEET_SETUP=1"
- "KIBANA_HOST=http://kibana:5601"
4 changes: 3 additions & 1 deletion testing/environments/kibana.config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ xpack.monitoring.ui.container.elasticsearch.enabled: true

xpack.ingestManager.enabled: true
xpack.ingestManager.epm.enabled: true
xpack.ingestManager.epm.registryUrl: "http://package-registry:8080"
xpack.ingestManager.fleet.enabled: true
xpack.ingestManager.fleet.elasticsearch.host: "http://elasticsearch:9200"
xpack.ingestManager.fleet.kibana.host: "http://kibana:5601"
xpack.ingestManager.fleet.tlsCheckDisabled: true
xpack.ingestManager.epm.registryUrl: "http://integrations-registry:8080"
5 changes: 1 addition & 4 deletions testing/environments/local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,12 @@ services:
kibana:
ports:
- "127.0.0.1:5601:5601"
depends_on:
elasticsearch:
condition: service_healthy

elasticsearch:
ports:
- "127.0.0.1:9200:9200"

integrations-registry:
package-registry:
ports:
- "127.0.0.1:8080:8080"

7 changes: 6 additions & 1 deletion testing/environments/snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,19 @@ services:

kibana:
image: docker.elastic.co/kibana/kibana:8.0.0-SNAPSHOT
depends_on:
elasticsearch:
condition: service_healthy
package-registry:
condition: service_healthy
healthcheck:
test: "curl -f http://localhost:5601/login | grep kbn-injected-metadata 2>&1 >/dev/null"
retries: 600
interval: 1s
volumes:
- ./kibana.config.yml:/usr/share/kibana/config/kibana.yml

integrations-registry:
package-registry:
image: docker.elastic.co/package-registry/package-registry:master
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080"]
Expand Down