Remix.run Logo
zahlman 6 days ago

This just seems like several unnecessary layers of complexity to me.

For making a static site that you're personally deploying, exactly why is Docker required? And if the Docker process will have to bring in an entire Linux image anyway, why is obtaining Python separately better than using a Python provided by the image? And given that we've created an entire isolated container with an explicitly installed Python, why is running a Python script via `uv` better than running it via `python`? Why are we also setting up a virtual environment if we have this container already?

Since we're already making a `pyproject.toml` so that uv knows what the dependencies are, we could just as well make a wheel, use e.g. pipx to install it locally (no container required) and run the program's own entry point. (Or use someone else's SSG, permanently installed the same way. Which is what I'm doing.)

nkantar 5 days ago | parent | next [-]

Author—though not OP—here. I’ll try to broadly address the questions, which are all fair.

Broadly speaking, I explicitly wanted to stay in the Coolify world. Coolify is a self-hostable PaaS platform—though I use the Cloud service, as I mentioned—and I really like the abstraction it provides. I haven’t had to SSH into my server for anything since I set it up—I just add repos through the web UI and things deploy and show up in my browser.

Yes, static sites certainly could—and arguably even should—be done way simpler than this. But I have other things I want to deploy on the same infrastructure, things that aren’t static sites, and for which containers make a whole lot more sense. Simplicity can be “each thing is simple in isolation”, but it can also be “all things are consistent with each other”, and in this case I chose the latter.

If this standardization on this kind of abstraction weren’t a priority, this would indeed be a pretty inefficient way of doing this. In fact, I arrived at my current setup by doing what you suggested—setting up a server without containers, building sites directly on it, and serving them from a single reverse proxy instance—and the amount of automation I found myself writing was a bit tedious. The final nail in the coffin for that approach was realizing I’d have to solve web apps with multiple processes in some other way regardless.

divbzero 5 days ago | parent | next [-]

> I explicitly wanted to stay in the Coolify world.

I too was skeptical of the motivation until reading this. Given that Coolify requirement, your solution (build static files in one container, deploy with Caddy in another) seems quite sensible.

john-tells-all 4 days ago | parent | prev [-]

(Hi, Nik!)

So what you're saying is that "Static sites with Python, uv, Caddy, and Docker" wasn't the overall goal. You want to stay in Coolify world, where most things are a container image.

It just so happens that a container can be just a statically-served site, and this is a pattern to do it.

By treating everything as a container, you get a lot of simplicity and flexibility.

Docker etc is overkill for the static case, but useful for the general case.

raffraffraff 4 days ago | parent | prev | next [-]

I created a static site generator for my wife's business using go + js + git. She has no tech skills whatsoever, but had very specific ideas about how the website should work.

Once the basic functionality was worked out in js (with a simple JSON schema and Lourm Ipsum text), I created a Samba share on the network, mapped it to her computer.

Her first post was an edit of the Lorum Ipsum markdown and some new images, and from then on she had a pattern to follow: add a directory with a markdown file and assets.

The NAS runs a Go program that generates a JSON file for the static site js, starts a http server for testing. She can access the http server over the network to preview the static site. If it's ok, she can trigger a git commit and push (with a click). She didn't have to learn anything (like Hugo or jinja), because markdown is kinda obvious. She has exactly the website she wants.

Of course, I had more work to do initially, coming up with the static site, the JSON schema and the go generator, but it was over a week of evenings. She's been happily adding to it regularly without my interaction.

And this, my friends, is why I (a mere DevOps / Cloud guy) "vibe code" with Claude.

hk1337 4 days ago | parent | next [-]

That’s really cool for you but for your wife, I would find something simpler. What happens if you’re not around and that all breaks and she cannot get content published?

At the very least, assuming you want to keep it somewhat techy, I would setup a repository with a Hugo config, theme pulled in as a module, with ci to auto deploy it. Make it so the repository is just her markdown content, some css/js overrides if needed, and a hugo.toml.

Or just setup a Wordpress or similar site for her

skylurk 4 days ago | parent | prev [-]

This sounds exactly like how I use Hugo. It's sweet that you made your own thing! But if you ever end up wanting to use a prebuilt Hugo theme, I bet it would be super easy to switch over.

pfranz 4 days ago | parent | prev | next [-]

> why is obtaining Python separately better than using a Python provided by the image?

I mostly work in a different domain than webdev, but feel strongly about trying to decouple base technologies of your OS and your application as much as possible.

It's one thing if you are using a Linux image and choose to grab their Python package and other if their boot system is built around the specific version of Python that ships with the OS. The goal being if you later need to update Python or the OS they're not tethered together.

wiether 4 days ago | parent [-]

I understand both your point of views and I guess I see the confusion.

With Docker, usually you try to pick the base image that is the most closer to your usecase.

For instance, if you intend to run a Python 3.10 script in your final image, you'll start from a python:3.10 base image, since it contains your most important requirement.

But in the article, the author is starting from an "uv" image, and then in the creation process (described in their Dockerfile), they'll install their required version of python.

Which, for many people writing Dockerfiles daily (me included), feels weird: if you intend to run python, why not starting from an image including your python version?

Then, if we look at what uv actually is, it can of make sense: it's an app written in Rust (so not a python app) that can be seen as a _docker for python apps_.

And since the author's focus seemed to be about uv, we can see why they started from an uv image.

TZubiri 5 days ago | parent | prev | next [-]

My guess is that when you are self taught and don't know what the hierarchy of technologies looks like, you can learn several advanced technologies without knowing the basic technologies that they are built upon and the challenges the basic tech can't solve.

So you just solve all problems with advanced tools, no matter how simple. You get into tech by learning how to use a chainsaw because it's so powerful and you wanted to cut a tree, now you need to cut some butter for a toast? Chainsaw!

worldsayshi 5 days ago | parent | next [-]

Or maybe you stick with a stack that is too complex for most problems but also works for most of them so that when you solve/find a solution to a certain problem you can reuse that solution in all of your projects.

busyant 5 days ago | parent | prev | next [-]

> it's so powerful and you wanted to cut a tree, now you need to cut some butter for a toast? Chainsaw!

Using a Ferrari to deliver the milk is how I've heard it said.

kelvinjps10 5 days ago | parent | prev [-]

I thought it's the opposite and I have seen it self taught use simpler tools that are not the standard,like just using ftp or rsync instead of complex tools

adithyassekhar 4 days ago | parent [-]

This has been my experience as well. But I suspect it'll change with how AI first most students are nowadays.

TZubiri 5 days ago | parent | prev | next [-]

Looking forward to the follow up:

Static sites with HTML, CSS, Apache and Linux.

Avamander 5 days ago | parent [-]

You can of course use something like Pelican to generate those plain static files. There are quite a few great themes available as well.

rr808 4 days ago | parent | prev | next [-]

At my work we use docker for everything now. Makes no sense. Literally we have a dedicated server for each application. Instead of copying python files to the server in 5 seconds we take 30 minutes to build a docker container, copy to repo, scan it, deploy.

9dev 4 days ago | parent | next [-]

But you’ve gained the ability to do static analyses and quality control, enforce authorisation on who can deploy to the prod server, gained accountability and a history of changes by virtue of having it in the repo, enabled everyone to run the image locally regardless of their local environment…

a_t48 4 days ago | parent | prev [-]

Not saying you're wrong here, but if that 30 minutes doesn't include running tests it sounds like your Dockerfile is setup poorly. For a ci/cd setup it should take like...a minute at most, if you don't have heavy ML dependencies, etc. Maybe less, depending on how well you cache things.

rr808 3 days ago | parent | next [-]

Thanks, yes probably. Our company is great on adding new functionality but has a huge amount of tech debt including infrastructure and SDLC processes that are really slow.

regularfry 4 days ago | parent | prev [-]

It's also unfortunate if it does include running tests.

cyanydeez 5 days ago | parent | prev | next [-]

Simple answer is to package it up with all its system dependencies ans not worry about anything.

5 days ago | parent | prev [-]
[deleted]