this post was submitted on 11 Jul 2023
14 points (88.9% liked)

Selfhosted

40008 readers
669 users here now

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.

Rules:

  1. Be civil: we're here to support and learn from one another. Insults won't be tolerated. Flame wars are frowned upon.

  2. No spam posting.

  3. Posts have to be centered around self-hosting. There are other communities for discussing hardware or home computing. If it's not obvious why your post topic revolves around selfhosting, please include details to make it clear.

  4. Don't duplicate the full text of your blog or github here. Just post the link for folks to click.

  5. Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).

  6. No trolling.

Resources:

Any issues on the community? Report it using the report flag.

Questions? DM the mods!

founded 1 year ago
MODERATORS
 

Hi everyone, me and my friends are thinking of making a Telegram bot to use GPT-4 as one of us has access to the API.

We're not going to release the bot to the public (only use between us), however we'd like the bot to run 24/7 so it's accessible whenever one of us needs it. Sadly we can't host it ourselves as neither of us is able to get a Static IP and has a free machine to run 24/7.

My question is, are there any recommended hosting providers (if it's free even better) where we could host our telegram bot on? Thanks!

top 22 comments
sorted by: hot top controversial new old
[–] [email protected] 5 points 1 year ago

Any $5 VPS (usually single core plus 1GB RAM) should be good enough for this purpose if it is just a bot for you and your friends.

[–] [email protected] 5 points 1 year ago (4 children)

Oracle Cloud provides free plans

[–] [email protected] 8 points 1 year ago

if you're able to register...

[–] [email protected] 3 points 1 year ago

The Always Free tier is also very powerful in my opinion. You get 24GB RAM and 4 OCPU's for Ampere (Arm) architecture VMs. You can run Oracle Linux or just plain old Ubuntu on it!

[–] [email protected] 2 points 1 year ago (1 children)

Will take a look at that, thanks!

[–] [email protected] 1 points 1 year ago

I can confirm, I’m running the exact same scenario OP described (GPT-4 Telegram bot), on Oracle Cloud, and it works great. I found this implementation to be robust, easy to spin up, and easy enough to patch changes in.

[–] [email protected] 2 points 1 year ago* (last edited 1 year ago)

The gotcha for this is that you have to actually use the resources on your free instance or they will reclaim it. I use my instance as a Minecraft server so it utilizes about half of the 24GB RAM you get. For a very light compute task like a chat bot, it might be difficult to keep the instance from being reclaimed.

From this page:

Idle Always Free compute instances may be reclaimed by Oracle. Oracle will deem virtual machine and bare metal compute instances as idle if, during a 7-day period, the following are true:

CPU utilization for the 95th percentile is less than 15% Network utilization is less than 15% Memory utilization is less than 15% (applies to A1 shapes only)

[–] [email protected] 4 points 1 year ago* (last edited 1 year ago) (1 children)

FYI you don't need static IP for telegram bots if you use polling instead of webhook. So if your house connection is stable enough, you can make do with Raspberry Pi.

I'm hosting my stuff on cheapest DigitalOcean droplet (but still use polling for telegram bots). Any stable VPS provider would do just fine and you'll have system resources left for other stuff, telegram bots are very light.

[–] [email protected] 2 points 1 year ago (1 children)

I'm not sure I understand how I could use polling in this case. Would I just keep sending requests to the endpoint to see if there are any new messages sent or something like that?

[–] [email protected] 4 points 1 year ago* (last edited 1 year ago)

Yes Telegram bot API supports long polling which is basically your server making successive long-running requests to the Telegram server and wait for a response.

[–] [email protected] 3 points 1 year ago

AWS Lambda is the best for this, my bots run on it. That is, if you're ok with some delay in response. Otherwise an EC2 might work.

[–] [email protected] 3 points 1 year ago (1 children)

Why not use dynamic DNS since this isn't something mission critical?

[–] [email protected] 3 points 1 year ago (1 children)

Never really thought about it! Thanks, will take a look

[–] [email protected] 1 points 1 year ago

Happy to help :) I have ddns configured with duckdns and it's been pretty smooth. The only problem will be if you're behind cgnat.

[–] [email protected] 1 points 1 year ago

probably could fit into fly.io free tier. also as others have mentioned - oracle oci provides a nice free vm, which can be shut off if usage of resources is low, but you can workaround it by increasing a volume a bit more than free tier allows and pay something like a 1-2$ for it monthly.

[–] [email protected] 1 points 1 year ago

I've had the cheapest Hetzner server for a couple of years. Zero complaints, it's like 3e/month or something.

[–] [email protected] 1 points 1 year ago (1 children)

AWS EC2 has an always free tier that is perfect for telegram bots

[–] [email protected] 1 points 1 year ago (1 children)

Yeah I was thinking about EC2 as I've used it before for another project. Wanted to see if there are any other options just in case.

[–] [email protected] 1 points 1 year ago

recently did my own research on hosting providers for my own telegram bot project and i found ec2 had the easiest set up process and most transparent pricing structure for my needs

[–] [email protected] 1 points 1 year ago (1 children)

Do you need a static IP? can't you have a Dynamic DNS running on your router?

[–] [email protected] 2 points 1 year ago

A static up is not required for a telegram bot as the telegram api acts as an intermediary with the clients.

[–] [email protected] 1 points 1 year ago* (last edited 1 year ago)

Telegram bot doesn't need static IP, it connects to the service and does a get for updates. Default python wrapper polls.

That being said pythonanywhere or heroku are good cheap options.

load more comments
view more: next ›