Live data from Hacker News

Docker, Django, Traefik, and IntercoolerJS: My go-to stack for building a SaaS

simplecto.com

171–180 of 347 posts

Re: Docker, Django, Traefik, and IntercoolerJS: My go-to stack for building a SaaS

#171

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…

Not the author but for monitoring I just pay for datadog now. It’s expensive but requires almost zero effort to support.

Re: Docker, Django, Traefik, and IntercoolerJS: My go-to stack for building a SaaS

#172
post #153
post #137

Is 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…

The premise of TFA is that "scale is not an issue".

Re: Docker, Django, Traefik, and IntercoolerJS: My go-to stack for building a SaaS

#173

I 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…

Using tools and services is the easiest way to profit off the work of other people (stand on the shoulders of giants), and choosing the right tools for your use case can save you SO MUCH work.

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

#174

Earlier 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…

Docker is better off as a deployment tool, rather than a development environment.

Re: Docker, Django, Traefik, and IntercoolerJS: My go-to stack for building a SaaS

#175

I 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…

OP here, thanks!

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

#176

Earlier 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…

Give Docker a go on a project and you'll see its utility:

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

#177
post #122

IntercoolerJS / 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.

There is a Discord for HTMX and Intercooler (another one-developer-show)

https://htmx.org/discord

Re: Docker, Django, Traefik, and IntercoolerJS: My go-to stack for building a SaaS

#178
post #137

Is 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.

Decoupling the images.

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

#179

I 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…

With docker, I can move or upgrade the host server without worrying about compatibility of my apps. Before using docker, every time I migrate to a new version of os or database (which I do every 3-4 years per host), I would often run into small problems in some old apps that must be fixed, which took time because I had to dig into the app again and re-learn the context before I can patch the small issue. After moving everything to docker, it's no longer a problem. As long as the host can run docker (be it docker compose or kubernetes) my apps would run on it.

Re: Docker, Django, Traefik, and IntercoolerJS: My go-to stack for building a SaaS

#180
post #66

Earlier 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…

I’ve never been able to use rq with redis without problems. For one: restarting the app requires wiping the related redis data because rq will refuse to launch because there’s still entries for the workers, which it apparently doesn’t clean up correctly.
Post reply on HN