livepeer / catalyst-api

MIT License
4 stars 2 forks source link

Improvements for Zero Impact Catalyst API Deployments #1347

Closed leszko closed 1 month ago

leszko commented 1 month ago

This PR includes 2 ugly changes that are needed to deploy catalyst-api separately from catalyst:

Change 1: Proxy /api/events requests

The events are used, e.g., to notify multistream target change and to nuke a stream. They are received in catalyst, then propagated to all nodes using Serf, and then forwarded to each catalyst-api instance. The change included here is to expose /api/events not only in catalyst, but also in catalyst-api (which then proxies the request to catalyst). It's needed because Studio API communicates events with catalyst-api (not directly with catalyst).

Alternatively, we could have two catalyst params in Studio API (but I think it would be "even more" ugly.

Change 2: Hack to resolve Catalyst API URL if not specified

Catalyst needs to communicate with each corresponding Statelss Catalyst API. E.g. staging-catalyst-0 needs to communicate with staging-catalyst-api-0. At first I thought it will be just an env variable, but then I realized that to introduce a new env variable we need to restart each catalyst node šŸ¤¦ . So to avoid restarting, I added a dirty hack to resolve dynamically the corresponding catalyst-api instance in the code (if not specified).