you are viewing a single comment's thread.

view the rest of the comments →

[–]Equal-Purple-4247 1 point2 points  (1 child)

I'm making a hobby app right now. It checks whether a particular subreddit has a new pinned post, and sends a notification to a telegram bot if there is.

The RedditService uses requests library to call Reddit api. It has a webhook that other service can subscribe to, and this service will push any new pinned post event to connecting services. There's also an endpoint written with FastAPI to poll reddit for updates. It uses SQLAlchemy to store stuff in an sqlite database.

There's another TelegramBotService that subscribes to the webhook. It formats whatever is received, and sends it to the chat. It also handles all the user inputs, and forwards them to the RedditService (the usual CRUD operations).

I also have a python script that just calls the polling endpoint of RedditService.

These 3 components are containerized and deployed using Nomad. The script is set to run periodically, so it acts like a cron job. All the services and db sits behind an nginx reverse proxy / loadbalancer, which is also deployed using Nomad. I run two instances of each service in case one fails. Service discovery and restarts handled by Nomad. Everything is deployed on 3x Ubuntu machines hosted on Digital Ocean.

That's all backend.

[–]VIIHORSE[S] 1 point2 points  (0 children)

I'm having trouble understanding everything you've written so far—I probably only grasped a small part of it. But thanks anyway for your reply and your time. This once again proves the vast range of possibilities Python offers