Great writeup! I think it's useful to talk more about complete stacks instead of focusing on individual parts without mentioning the "glue" between them so I really like these kinds of posts. Just two questions: 1. If you're not going for scalability why Postgres and not SQLite? 2. What does your monitoring look like? I've read something about Grafana and Hetzner dashboards in the comments but what exactly do you use…
Docker, Django, Traefik, and IntercoolerJS: My go-to stack for building a SaaS
171–180 of 347 posts
Re: Docker, Django, Traefik, and IntercoolerJS: My go-to stack for building a SaaS
#172Is there a benefit of running Postgres and Django in different containers? By putting them in the same container, things could be a good bit simpler. And I don't see any downside here.
> s there a benefit of running Postgres and Django in different containers You can use the official optimised containers ( especially for complex things like Postgres that's great) > By putting them in the same container, things could be a good bit simpler. And I don't see any downside here The downsides are that you get fat containers that are impossible to scale independently ( one day you might want two Django con…
Re: Docker, Django, Traefik, and IntercoolerJS: My go-to stack for building a SaaS
#173I really like the authors philosophy. Too many developers use a bunch of tools, and you get the impression that it's just for the sake of tooling, or because that's how you're expected to do things. You can keep scaling a single server and deploying via simple git hooks for years until you need a more fancy setup. Especially for side projects, you want to use the minimum amount of tooling that gets out of your way so…
With side projects, maybe there is a certain thing I want to get out of it - eg I want to focus on design more. With the myriad of tools out there, I can then choose something that makes development less involved, and lets me focus on design. Or vice versa - if I only care about the dev side, I can import eg tailwind or buy a web components lib and call it a day.
Re: Docker, Django, Traefik, and IntercoolerJS: My go-to stack for building a SaaS
#174Earlier quoted context omitted.
How much experience do you have with Docker? I am not being snarky -- all the things you say sounds like something I would have said until I pulled myself together and learned how to use it properly. And granted, that did take a bit of effort but now my perspective is that Docker is extraordinarily easy to work with. A Dockerfile is almost exactly like your requirements.txt file, only it works for everything. Need Im…
I don't have a lot of experience with Docker, but it's not what's holding me back. Here are some of my pain points: 1) Having to "docker exec" to get a shell in a running container vs just running the command (in dev) or sshing into the server (in prod). 2) Tests taking 3:30 min to run with docker vs 30 secs without. And then of course, you don't just run tests once but many times, leading to tens of minutes on a giv…
Re: Docker, Django, Traefik, and IntercoolerJS: My go-to stack for building a SaaS
#175I really like the authors philosophy. Too many developers use a bunch of tools, and you get the impression that it's just for the sake of tooling, or because that's how you're expected to do things. You can keep scaling a single server and deploying via simple git hooks for years until you need a more fancy setup. Especially for side projects, you want to use the minimum amount of tooling that gets out of your way so…
It is fun to learn, but it sucks to yak-shave [1] all the time.
The simplicity of the stack lets me walk away for days (or years) at a time, come back, and easily ship changes. No need to remember esoteric commands, configs, or get bitten by strange infrastructure upgrades.
I'm lazy, and I'm just looking for ways to be lazier. :-)
Re: Docker, Django, Traefik, and IntercoolerJS: My go-to stack for building a SaaS
#176Earlier quoted context omitted.
How much experience do you have with Docker? I am not being snarky -- all the things you say sounds like something I would have said until I pulled myself together and learned how to use it properly. And granted, that did take a bit of effort but now my perspective is that Docker is extraordinarily easy to work with. A Dockerfile is almost exactly like your requirements.txt file, only it works for everything. Need Im…
I don't have a lot of experience with Docker, but it's not what's holding me back. Here are some of my pain points: 1) Having to "docker exec" to get a shell in a running container vs just running the command (in dev) or sshing into the server (in prod). 2) Tests taking 3:30 min to run with docker vs 30 secs without. And then of course, you don't just run tests once but many times, leading to tens of minutes on a giv…
1. If you're doing this, then you're likely using docker incorrectly. Your container should be run from images that are automatically deployed. If there's an issue, fix local and deploy image.
2. I agree, that sounds dreadful. We use pyenv and poetry for local development and docker for deployments. That would address your issue. We of course do not use pyenv or poetry inside the docker image. Hopefully that helps clarify potential real world use.
3. Your should not be debugging a live deployment. Debugging local container is straight forward in VSCode.
4. This shouldn't be an issue. Prune weekly, and aim for smallest images where possible, e.g., 60MB for python microservice.
The value is in the simplicity of deployment. Need to host a well-known software? Can be up or down no time.
Re: Docker, Django, Traefik, and IntercoolerJS: My go-to stack for building a SaaS
#177IntercoolerJS / htmx looks like a really cool solution for server-side rendered HTML with client-side interactivity. All the hype is currently with https://hotwire.dev/ but htmx has more features, seems more solid and even supports older browsers like IE11.
Re: Docker, Django, Traefik, and IntercoolerJS: My go-to stack for building a SaaS
#178Is there a benefit of running Postgres and Django in different containers? By putting them in the same container, things could be a good bit simpler. And I don't see any downside here.
To make it more realistic, let’s assume that you use an exotic pg extension. Some morning you read about a huge security issue in django. You see the patch comes with library upgrades that are incompatible with your exotic extension. So what do you do? With two separate containers, you can patch one and leave the other one untouched. Saying that the extension shouldn’t be so brittle is true but doesn’t solve the issue because without it you wouldn’t have the job.
(For a real scenario look at the python 2 deprecated thread and arcgis)
Re: Docker, Django, Traefik, and IntercoolerJS: My go-to stack for building a SaaS
#179I don't get why people use Docker for "small SaaS apps" where "scale is not an issue". You can run everything without Docker to remove an extra level of indirection. I've been doing that exact thing with a very similar Django stack for years. Not once have I missed Docker. On the other hand, I have taken over SaaS projects where the (unnecessary) usage of Docker made it more expensive to host, decidedly more difficul…
Re: Docker, Django, Traefik, and IntercoolerJS: My go-to stack for building a SaaS
#180Earlier quoted context omitted.
Thanks for the kind words. I should update the part about the queues. I started using this pattern for SKIP LOCKED and it works well for multiple workers (search engine crawlers). https://www.2ndquadrant.com/en/blog/what-is-select-skip-lock... And implemented in Django: https://docs.djangoproject.com/en/3.1/ref/models/querysets/#...
I instantly thought of something similar when I looked at your code. I like the simplicity! I used to combine RabbitMQ and Celery for async tasks. Mostly because it's what I learned to do since it was already in use at my first job. But Celery is such a pain -- or, at least, it was at that job. So many configuration options, different places where they were stored in different versions[1]. Weird errors. Poor document…