|
| 1 | +name: elastic-stack |
| 2 | + |
| 3 | +services: |
| 4 | + elasticsearch: |
| 5 | + image: docker.elastic.co/elasticsearch/elasticsearch:8.17.0 |
| 6 | + container_name: elasticsearch |
| 7 | + ports: |
| 8 | + - 9200:9200 |
| 9 | + environment: |
| 10 | + - node.name=elasticsearch |
| 11 | + - cluster.name=docker-cluster |
| 12 | + - discovery.type=single-node |
| 13 | + - ELASTIC_PASSWORD=elastic |
| 14 | + - bootstrap.memory_lock=true |
| 15 | + - xpack.security.enabled=true |
| 16 | + - xpack.security.http.ssl.enabled=false |
| 17 | + - xpack.security.transport.ssl.enabled=false |
| 18 | + - xpack.license.self_generated.type=trial |
| 19 | + - ES_JAVA_OPTS=-Xmx8g |
| 20 | + ulimits: |
| 21 | + memlock: |
| 22 | + soft: -1 |
| 23 | + hard: -1 |
| 24 | + healthcheck: |
| 25 | + test: ["CMD-SHELL", "curl -s http://localhost:9200/_cluster/health?wait_for_status=yellow&timeout=500ms"] |
| 26 | + retries: 300 |
| 27 | + interval: 1s |
| 28 | + |
| 29 | + elasticsearch_settings: |
| 30 | + depends_on: |
| 31 | + elasticsearch: |
| 32 | + condition: service_healthy |
| 33 | + image: docker.elastic.co/elasticsearch/elasticsearch:8.17.0 |
| 34 | + container_name: elasticsearch_settings |
| 35 | + restart: 'no' |
| 36 | + command: > |
| 37 | + bash -c ' |
| 38 | + # gen-ai assistants in kibana save state in a way that requires security to be enabled, so we need to create |
| 39 | + # a kibana system user before starting it. |
| 40 | + echo "Setup the kibana_system password"; |
| 41 | + until curl -s -u "elastic:elastic" -X POST http://elasticsearch:9200/_security/user/kibana_system/_password -d "{\"password\":\"elastic\"}" -H "Content-Type: application/json" | grep -q "^{}"; do sleep 5; done; |
| 42 | + ' |
| 43 | +
|
| 44 | + kibana: |
| 45 | + image: docker.elastic.co/kibana/kibana:8.17.0 |
| 46 | + container_name: kibana |
| 47 | + depends_on: |
| 48 | + elasticsearch_settings: |
| 49 | + condition: service_completed_successfully |
| 50 | + ports: |
| 51 | + - 5601:5601 |
| 52 | + environment: |
| 53 | + - SERVERNAME=kibana |
| 54 | + - ELASTICSEARCH_HOSTS=http://elasticsearch:9200 |
| 55 | + - ELASTICSEARCH_USERNAME=kibana_system |
| 56 | + - ELASTICSEARCH_PASSWORD=elastic |
| 57 | + # Non-default settings from here: |
| 58 | + # https://github.com/elastic/apm-server/blob/main/testing/docker/kibana/kibana.yml |
| 59 | + - MONITORING_UI_CONTAINER_ELASTICSEARCH_ENABLED=true |
| 60 | + - XPACK_SECURITY_ENCRYPTIONKEY=fhjskloppd678ehkdfdlliverpoolfcr |
| 61 | + - XPACK_ENCRYPTEDSAVEDOBJECTS_ENCRYPTIONKEY=fhjskloppd678ehkdfdlliverpoolfcr |
| 62 | + - SERVER_PUBLICBASEURL=http://127.0.0.1:5601 |
| 63 | + healthcheck: |
| 64 | + test: ["CMD-SHELL", "curl -s http://localhost:5601/api/status | grep -q 'All services are available'"] |
| 65 | + retries: 300 |
| 66 | + interval: 1s |
| 67 | + |
| 68 | + apm-server: |
| 69 | + image: docker.elastic.co/apm/apm-server:8.17.0 |
| 70 | + container_name: apm-server |
| 71 | + depends_on: |
| 72 | + elasticsearch: |
| 73 | + condition: service_healthy |
| 74 | + command: > |
| 75 | + apm-server |
| 76 | + -E apm-server.kibana.enabled=true |
| 77 | + -E apm-server.kibana.host=http://kibana:5601 |
| 78 | + -E apm-server.kibana.username=elastic |
| 79 | + -E apm-server.kibana.password=elastic |
| 80 | + -E output.elasticsearch.hosts=["http://elasticsearch:9200"] |
| 81 | + -E output.elasticsearch.username=elastic |
| 82 | + -E output.elasticsearch.password=elastic |
| 83 | + cap_add: ["CHOWN", "DAC_OVERRIDE", "SETGID", "SETUID"] |
| 84 | + cap_drop: ["ALL"] |
| 85 | + ports: |
| 86 | + - 8200:8200 |
| 87 | + healthcheck: |
| 88 | + test: ["CMD-SHELL", "bash -c 'echo -n > /dev/tcp/127.0.0.1/8200'"] |
| 89 | + retries: 300 |
| 90 | + interval: 1s |
| 91 | + |
0 commit comments