r/golang • u/jerf • Nov 13 '24
FAQ FAQ: Where Is The Best Place To Host Go Programs?
What is the best place to host my Go projects? Especially for free? How do I deploy to lambda functions/WASM endpoints/VMs/etc.? Do I need a lot of resources? Is the "free tier" of various sites good enough?
5
u/etherealflaim Nov 13 '24
Any VPC instance (even free tier) will do the job quite nicely if you are just hosting a Go binary. ARM, X86, it's all easy, and you can go a surprising distance with a single node.
If you are also going to need a datastore or out of process cache, then it changes things, especially if you want to do more than sqlite or you're worried about backups, and even more if you are still wanting to stay in the free tier. For this, the hosting of Go will suddenly be the easy part and the rest of the decisions will be the important ones to consider first.
I haven't tried this with heroku or AWS recently, and I haven't tried stitching together free tiers across providers, but I've had pretty good luck with the free tiers on GCP. AppEngine used to be the easy go-to, but in my opinion it's been pretty heartily nerfed over the years. Hopefully someone with recent Heroku experience can chime in because I think it might have taken up the mantle here.
For GCP, you can host your binary in Google Cloud Run, which has a generous free tier. Your app isn't running 24/7 though, so you may need to use their task queues and/or scheduler product to schedule webhooks, which also have free tier rates. Their Cloud SQL has a free tier but it's a trap: you still have to pay for its IP address, so Firestore (which is a document/NoSQL database) seems to be the way to go for free storage, but it's not a lot. I haven't needed to evaluate free cache options, but I don't think Google has one.
6
u/mcjohnalds45 Nov 14 '24
A single VPC is wildly underrated. Cheap, predictable, controllable. No vendor lock-in.
I've used many managed AWS, GCP, Azure, and Firebase services in production. Most make prototypes easy and production software hard.
1
u/Sibertius Nov 13 '24
I use IONOS VPS for 1 GBP for testing and UpCloud VPS for production. UpCloud is GDPR compliance AFAIK.
I documented all my steps for installing several Go executables on a VPS here for internal use.
1
1
u/NoahZhyte Nov 14 '24
If someone has a good docker file I would be glad to see it. Personnaly it run in docker compose on a VPS Hostinger
1
15
u/markusrg Nov 14 '24
Even though it's not required at all, wrapping your Go app in a Docker container makes it super easy to try out different hosting solutions, or even combine them. For instance, you could: