SRGSSR / pillarbox-event-dispatcher

A micro-service receiving events from Pillarbox players to broadcast them to multiple consumers
MIT License
4 stars 0 forks source link

Deploy Pillarbox Event Dispatcher to AWS #1

Closed amtins closed 1 week ago

amtins commented 1 month ago

Description

As a Pillarbox player, I'd like to be able to send events about the state of media playback in order to feed tools that measure the state of our services.

Acceptance criteria

amtins commented 1 month ago

After checking the AWS documentation I choose to go with AWS App Runner as it seems to be the most appropriate tool to run this service.

amtins commented 1 month ago

I've add and granted access to pillarbox-event-dispatcher the AWS Connector for GitHub app which will allow to deploy the app each time a commit is made against main.

amtins commented 1 month ago

AWS App Runner configuration

The configuration is quite straightforward.

Screenshot from 2024-09-04 15-21-23 Screenshot from 2024-09-04 15-23-53 Screenshot from 2024-09-04 15-25-31 Screenshot from 2024-09-04 15-27-01

amtins commented 1 month ago

Welp

AWS App Runner use an old version of Go, what a shame... Go runtime release information. A github issue begin for support https://github.com/aws/apprunner-roadmap/issues/225

I'll have to modify the code to make it 1.18.10 compatible, which shouldn't be a huge deal. However if for some reason this still not work I'll have to ask the devops team to setup an ECS or whatever name it's called. I'd like to avoid to rely as much as possible on someone else and having some crazy infrastructure just for publishing dumb app.

Screenshot from 2024-09-04 16-09-11

amtins commented 1 month ago

I removed the code incompatible with go version provided by AWS App Runner and change the default port from 8080 to 3569 and everything start to work just fine.

Screenshot from 2024-09-04 20-06-48

I also proxied the snitch trafic to Pillarbox Event Dispatcher to stress test le bousin and everything went just fine.

https://zdkimhgwhh.eu-central-1.awsapprunner.com/health

Test

Open a terminal and paste (event consumer):

Open another terminal tab and paste (event sender):

amtins commented 1 month ago

I'll push the README tomorrow.

amtins commented 1 month ago

I just noticed that AWS App Runner has a request timeout limit of 120 seconds, according to the documentation (refer to the first note under Web requests). I feel like I'm being babysitted...

The following header is removed by AWS https://github.com/SRGSSR/pillarbox-event-dispatcher/blob/ca6b2b1e144b068f74611c0e095fe2c39e397c9a/api/handler/handlers.go#L59

A GitHub issue about adding SSE support open since 2021, this shows how Amazon treat their costumers...

I found AWS Lambda response streaming, which is totally unacceptable since it forces you to use Amazon.

This means that the only remaining solution is to setup an EC2 ECS or whatever it's called.

amtins commented 1 month ago

From my point of view this AWS App Runner situation is a blocker for me. So it would be great to work with someone from sysadmin team setup an AWS whatever, so that we can close this task. To be precise, this service must be hosted in a different instance/container from any data consumer.