{"id":24835776,"url":"https://github.com/tobilg/marathon-event-proxy","last_synced_at":"2025-10-14T10:30:34.984Z","repository":{"id":86825864,"uuid":"74016966","full_name":"tobilg/marathon-event-proxy","owner":"tobilg","description":"A proxy for the Server Sent Events endpoint of Marathon's Event Bus","archived":true,"fork":false,"pushed_at":"2016-11-23T15:58:31.000Z","size":41,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-26T03:41:32.475Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tobilg.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-11-17T10:37:11.000Z","updated_at":"2023-07-04T10:44:31.000Z","dependencies_parsed_at":null,"dependency_job_id":"aa565c0c-ea77-4c19-90c7-2be86c53e5f6","html_url":"https://github.com/tobilg/marathon-event-proxy","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/tobilg/marathon-event-proxy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tobilg%2Fmarathon-event-proxy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tobilg%2Fmarathon-event-proxy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tobilg%2Fmarathon-event-proxy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tobilg%2Fmarathon-event-proxy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tobilg","download_url":"https://codeload.github.com/tobilg/marathon-event-proxy/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tobilg%2Fmarathon-event-proxy/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279018780,"owners_count":26086452,"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","status":"online","status_checked_at":"2025-10-14T02:00:06.444Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2025-01-31T04:51:44.357Z","updated_at":"2025-10-14T10:30:34.979Z","avatar_url":"https://github.com/tobilg.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# marathon-event-proxy\n\nThis project can act as a proxy for the [Server Sent Events endpoint](https://mesosphere.github.io/marathon/docs/generated/api.html#v2_events_get) of Marathon's [Event Bus](https://mesosphere.github.io/marathon/docs/event-bus.html).\n  \nIt's useful to limit the number of sent events, which is achieved by filtering only the requested event types per SSE connection. The events sent from Marathon can easily become quite large, especially for the `deployment_*` events, which subsequently imposes an unnecessary load both on Marathon and the receiving application, if the receiving application isn't normally interested in these types of events. \n\nMarathon by default doesn't have this capability (yet), but there's an [issue](https://github.com/mesosphere/marathon/issues/4637) on this topic. \n\n## Status\n\nThis project is considered as proof-of-concept, and `alpha` quality. \n\n## Configuration\n\nEnvironment variables can be used to configure the application:\n\n* `HOST`: The IP address the application should bind to. It'll use the `HOST` environment variable set by Marathon, when available. Default is `127.0.0.1`. \n* `PORT0`: The port which the application should bind to. It'll use the `PORT0` environment variable set by Marathon, when available. Default is `8888`.\n* `ENDPOINT`: The relative path which should be used as endpoint. Default is `/events`. \n* `MARATHON_HOST`: The Marathon hostname or IP address. Default is `leader.mesos`. If you don't use Mesos DNS, or the application runs outside the cluster, this has to be set.\n* `MARATHON_PORT`: The port on which Marathon listens to. Default is `8080`.\n* `MARATHON_PROTOCOL`: The protocol Marathon listens on. Default is `http`. \n* `LOG_LEVEL`: The log level which should be used. Default is `info`.\n\n## Usage\n\n### Server-sent events (SSE) endpoint\n\nIf you want to access the Marathon event proxy application by using Mesos DNS, you should be able to access it with your client at `marathon-event-proxy.marathon.mesos:8888/events` (if your Marathon app name is `marathon-event-proxy`, the port is `8888` and you didn't change/set the `ENDPOINT` environment variable). Otherwise, the respective configurations have to be taken into account.\n\nYou can now specify the list of event types (separated by commas) you want to receive for the connection application. If you're interested in `deployment_info` and `group_change_success` events, you can solely receive these by issuing the following request with your SSE client:\n\n    GET http://marathon-event-proxy.marathon.mesos:8888/events?event_types=deployment_info,group_change_success\n\nHave a look at the [Event Bus](https://mesosphere.github.io/marathon/docs/event-bus.html) docs to see the different event types possible.\n\n### Marathon app definition\n\nThe below configuration will start the application on port `8888` on a random agent. If you want to place the application on a specific agent, please use [Marathon's contraints](https://mesosphere.github.io/marathon/docs/constraints.html).\n\n```javascript\n{\n    \"id\":\"marathon-event-proxy\",\n    \"container\": {\n        \"type\": \"DOCKER\",\n        \"docker\": {\n            \"network\": \"HOST\",\n            \"image\": \"tobilg/marathon-event-proxy\",\n            \"forcePullImage\": true\n        }\n    },\n    \"cpus\": 0.2,\n    \"mem\": 256,\n    \"instances\": 1,\n    \"healthChecks\": [\n        {\n            \"protocol\": \"HTTP\",\n            \"path\": \"/health\",\n            \"portIndex\": 0,\n            \"gracePeriodSeconds\": 5,\n            \"intervalSeconds\": 10,\n            \"timeoutSeconds\": 20,\n            \"maxConsecutiveFailures\": 3\n        }\n    ],\n    \"portDefinitions\": [\n        {\n            \"protocol\": \"tcp\",\n            \"port\": 8888\n        }\n    ],\n    \"requirePorts\" : true,\n    \"labels\":{\n        \"MARATHON_SINGLE_INSTANCE_APP\": \"true\"\n    },\n    \"upgradeStrategy\":{\n        \"minimumHealthCapacity\": 0,\n        \"maximumOverCapacity\": 0\n    }\n}\n```\n\n## API endpoints\n\n### GET /stats\n\nThe application serves it statistics under the `GET /stats` endpoint. For each connection, there is an event count, as well as the total bytes sent:\n\n```javascript\n{\n\t\"connectionCount\": 2,\n\t\"connections\": {\n\t\t\"f13800e56c9b5c096431329f5bf3fd3b\": {\n\t\t\t\"deployment_info\": {\n\t\t\t\t\"count\": 2,\n\t\t\t\t\"bytes\": 315830\n\t\t\t},\n\t\t\t\"group_change_success\": {\n\t\t\t\t\"count\": 2,\n\t\t\t\t\"bytes\": 368\n\t\t\t}\n\t\t},\n\t\t\"4bde850fc300e3c4a74a841094b0aa61\": {\n\t\t\t\"deployment_success\": {\n\t\t\t\t\"count\": 2,\n\t\t\t\t\"bytes\": 315742\n\t\t\t}\n\t\t}\n\t}\n}\n```\n\n### GET /showEndpoint\n\nThe actual proxy endpoint can be gathered by requesting `GET /showEndpoint`. \n\n### GET /health\n\nThe health endpoint at `GET /health` can be used for health checking.\n\n## Roadmap\n\nThe following topics are on the roadmap currently:\n\n - [ ] Reformat event object to create smaller payloads (probably either via [linq.js](https://www.npmjs.com/package/linq) or [json-path](https://www.npmjs.com/package/json-path)).\n - [ ] Filter on specific field values / ranges / etc.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftobilg%2Fmarathon-event-proxy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftobilg%2Fmarathon-event-proxy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftobilg%2Fmarathon-event-proxy/lists"}