Live data from Hacker News

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

simplecto.com

181–190 of 347 posts

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

#182

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. :-)

Did you mean to expose your postgres port to the world?

Adding the port declaration to the docker file exposes it to other containers on the same network/machine, adding it in docker-compose exposes it to the world.

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

#183
post #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…

My solution is to not use 3rd party extensions at all. Only what is in the Debian repos and gets fixed by Debian.

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

#184

Earlier quoted context omitted.

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…

As I wrote at the very top of this thread, i have used Docker in a project that was forced on me, and I still use it in other client projects where I don't have a choice. I don't need to "give it a go" to learn what it's like.

1. First, the infra to automatically deploy again introduces complexity. And waiting for the Docker push to complete and then until the new container is started takes away from my time.

2. Yes, it is a pain.

3. I do what's necessary to fix problems. Sometimes that means looking at production. I use PyCharm not vs code and because I don't find value in Docker for my projects have no incentive to look into how to set up local debugging.

4. "Prune weekly" you say. But it's just another complication I have to deal with when using Docker. What for?

> The value is the simplicity of deployment

I would argue my deployments are simpler than yours. Give me git and ssh and I'm good to go. No need for Docker, pushing to some registry, looking at a dashboard or waiting for the image to be deployed. And my setup is much easier to debug.

But it sounds to me like you are coming from a more enterprise-y environment. There, the things you say probably make sense. In my case, I'm a sole developer. Any unnecessary process or tool slows me down and incurs a risk of bugs due to added complexity.

> Need to host a well-known software?

I don't have this need.

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

#185

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…

Thank you! I would wish that there are more projects having things like ansible modules or similar. You can run it for you local dev on vagrant images and deploy it on the server directly. Less layers. Less differences between environments. No messing with docker bypassing ufw and other system configs.

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

#186

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…

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

If this bother you, take a look at some 3rd party docker management ui such as portainer (vanilla docker) or k9s (kubernetes). These tools will let you navigate and launch shell on your container quickly. Very useful if you have tons of apps running in your node.

> 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 given day where I'm just twisting my thumbs.

In my case, I don't use docker in development phase. I test in local environment and only build the images when it's ready for deployment.

> Having to even spend time learning how to debug Python code inside a locally running docker container.

I never had to do this anymore. I just hook sentry or newrelic and they'll log exception stack traces that I can use to figure out the issue without live-debugging the app.

> Having to deal with disk space issues caused by old docker images on my 500gb hdd.

Yes, disk usage is one of the drawback of using docker. It's especially suck pruning images on busy servers with spinning rust. On ssd, pruning is not as slow though.

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

#187
post #35

Earlier quoted context omitted.

Django drives the choice here. Batteries included, huge community support, and AMAZING documentation. Half the software I write is from stackoverflow. LOL I dont see dockerizing as a problem. Once copied out from my template I never think about it. I do admit that familarity with the underlying Image OS (Debian in this case) makes debugging / fussing about a non-issue.

For local development that debian container is fine but for production you want something small like scratch or alpine. The fewer binaries in the container, the better and more secure. This is one of the benefits of golang. You compile it into a binary and copy just the binary into your scratch container. Maybe it is 20MB in size.

It depends what you're optimizing for.

Alpine is subtly different for python builds:

* It uses musl-c. It's not glibc, it's different. Not necessarily better or worse.

* You can't use manylinux1 wheels with alpine, so if you've got python/c extensions, you're going to be building them instead of installing upstream binaries. So cue the need for a dev toolchain, and a much longer install time.

And once you have all that, you're running a different version in dev/prod, which is one of those things that docker is supposed to be good at fixing.

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

#188
post #132

Earlier quoted context omitted.

PyEnv + Poetry — Couldn't be easier IMO.

Except plain old virtual environments instead of poetry. And pyenv only if really really necessary, and not in prod.

After knowing Poetry, I can honestly say I don't miss requirements.txts at all

But true, you weren't supposed to need it. But managing projects with interlocked dependencies get old fast.

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

#189

Earlier quoted context omitted.

I also dislike all those tools you mention. So often, I feel like devs use a tool "because it's cool" but fail to appreciate the complexity it adds - not just for themselves but for others. The frustration expressed by your comment is a perfect example of this. In my ideal world, everybody would just use what comes with vanilla Python: python3 -m venv venv source venv/bin/activate (Or `call` on Win) pip install -Ur r…

and pipx for managing python "apps" like youtube-dl, ipython, meson, ... https://pipxproject.github.io/pipx/

I’ve been doing a manual version of this for years, creating a shell shim wrapping a venv for cli tools. This is much neater, thanks!

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

#190

Can anyone answer why python is a choice anymore instead of i.e. golang for saas applications like this? I previously worked heavily with ruby and I cannot imagine building beyond >1000 LoC in interpreted, dynamically typed languages. Aside from developer familiarity which trumps all other points. It's also significantly easier to dockerize a generated binary from golang or rust, etc. Some of my worst docker headache…

Honestly, django is the only thing that keeps me on python for backend service. With microservice being all the rage these days, I don't see any battery-included framework that can rival django emerging in golang, rust, swift and other new and hip languages.
Post reply on HN