10 ms·
Ask HN: Optimal cloud service to run tiny website with back end Python + SQLite?
Web ninjas:
What is your go-to cloud service for running a small website served with python + jinja2 + sqlite? The website does little besides searching an sqlite table, serving a form, and writing the form response to an sqlite table, all with minimal computation and bandwidth. Wants are:
Low price
Low maintenance time/cost
Simplicity
My strengths do not include web development/servers but I know the basics. I'm particularly interested in the gotchas like: difficulties setting up SSL, transfer limits, and "X is perfect except that ____".
If I'm asking the wrong question or not providing enough info, please say so.
- znpy 7y agoIf you don't have too much load, heroku could be good for you, but you'll have to use postgresql. The free tier is nice though.
- tln 7y agoHaving to use postgres seems like a plus :) besides being a great dbms, using postgres means you can port to other hosts easily, as opposed to say firebase. I second heroku for OPs requirements, extremely easy to set up and manage, and the free tier handles many small sites well. Whatever you choose, use cloudflare for free SSL.
- codegladiator 7y agoLinode/DigitalOcean
- karambahh 7y agoScaleway, with or without their DBaaS offer if you need more perf
- jklein11 7y agohow about a raspberry pi and dyndns?
- shakkhar 7y agoI would worry about being DoS'ed, and having my home network compromised because of a vulnerability in raspberry pi software stack. Other than that, I think it's a good idea. I do the same for a personal use server, but don't expose the port on the public internet.
- klambda 7y agoIf you put Pi in a segmented network this is a good solution. That's what I do now anyway with python + sqlite and Netgate sg-1100 as a firewall
- rasulkireev 7y agoI've used DigitalOcean (ref link -> https://m.do.co/c/a2a2c0826ff3 https://m.do.co/c/a2a2c0826ff3) to host my Django sites, both with postgresql and sqlite. It will take you some time to figure out how to host it. Once you a succeed each subsequent time becomes much easier. Plus you get to learn a ton about server management. There are fantastic posts that will help you. https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-18-04 https://www.digitalocean.com/community/tutorials/how-to-set-...
- kumarvvr 7y agoSecond this. DO is insanely easy to use and it provides solid footwork to delve into a bit of an actual production deployment process.
- kirubakaran 7y agoHow important is SQLite to you? I run https://crushentropy.com/ https://crushentropy.com/ (high-res scheduling) on Google App Engine (Standard) with data persisted on Firebase. It costs me $0 per month.
- anaganisk 7y agoSo the user must, re-write his code to fit into firebase?
- kirubakaran 7y agoNo, just saying that's an option to consider, that's all. If the current code is super small, it can be a quick change. There are different kinds of "simple". SQLite sure is simple in several dimensions, but then you need a writable file system for it, and file locking is not an issue for your usecase etc. I consider my set it and forget it setup to be simple, and I haven't had to do any maintenance in 3 years, though Firebase is not exactly what you'd call "simple".
- heavyset_go 7y agoOracle Cloud only if you can use a their free VPS tier. If you can't, then Heroku or a cloud free tier.
- paxpelus 7y agoI hate messing with nginx and ssl configurations that why I tried caprover (https://caprover.com/ https://caprover.com/) on a vultr server. It handles ssl through let's encrypt and it even includes some nice monitoring tool. It needs some familiarity with docker if you want to fully use its features but in general I am running it on 2 servers with success and I am very happy. I totally recommend it.
- joshmn 7y agoDokku + your favorite VPS: http://dokku.viewdocs.io/dokku/ http://dokku.viewdocs.io/dokku/ Installation is a breeze and there are plugins. If you're at all familiar with Heroku's deploy, you'll love this. It's the closest thing I've found to `git push` without any thinking.
- znpy 7y agoGlad to see that dokku is still alive. Definitely recommend this.
- StavrosK 7y agoAnother vote for dokku, I moved all my projects there years ago and couldn't be more satisfied.
- throwaway77384 7y agoDokku + Hetzner + CloudFlare here. It's just so simple. I love it. I have noticed that deploys eat HDD for breakfast. Prune often. ("docker system df" helps show stats on space usage). I have also read many optimisation guides talking about Alpine Linux images, but not sure whether that makes a difference. Running a Go stack. Often wondering whether Caddy could be an alternative? Sometimes I feel like this is still "too much". Like I still don't have enough control over the stack. Cloudflare introduces a lot of magic. I am not sure I fully grasp Dokku, but it works. Oh well!
- 1337shadow 7y agoDocker sacrifies disk space, but at least do you have /var/lib/docker on btrfs ? Traefik is a reverse proxy for containers out of the box, apparently you would need some plugin to have that feature on Caddy : https://github.com/lucaslorentz/caddy-docker-proxy https://github.com/lucaslorentz/caddy-docker-proxy As such, it seems like Traefik would be easier to setup for your use case.
- tasuki 7y agoI just use `git push` without Dokku (something like https://gist.github.com/tasuki/5176431 https://gist.github.com/tasuki/5176431). What would Dokku give me?
- x0x0 7y agoI suggest aws (probably elasticbeanstalk, maybe a raw box) simply because it's a very well trodden path. Lots of helpdocs, tutorials, instructions, etc etc etc. Assuming you're a professional in the US / west europe, etc, the diff between $20 or $30/mo and $5 or $0 per month is negligible, while the time savings just from staying on a standard path can be huge. My default suggestion would be: Elastic Load Balancer, to talk to the internet and terminate SSL; Elastic Beanstalk or something similar to host a box; Certificate Manager for your SSL cert; Route53 to serve your DNS. All of the above should be cheap and, again, a very well trodden path with tons of help docs and people familiar with configuration.
- lvturner 7y agoThat sounds completely overkill for OPs question - without digging deeper it sounds like OP really just wants a cheap VPS perhaps with a lightweight management layer on top. Granted, Elastic Beanstalk/Load Balancer will allow you to scale should you end up with a massive influx of traffic - but I think you'd be far faster to spin up a VPS and use where-ever your bought your domain name from to point your domain name to it's IP. In fact - this is exactly what I do and it took well under an hour including choosing and buying a domain name and costs $5 a month.
- x0x0 7y agoI didn't intend any of this to be about scale. Again, it's about ease of setup and maintenance. For example, I spent a pile of time getting letsencrypt to work with nginx. Admittedly, this was a couple years ago, but I had to go back in and fiddle with a config I barely remembered 6-ish months ago. My ELB + AWS Certificate + EB have kept chugging along without a peep. I also ticked the EB setting to continually upgrade linux to take care of OS-level security issues. You may be an expert on setting up linux/nginx/puma/bundler/ruby, but I've found that running my own (which I do!) requires a full couple days of maintenance a year. Again, from a person who does not do this regularly. My AWS EB environment just does a new deploy and the magic keeps on magicking itself. :shrug:
- 7y ago
- jiofih 7y agoDigitalOcean, Vultr, Linode
- Scarbutt 7y agoIf you want something fire and forget and since this is simple I would go with a serverless solution. Static files (with some little JS) hosted on some CDN and serverless database. One option is AWS dynamodb and their CDN, a more friendly beginner solution is firebase. You can't get more low maintenance than that.
- antender 7y agohttp://pythonanywhere.com http://pythonanywhere.com This guys specialize in python hosting and have a free tier
- rich_sasha 7y agoI too have a very good experience with them. Very, very simple and no hassle to set up. In particular, all the web hosting side of things is preconfigured.
- syedmeesamali 7y agoLove them always and still hosting with them. Will switch to paid one once I get some traffic. Excellent guys and hosting packages.
- bitfhacker 7y agoSecond this.
- aprdm 7y agodigital ocean, the cheapest VPS bucks one.
- sebastien_bois 7y agoMight not fit your needs exactly, but others looking for something similar might find NearlyFreeSpeech.NET a good fit: https://www.nearlyfreespeech.net/ https://www.nearlyfreespeech.net/
- MoBattah_ 7y agoAmazon Web Services. Won't cost much. If you want to keep it simple.. A very small EC2 box. Maybe even micro instance. That'll run your python code + sqlite. If you want, you can use an elastic load balancer or Route53. If you don't have DNS already. Route53 is AWS's DNS service which is easy to use. This whole setup should not cost you much. If you do it right, you can probably spend less than $10/month taking advantage of the free tier. Later on, as a side project, you can try to make the app serverless. You're probably close to it being serverless. Doing this allows you to run it on AWS Lambda. Which makes things even cheaper, if not free. And it's just pretty cool. But most likely you'd have to switch to a real data store. No problem since AWS has DynamoDB.
- rini17 7y agoAbsolutely nope. Both unfamiliar naming and the console interface is overwhelming, it's overkill to learn it just to run one VPS.
- somishere 7y agoWould definitely be looking at removing the homespun server aspect and going with a high-performance, low latency paas / serverless setup. Lets you focus on and deliver the outputs you need (i.e. user interface + data). If I were in your shoes I'd be looking at either: - Firebase (free tier). Probably just using their RTDB for storage. You could conceivably do away with your backend entirely here. - Cloudflare workers + KV storage (~$5 per month?) .. this would give you killer performance and let you write your storage logic in python. You're paying a minimum fee per month here, but in reality that could cover a large number of seperate sites. Both suggestions raise vendor lock-in considerations, but given the use-case it doesn't seem like a major concern. Of course if you're looking forward to the joys of managing a box ...
- doctoboggan 7y agoGoogle cloud run. If you can put your python app in a docker container (very easy) then you can run it on Cloud Run. They have a very generous “always free” tier.
- stubob 7y agoSecond. I'm running an appengine site, and it's nice to be able to deploy from command line. I'm using Mongo Atlas, but they have a free tier as well. If you don't mind an appengine domain, you can have a free friendly domain as well.
- justsomeuser 7y agoIf SQLite sends writes to the disk you cannot use cloud run, as it does not have a persistent disk.
- doctoboggan 7y agoYes sorry, I should have said also you can use their always free VM Compute Instance to run the DB.
- ssb1 7y agoMaybe try out glitch.com . Search for Python examples.
- blikdak 7y agoAWS has a free tier for a year after signing up. A 'tiny' instance for webserver with letsencrypt on for your free ssl/tls certificates. You can automate backups via snapshots, though make sure they delete automatically after a week or so. I would recommend you use MySQL instead of SQlite, use RDS free tier there, SQlite not so good with concurrent connections and definately not if people are adding their own information. Look into haproxy as your gateway so you can scale to multiple servers if need to but not be tied into AWS specific Route 53, if you set it up right you can basically grab the configs, site source, files etc and a database dump and run it on a Raspberry PI in your home if you need to and have a static IP. Try not to get tied into one specific cloud provider too and keep shopping around for free or better deals. You can have a web presence for no money except your DNS registration with a little bit of tinkering and looking around.
- anaganisk 7y agoThe user says, a tiny site, why the over engineering? Unless we are speaking of tens of concurrent connections SQLITE works.
- aplummer 7y agoI just wanted to say since you seem unsure of yourself a little: You have a really great approach to simple software. Turns out your strengths do include setting up backends for web development! Many self styled experts / People 2 digit years of experience who consider themselves solution architects could learn from you and your approach here.
- aoeusnth1 7y agoCheck out google cloud run for running your stateless webserver, its free tier is pretty good and you can run whatever stateless container you want to. Personally from there I would use a min-spec Postgres CloudSQL for the DB, but you can use whatever hosting you like if you want to DIY.
- gospaz 7y agoSign up for an Amazon Web Services account and a Cloudflare account Python + SQLite AWS EC2 t2.micro DNS + SSL Cloudflare free plan Total cost = $0
- platform 7y agoPRGMR.com 1.25 GiB RAM, 15 GiB Disk for $5 per month. https://prgmr.com/xen/ https://prgmr.com/xen/ inexpensive. no overage charges. can pay by bitcoin. (and a FreeBSD friendly). I wonder if you would also benefit from installing something like yunohost [2] on top of Debian. This will get you your personal cloud. And the use YounoHost's 'Custom web app' container [4] This way, you get an automatically configured web server (nginx), with certificates (via Let's encrypt) that get auto updated. You also get a pre-configured user/sftp access to your app's folders. And those folders will be backed up when you hit the backup button... Nginx will invoke your python app when the predefined URL is hit. All you have to do is to point your domain registrar to the prmgr VPS host running yunohost. [2] https://yunohost.org/#/whatsyunohost https://yunohost.org/#/whatsyunohost [3] https://yunohost.org/#/apps https://yunohost.org/#/apps [4] https://github.com/YunoHost-Apps/my_webapp_ynh https://github.com/YunoHost-Apps/my_webapp_ynh
- dclusin 7y agoAre you affiliated with the company? I chuckle when I see this hosting shop pop up on HN. They had advertisements on the dividers at the Safeway in Mountain View. Was wondering how they worked that.
- asheley 7y agonice word
- asheley 7y agobecause it is hard to work with that the virus is hard and everywhere is hot here in teaxs
- sn 7y agoTo my best knowledge, I and lsc are the only people associated with prgmr.com who post semi-regularly on HN. lsc isn't involved much beyond having a minor stake in the company. lsc set up the Safeway divider advertisements. It was pretty cheap, like $150 a month. I don't think we would do it again, but it certainly caught a lot of people's attention.
- 7y ago
- ChicagoDave 7y agoFind a friend with a hobby linode server who will put it up for free.
- chrisgoman 7y agoDigitalOcean (or any of the $5 VPS) with Debian 10, you will need to know "basics" like SSH and typing some commands (a bunch of sudo apt-get _____) and then you are done. The only thing you don't have with DigitalOcean is domain name registration but everything else is there. Use them for DNS! They have some pre-built stuff for your list here but I would just spin up a blank Debian 10 box. You can also get a free tier at Amazon AWS but you have to learn all the EC2 stuff and almost piece yourself a server one piece at a time (like the good old days where you build your own PC but clicking buttons) -- IMHO this takes much longer than just doing a $5 VPS and typing things. So if you want to learn Amazon AWS stuff, this may be a good path but it is going to take a lot longer
- monkey26 7y agoUsed to do everything on Digital Ocean but had better performance on Vultr for the same price. But either will do. My use was crypto trading bots, also using SQLite for storage.
- aantix 7y agohttps://www.wholesaleinternet.net/dedicated/ https://www.wholesaleinternet.net/dedicated/ Dedicated server. 16GB memory. 2TB of drive space. $25.00/mo
- whytaka 7y agoAnother vote for DigitalOcean. It's just a computer connected to the internet.
- anildash 7y agoHere’s an easy example on Glitch that you can remix: https://glitch.com/~hello-python-flask-sqlite3 https://glitch.com/~hello-python-flask-sqlite3
- martininmelb 7y agoI wrote this app last weekend mostly so that I could look at COVID-19 stats, but also as a learning exercise. I download data from John Hopkins, ingest it into a SQLite database and then have a couple of Python scripts to present an API to the front end. It is hosted on a Digitalocean droplet which costs me US$5.00 per month. Setup is easy - takes less than 10 minutes, and if you know Linux everything is pretty straightforward. I also use Cloudflare as a DNS (free tier). https://martin.schweitzer.id.au/covid19/ https://martin.schweitzer.id.au/covid19/
- mahalol 7y agoThat's a pretty cool project. As a Sysadmin I know a bit of Python and how to use Rest APIs but would you mind pointing me in the right direction on how you present an API to the front end? I'd like to learn how to build a website like this.
- aivarsk 7y agoNot mentioned by others, http://atlantic.net http://atlantic.net starts at $5 a month. DigitalOcean has a similar offer with much better documentation. I run a couple of larger servers at DigitalOcean and am really satisfied with uptime, management console, etc. So my vote goes for DigitalOcean. But Atlantic had a 256Mb RAM, 10Gb disk option years ago for just $0.99 I still have one server there for hosting static HTML, running some scraping tasks, MS document to PDF conversion service (Python Twisted) for a customer, etc. All that for just $1.20 a month (including VAT)
- ilaksh 7y agoI like AWS Lambda with RDS and Cloudfront or whatever. It can be a pain setting up the VPC and security stuff, but it seems worth it because as far as I can tell it is extremely reliable and there is no server to maintain or secure.
- mateioprea 7y agohttp://scaleway.com http://scaleway.com it costs 3$/month for a vps
- bunya017 7y agoSecond. Scaleway + Cloudflare + CapRover, you get the simplicity and joy of using PAAS without the cost. CapRover's one click install is awesome.
- luto 7y agotry https://uberspace.de https://uberspace.de - name your own price (1-15€), HTTPS, python, sqlite, shell access, databases and much more included. Docs: https://manual.uberspace.de/ https://manual.uberspace.de/ https://lab.uberspace.de/guide_django.html https://lab.uberspace.de/guide_django.html disclaimer: I work for them, but used to be a customer long before I started.
- eb0la 7y agoSmall hosting (whichever you like best), plus cloudflare for DNS and transparent caching.
- kameit00 7y agoI switched from DigitalOcean to Hetzner. https://www.hetzner.com/ https://www.hetzner.com/
- lwh 7y agoCan your code work on AWS Lambda with one of their DB services? If you need it to scale with growth starting on a cloud platform will save headache later. If you don't need scaling it's possible you could run it on the permanently-free tiers or very low cost once you utilize the free quotas each month.
- jjice 7y agoA bit of a mix of the other comments, but I use a generic VPS (I use DO now, used to use EC2, but anything works) with my application wrapped in a Docker container with its port exposed. Nginx reverse proxy to pass from 80 to my container's port. After that is working, I use certbot and it automatically detects Nginx and offers to automatically set up TLS on 443 and redirect 80 -> 443 to ensure connections are coming through HTTPS. certbot is a god send.
- jventura 7y agoI still use Webfaction for my webapps although since they were bought by GoDaddy, costumers seem to start moving away from it.. But it is quite simple to deploy a Python webapp, they have one-click installers and you can ftp your source files like we all used to do.. Prices start from 10$/month.
- shanecleveland 7y agoI moved to opalstack.com. Made by former WebFaction employees. Loving it.
- jVinc 7y agowww.pythonanywhere.com Nice little setup where you get python set up out of the box, and you even have some options of quickly setup database if you need to go beyond sqlite. It's very flexible, cheap and definitely a time saver for when you want something up and running quickly.