Skip to main content
Martin Hähnel

WhileDo - Cleaning Up Cont'd

Last I cleaned up the blog repo, I was working on my package.json scripts and docker. I didn't do anything on the apps themselves yet, just the root repo parts. There is still stuff to do on the root of the repo, too, so let's watch what we're dealing with:

Screenshot of a monorepo in VS Code showing the folder structure. The root contains directories such as .github, .husky, .vscode, apps (with blog and blog-api), docker, docs, node_modules and scripts. Various configuration files like docker-compose.yml, Dockerfiles, Caddyfile, package.json, pnpm files, and README.md are also visible.

The README is not ready yet, but I want to simplify the amount of files first and that means looking through them one-by-one. Let's start with the two Caddyfiles. Both claim to be "Caddyfile for local blog development". Let's see which one is used in the docker-compose file... wait. There are two of those as well! Ah, my trusty README tells me what's going with those:

In the local dev env we use a docker-compose file (docker-compose.yml) to run things. On prod, we use Coolify. To simulate prod (i.e. to test the build process locally), we have another docker-compose file called docker-compose.single.yml.

Okay. Great. So both docker-compose files are needed. Alright back to the Caddyfiles:

So I delete that file and rename from Caddyfile.dev to Caddyfile and move that into the docker subdir. That leaves us with what I believe is the minum amount of files that need to be in the root:

So still 13 files. I think I can live with this for now. Actually I can't. Let's move at least the docker stuff out of the way. For the Dockerfile.single, I move it inside the docker subdir and change the "Dockerfile Location" of my deployment to that. I also adjust the path in the docker-compose.single.yml, too.

I'll leave the main docker-compose file where it is, but move the .single-Version to docker and adjust the path in the pnpm script. Alright. Time to update README, and other references (like comments in .dockerignore). After this, I'm left with 11 files.

I write this in my CHANGELOG:

### Changed

- cleaned up docker related files: Moved them to the docker subdir, if possible (excluding the docker-compose.yml for local dev itself)
- renamed Caddyfile.dev to Caddyfile (after the unused one was deleted).
- anything pertaining to the prod/single image deployment now has `.single` in the name. Everything else should hopefully be unambigous (i.e. either used in all environments, or its usage should be clear from context: "There is no docker-compose used in the prod deployment, therefore docker-compose.yml is meant for the dev env." We'll see if that actually works, or if the `.dev` naming actually works better...)

### Removed

- removed an unused Caddyfile

That's it for now! Take care.