Live data from Hacker News

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

simplecto.com

331–340 of 347 posts

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

#331

Earlier quoted context omitted.

Have you looked at django-fsm for managing your state transitions? Overkill for small projects - invaluable for larger ones where state changes can be literally anywhere.

I had not seen that. Is it fair to say it is something similar to a Rules Engine like Drools?

Not really. It just enforces that specific properties (status field) can only be manipulated with methods decorated by an FSM transition. Allows enforcement of what actions are taken during a state transition so that some random view doesn’t change to “in progress” without the necessary actions occurring.

https://pypi.org/project/django-viewflow/ Is from the same developer which is a workflow/rules engine built on top of FSM.

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

#332

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…

I can run disparate environments across multiple language runtimes without having to fight version issues or wrangle multiple VMs. That’s why, for me at least.

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

#333
post #313

Earlier quoted context omitted.

This is wrong. Docker is a VM on Windows at least.

Nobody is talking about Docker on Windows or Mac for production use.

Don't you think Mac are not used in Prod?

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

#334

Earlier quoted context omitted.

If you think Docker helps with Sandboxing, you're mistaken. Docker is a huge security hole. Oh, Crypto miners ....

Explain? I'm aware that giving a host user permission to control Docker is equivalent to root, but that's no worse than wheel/sudo in most cases, and not a "sandbox" failure. So I assume you're thinking of container escape, which I was given to believe is actually hard these days?

What makes you to think it's easier anyway?

Docker use shared resources like Kernel. Linux Kernel is big ugly C mess (Compared to includeOS) and probably one can find a good enough exploit for the kernel then escape the Docker.

That's and VM provides much better security. Well, VM escape exploits exists but they are at least much harder than say a Docker level escape.

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

#335
post #323
post #169

Earlier quoted context omitted.

Why do you need Docker to monitor it? I would think it will only recognize a problem if the process dies. But you need to monitor your db and application for other types of failures anyhow, right? I cannot remember the last time I had a problem with the DB process dying.

That's default behavior. Docker tracks the main process. If it dies, and your database is not the main process, then the entire container will be restarted (depends on configuration). Means your database will be forcefully killed. At some point you might run into data corruption incident. If you make database your main process, then docker will be blind for your application death.

I would make neither the main process.

A dedicated server also does not restart if my DB or my application dies.

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

#336
post #301

Earlier quoted context omitted.

What do you mean by "manage the processes"? Why would you need to touch postgres when updating your application?

Typically the process to update an application is to push up a new image and then tell docker to stop the old one, and load the new one in its place (yes, I know there are 0-downtime ways, but lets keep it simple). If you put both processes in the same container, then you cannot simply upload a new image and restart the container. This is where it gets very complicated, error prone, and not in line with what I unders…

I would not use Docker this way. I would treat the docker container like a server. I would update the application inside the running container.

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

#337
post #288
post #130

Earlier quoted context omitted.

For multi tenant deployments. Each tenant gets its own docker-compose in a directory on prod and voila: 100% same code base (same Docker image) and good separation between tenants

Multi-tenant deployments with Docker make sense _only_ if you trust all of the tenants, since it is trivial to take control of the host if you have write access to Docker socket. You may say that it can be mitigated with some wrapper scripts with limited commands, but then you have to maintain them and we can all agree that homebrew security is very hard to do correctly.

True. We trust all tenants. It's a way of separating tenants beyond database schemas or organization_id columns.

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

#338
post #335
post #323

Earlier quoted context omitted.

That's default behavior. Docker tracks the main process. If it dies, and your database is not the main process, then the entire container will be restarted (depends on configuration). Means your database will be forcefully killed. At some point you might run into data corruption incident. If you make database your main process, then docker will be blind for your application death.

I would make neither the main process. A dedicated server also does not restart if my DB or my application dies.

That's why I mentioned that if you want to put multiple applications inside a single container, you have to put it under supervisord or alternative. So neither would be the main process.

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

#339
post #310

Earlier quoted context omitted.

htmx supports the `hx-preserve` attribute since v1.1: https://htmx.org/attributes/hx-preserve/

Good to know! Didn't see it in the attribute reference list.

sorry about that, i have updated the docs

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

#340

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…

If you're not using docker then you're building in production instead of in CI. Also, that means you're maintaining a deployment instead of building a fresh one every time you deploy. This means leftover files will pile up and that is certainly not tested upstream at any time: tests run on fresh ephemeral deployments in general.
Post reply on HN