Antvirf / railway_django_stack

A Railway template for a full Django app with a Celery worker, Redis and PostgreSQL
https://railway.app/template/NBR_V3?referralCode=6rOei9
4 stars 6 forks source link

Cost estimate #13

Open CharlesFr opened 8 months ago

CharlesFr commented 8 months ago

Nice template, curious to understand what's the base running cost for this solution?

Do you also foresee any issues adding flower dashboard or running this for high-availability production systems?

Antvirf commented 8 months ago

Hey, thanks for opening an issue @CharlesFr !

Cost estimates are a bit difficult with Railway since the services will use minimal CPU when not in use. If you spin up just the base template, having it idle consumes ~zero vCPU, but about 1.3-1.5 GB of RAM, most of which is taken up by Celery. That would amount to about USD 13-15 per month from the latest pricing. If you wanted to optimise it further, it's probably possible to reduce that by decreasing Celery concurrency since by default it uses all available cores.

I've set already configured something like that with Gunicorn as the number of workers is set to 3 in the template to provide a reasonably cheap starting point, though this bit is something you may find a need to increase once you receive more traffic.

For Flower dashboard, I don't think it would be a problem, just add another container/service to deploy. Since it's an admin tool that's probably only used occasionally, I'd recommend configuring app sleeping - that way the cost would probably only be a few cents.

Haven't come across any issues around availability 😄

CharlesFr commented 8 months ago

Thanks for your response, I am paying about $2k per annum with GKE for a very low demand (but high availability) so this seems like a substantially better deal.

Is the docker-compose you've added actually used by Railway or it's just for dev?

On a minor note, Railway has implemented structured logs - is that something you'll be adding to the template?

Antvirf commented 8 months ago

The docker-compose is purely for development and trying it out, Railway itself just uses the Dockerfile to build the images and the template itself to choose what/how to deploy.

I've looked at structured logs in Django a couple of times but always rolled back to avoid the extra complexity of more config + more deps. I'm sure at some point I'll get on that train also and then perhaps expand the template :)