{"id":21008657,"url":"https://github.com/karmi/elastic-observability-demo","last_synced_at":"2025-05-15T02:32:32.930Z","repository":{"id":41250105,"uuid":"234754263","full_name":"karmi/elastic-observability-demo","owner":"karmi","description":"Demo of the observability features of the Elastic Stack","archived":false,"fork":false,"pushed_at":"2023-11-01T07:37:14.000Z","size":48,"stargazers_count":6,"open_issues_count":1,"forks_count":6,"subscribers_count":4,"default_branch":"master","last_synced_at":"2023-11-01T08:40:55.758Z","etag":null,"topics":["beats","docker","elastic","elasticsearch","golang","observability"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/karmi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2020-01-18T15:22:07.000Z","updated_at":"2023-11-01T08:40:55.758Z","dependencies_parsed_at":"2022-09-20T23:03:00.744Z","dependency_job_id":"09d53a7e-ff7d-4891-9afc-6ec35f9ac23a","html_url":"https://github.com/karmi/elastic-observability-demo","commit_stats":null,"previous_names":["karmi/elastic-observability-demo"],"tags_count":0,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karmi%2Felastic-observability-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karmi%2Felastic-observability-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karmi%2Felastic-observability-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karmi%2Felastic-observability-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/karmi","download_url":"https://codeload.github.com/karmi/elastic-observability-demo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225324124,"owners_count":17456460,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["beats","docker","elastic","elasticsearch","golang","observability"],"created_at":"2024-11-19T09:13:08.611Z","updated_at":"2024-11-19T09:13:09.261Z","avatar_url":"https://github.com/karmi.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Observability with the Elastic Stack\n\nThis repository contains demo configuration for monitoring a typical web service\nand a standalone script with the [Elastic Stack](https://www.elastic.co/products).\n\n-----\n\n### 1. Generate Certificates\n\nGenerate certificates for the services using [`elasticsearch-certutil`](https://www.elastic.co/guide/en/elasticsearch/reference/current/certutil.html):\n\n    docker compose --file certificates-create.yml up\n\n\u003e NOTE: On Linux, change the permissions with `sudo chown -R $USER certificates`.\n\nVerify that the certificates have been succesfully created:\n\n    ls -la ./certificates\n\n### 2. Launch the Services\n\nLaunch the services with [Docker Compose](https://docs.docker.com/compose/):\n\n    docker compose up --remove-orphans --detach\n\n\u003e NOTE: To bind Nginx on standard ports, export the corresponding environment variables: `NGINX_HTTP_PORT=80 NGINX_HTTPS_PORT=443 docker compose up --remove-orphans --detach`.\n\n\u003e NOTE: When you change the source in `app.py` (or `script.py`), rebuild it with `docker compose up app --build --force-recreate --detach app`.\n\n### 3. Set the Kibana Password\n\nWait until Elasticsearch is running, and set the password for Kibana:\n\n    until docker inspect demo-elasticsearch-1 \u003e /dev/null 2\u003e\u00261 \u0026\u0026 [[ $(docker inspect -f '{{ .State.Health.Status }}' demo-elasticsearch-1) == \"healthy\" ]]; do echo -n '.'; sleep 1; done; source .env\n    docker exec -it demo-elasticsearch-1 curl -s -X POST --cacert /usr/share/elasticsearch/config/certificates/ca/ca.crt -u \"elastic:${ELASTIC_PASSWORD}\" -H \"Content-Type: application/json\" https://localhost:9200/_security/user/kibana_system/_password -d \"{\\\"password\\\":\\\"${ELASTIC_PASSWORD}\\\"}\"\n\n### 4. Inspect the Results\n\nNavigate to the \"APM\" Kibana page at \u003chttps://localhost:5601/app/apm/services\u003e, logging in as `elastic:elastic`.\n\nDrive some traffic to the application (it will randomly fail 5% requests and simulate latency for 10% of requests):\n\n    for i in `seq 1 100`; do curl -k -s 'https://localhost:4430'; echo; done\n\nAlternatively, use a tool like [`siege`](https://github.com/JoeDog/siege), [`wrk`](https://github.com/wg/wrk) or [`hey`](https://github.com/rakyll/hey):\n\n    siege --time=15s --verbose https://localhost:4430\n    wrk --duration 15s --latency https://localhost:4430\n    hey -z 15s https://localhost:4430\n\nTo access the services locally, pass the certificate authority to your client:\n\n```bash\ncurl -i --cacert certificates/ca/ca.crt https://localhost:4430\n```\n\n```python\nimport requests\nr = requests.get('https://localhost:4430', verify='certificates/ca/ca.crt')\nprint(r.text)\n```\n\n\u003e NOTE: On Mac OS X, you may need to add the certificate to the Keychain with `security add-trusted-cert -p ssl certificates/ca/ca.crt`. To remove it, run `security remove-trusted-cert certificates/ca/ca.crt`.\n\n\u003e NOTE: To allow accessing the services in Google Chrome, enable the `chrome://flags/#allow-insecure-localhost` setting.\n\n-----\n\n## Troubleshooting\n\nTo inspect the status of the services:\n\n    docker compose ps\n\nTo inspect the log output of the services, eg. Elasticsearch:\n\n    docker compose logs -f elasticsearch\n\n## Deleting the Environment\n\nTo remove the containers, run:\n\n    docker compose down --volumes --remove-orphans\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkarmi%2Felastic-observability-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkarmi%2Felastic-observability-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkarmi%2Felastic-observability-demo/lists"}