Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

On-air alert functionality (w JBot! sorta...) #41

Closed
gerbrent opened this issue Jul 6, 2022 · 15 comments
Closed

On-air alert functionality (w JBot! sorta...) #41

gerbrent opened this issue Jul 6, 2022 · 15 comments
Assignees
Labels
enhancement New feature, enhancement, or request JB - need decision decision/consult needed from JB Team
Milestone

Comments

@gerbrent
Copy link
Collaborator

gerbrent commented Jul 6, 2022

@reesericci:

I'd like to work on a webhook endpoint to tell the website about a live show
from jbot (basically can I use netlify functions/cf workers)

I was hoping to be able to deploy a serverless/edge function on something like cf workers/netlify functions/deno deploy to create an endpoint for JBot to ping and then store a running "live show" JSON object in a redis/workers KV

that way the website would ping the JSON endpoint every time it's loaded to check if a show is live

and JBot would ping (with a token) a JSON object containing which show was going live to a different endpoint

instead of updating git every time

@gerbrent gerbrent added the enhancement New feature, enhancement, or request label Jul 6, 2022
@gerbrent gerbrent changed the title On-air alert functionality (w Jbot! sorta...) On-air alert functionality (w JBot! sorta...) Jul 6, 2022
@reesericci
Copy link
Collaborator

reesericci commented Jul 7, 2022

I got a basic deno serverless/edge function working that stores a JSON object that looks like this in redis:

{ 
  "title": "Jupiter Broadcasting,
  "chatroom": "irc.geekshed.net"
}

then makes it accessible from a GET request (e.g. when the page loads) and allows POST/DELETE requests with a JWT signed with an RSA key pair to update that object

I'm unsure if it's a good idea to set up a system to notify clients, people viewing the website or possibly a background service worker, about any changes realtime instead of the website checking whenever it's loaded. Then clients could be notified right away that JB went live, but it's a complex system to set up and would require a server to handle the subscriptions. (because the clients would be behind NAT and a callback URL wouldn't work) I don't think regular HTTP polling is a good idea because of bandwidth costing money.

@reesericci
Copy link
Collaborator

@reesericci
Copy link
Collaborator

@StefanS-O is there any pipeline for deploying a serverless function? (i.e. vercel, netlify, cloudflare workers, deno, etc)

@elreydetoda
Copy link
Collaborator

@StefanS-O is there any pipeline for deploying a serverless function? (i.e. vercel, netlify, cloudflare workers, deno, etc)

I know I'm not Stefan, but from my observation of the infrastructure there isn't. If you just do an nslookup on the website domain:

$ nslookup jupiterbroadcasting.net 8.8.8.8
Server:         8.8.8.8
Address:        8.8.8.8#53

Non-authoritative answer:
Name:   jupiterbroadcasting.net
Address: 142.132.186.250

And a whois on the returned IP address, you'll see that it's an IP address controlled by hetzner.com (which is a hosting company similar to Linode).

If they use more of cloudflare (reasons mentioned here), you should be able to use cloudflare workers.

@elreydetoda
Copy link
Collaborator

Also, I know I haven't really commented on this issue before, and am definitely not very familiar with redis, but if you're looking for a KV store is there a reason for not using a hosted service like this: https://www.cloudflare.com/products/workers-kv/

I've never used it before, but just thinking of ways to lighten the amount of services that JB'll have to run initially to get the website up and running. I'd imagine if they want to host a redis instance later on (since self-hosting is something JB does) that'd be doable, but just to initially launch without an extra 2-3 services (search + s3 endpoint where some other services talked about).

@reesericci
Copy link
Collaborator

CF KV is an excellent solution, I just didn't want to use it if JB wasn't going to utilize CF workers for deploying this.

@reesericci
Copy link
Collaborator

I also built it on top of the Deno runtime which is not supported by CF, only themselves (Deno Deploy) and Netlify from what I remember.

@elreydetoda
Copy link
Collaborator

Ya, IIRC CF works run their own version of a node runtime, right? (Only heard about it on podcasts)

@reesericci
Copy link
Collaborator

Deno isn't node so it wouldn't work

@reesericci
Copy link
Collaborator

for realtime updates Cloudflare's Pub/Sub: https://developers.cloudflare.com/pub-sub/ could possibly work instead of self-hosting a pub/sub solution.

@reesericci
Copy link
Collaborator

As it turns out, redis has a builtin Pub/Sub function: https://redis.io/docs/manual/pubsub/

@elreydetoda
Copy link
Collaborator

Deno isn't node so it wouldn't work

Ya, I was mainly asking if you knew the runtime that they use, not trying to say deno is node 🙃

@elreydetoda
Copy link
Collaborator

for realtime updates Cloudflare's Pub/Sub: https://developers.cloudflare.com/pub-sub/ could possibly work instead of self-hosting a pub/sub solution.
As it turns out, redis has a builtin Pub/Sub function: https://redis.io/docs/manual/pubsub/

Cool! So redis could be used for local dev and Cloudflare could be used for prod?

I wouldn't start working on modifing it (unless you want to) until you get a JB person's (or others via proxy (@StefanS-O or someone similar) ) opinion which solution they'd like more. (Self-hosting redis, cloudflare KV or Pub/Sub, etc...)

It's honestly up to them for whatever is easiest to implement/maintain + what's needed.

I was honestly just asking, because I was curious 😅

@StefanS-O
Copy link
Collaborator

I will start looking into this after launch, this is not a milestone 1 issue and also needs decissions from @ChrisLAS where this should be hosted.

@gerbrent
Copy link
Collaborator Author

feature completed by #378

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature, enhancement, or request JB - need decision decision/consult needed from JB Team
Projects
None yet
Development

No branches or pull requests

4 participants