Repository: cubernetes/ft-transcendence
Pull request #68: Refactor/Makefile
Author: login: cubernetes
Created: 2025-03-30T15:51:31Z | Merged: 2025-03-30T16:33:16Z

# Key Features
- Creates semantically more sound clean targets
- Puts them in a different Makefile (to be included)
- Also extract auxiliary stuff into another Makefile

# Ancillary Changes
- Move env.json into repo root
- Rename vault volume
- Remove check-env dependency for prod target
- Only run `make down` in github actions workflow


Diff:
diff --git a/.github/workflows/deploy-production.yaml b/.github/workflows/deploy-production.yaml
index bd5c5e15..c0251486 100644
--- a/.github/workflows/deploy-production.yaml
+++ b/.github/workflows/deploy-production.yaml
@@ -52,7 +52,7 @@ jobs:
                      git stash --include-untracked || : ; : 'git stash may fail (if it does, prolly docker related' ; \
                      git checkout --force ${{ secrets.PRODUCTION_BRANCH }} ;                                          \
                      git pull --rebase --force ${{ secrets.REMOTE_NAME }} ${{ secrets.PRODUCTION_BRANCH }} ;          \
-                     make clean ;                                                                                     \
+                     make down ;                                                                                      \
                      make prod"
 
             - name: Cleanup
diff --git a/Makefile b/Makefile
index 5e38fddc..902827f5 100644
--- a/Makefile
+++ b/Makefile
@@ -1,72 +1,31 @@
+# Change to docker-compose if you need
 DC := docker compose
+# Change to podman if you need
 D := docker
-
-VAULT_TOKEN_EXCHANGE_FILES := ./.secrets/backend_vault_token
-
+# Enables you do run `make` alone
 .DEFAULT_GOAL := dev
 
+# When registering a new service that needs vault, a file needs
+# to be added here for the exchange of the vault token. The
+# naming scheme is strict, it must be
+# ./.secrets/${service}_vault_token
+# where ${service} is the same as the JSON root subkeys in ./env.json
+VAULT_TOKEN_EXCHANGE_FILES := \
+	./.secrets/backend_vault_token
+
+# Must be in standard dotenv format
 -include .env
 include config.env
-.EXPORT_ALL_VARIABLES:
-
-.PHONY: check-env
-check-env:
-	@test -e .env || {        \
-		printf '\033[33m%s \033[42;30m%s\033[m\033[33m\n%s\n%s\n%s\n%s\n%s\033[m'          \
-			"Warning: .env doesn't exist, trying to run" "cp .env.example .env"            \
-			"Warning: Since the file didn't exist, no environment variables from"          \
-			"Warning: that file will be included/exposed inside this Makefile."            \
-			"Warning: It is STRONGLY recommended you abort this step, manually"            \
-			"Warning: copy the file, adjust its contents, and then run make again."        \
-			"Warning: Press ENTER to continue (run the cp command) or CTRL-C to abort..."; \
-		read c;               \
-		cp .env.example .env; \
-	}
-
-define dev-env
-	[ -n "$(DEV_HTTP_PORT)" ]  &&  \
-	[ -n "$(DEV_HTTPS_PORT)" ] &&  \
-	[ -n "$(DEV_DOMAINS)" ]    &&  \
-	HTTP_PORT="$(DEV_HTTP_PORT)"   \
-	HTTPS_PORT="$(DEV_HTTPS_PORT)" \
-	DOMAINS="$(DEV_DOMAINS)"       \
-	NODE_ENV="development"         \
-	WATCH="1"                      \
-	CADDY_EXTRA_GLOBAL_DIRECTIVES="$$(printf %b "$(DEV_CADDY_EXTRA_GLOBAL_DIRECTIVES)")" \
-	CADDY_EXTRA_SITE_DIRECTIVES="$$(printf %b "$(DEV_CADDY_EXTRA_SITE_DIRECTIVES)")"     \
-	$(DC) $(1)
-endef
-
-define prod-env
-	[ -n "$(PROD_HTTP_PORT)" ]  &&  \
-	[ -n "$(PROD_HTTPS_PORT)" ] &&  \
-	[ -n "$(PROD_DOMAINS)" ]    &&  \
-	HTTP_PORT="$(PROD_HTTP_PORT)"   \
-	HTTPS_PORT="$(PROD_HTTPS_PORT)" \
-	DOMAINS="$(PROD_DOMAINS)"       \
-	NODE_ENV="production"           \
-	WATCH="0"                       \
-	CADDY_EXTRA_GLOBAL_DIRECTIVES="$$(printf %b "$(PROD_CADDY_EXTRA_GLOBAL_DIRECTIVES)")" \
-	CADDY_EXTRA_SITE_DIRECTIVES="$$(printf %b "$(PROD_CADDY_EXTRA_SITE_DIRECTIVES)")"     \
-	$(DC) $(1)
-endef
-
-define wait-progress
-	printf '\033[33m%s\033[m\n' \
-		"INFO: Starting to watch for filesystem changes in $(1) second(s)"
-	sleep 1
-endef
 
-.PHONY: ensure-secret-files
-ensure-secret-files:
-	@mkdir -p ./.secrets/
-	@$(RM) -r $(VAULT_TOKEN_EXCHANGE_FILES)
-	@touch $(VAULT_TOKEN_EXCHANGE_FILES)
+# Helper Makefile
+include Makefile.clean
+include Makefile.aux
 
-# This target is needed for legacy docker compose versions where there's no `--watch' flag for `docker compose up'.
-# Use the `dev' target instead.
+# This target is needed for legacy docker compose versions where there is no `--watch' flag for `docker compose up'.
+# The `dev' target is preferred.
 .PHONY: dev-old-compose
-dev-old-compose: check-env clean-app-volumes ensure-secret-files
+dev-old-compose: check-env
+	$(MAKE) clean-frontend-volume ensure-secret-files
 	@[ -n "$(ARGS)" ] && { printf '\033[31m%s\033[m\n' "ARGS argument not supported for dev-old-compose target (because of --detach option)"; exit 1; }
 	@$(call dev-env,build)
 	@$(call dev-env,up --remove-orphans --detach)
@@ -79,62 +38,30 @@ dev-old-compose: check-env clean-app-volumes ensure-secret-files
 	@$(call dev-env,watch --no-up)
 
 .PHONY: dev
-dev: check-env clean-app-volumes ensure-secret-files
-	@$(call dev-env,up --remove-orphans --build --watch $(ARGS))
-
+dev: check-env
+	$(MAKE) clean-frontend-volume ensure-secret-files
+	@$(call dev-env,     \
+		up               \
+		--remove-orphans \
+		--build          \
+		--watch          \
+		$(ARGS))
+
+# Don't depend on check-env (endless waiting), rather fail
 .PHONY: prod
-prod: check-env clean-app-volumes ensure-secret-files
-	@$(call prod-env,up --remove-orphans --build --detach)
+prod: clean-frontend-volume ensure-secret-files
+	@$(call prod-env,    \
+		up               \
+		--remove-orphans \
+		--build          \
+		--detach         \
+		$(ARGS))
 
 .PHONY: down
 down:
-	$(DC) down
-
-.PHONY: clean-app-volumes
-clean-app-volumes: down
-	$(D) volume rm --force ft-transcendence_frontend
-	$(D) volume rm --force ft-transcendence_vault-logs
-	$(D) volume rm --force ft-transcendence_elasticsearch-data
-
-.PHONY: clean
-clean:
-	$(MAKE) clean-app-volumes
-	$(D) system prune --force
-
-.PHONY: cleandb
-cleandb: clean
-	$(D) volume rm --force ft-transcendence_drizzle
-
-.PHONY: cleanvault
-cleanvault: clean
-	$(D) volume rm --force ft-transcendence_vault
-	$(D) volume rm --force ft-transcendence_vault-secrets
-
-.PHONY: fclean
-fclean: clean cleandb cleanvault
-	$(RM) -r ./backend/node_modules/ backend/dist/ backend/.tap/
-	$(RM) -r ./frontend/node_modules/ frontend/dist/
-	$(RM) -r ./cli/node_modules/
-	$(RM) -r $(VAULT_TOKEN_EXCHANGE_FILES)
-
-.PHONY: deepclean
-deepclean: fclean
-	@printf '\033[33mWarning: %b\033[m'                                         \
-		"You're about the delete ALL:\n"                                        \
-		" - containers (running or not)\n"                                      \
-		" - docker images (dangling and unused)\n"                              \
-		" - volumes (named or unnamed)\n"                                       \
-		" - networks\n"                                                         \
-		" - build caches\n"                                                     \
-		"This is VERY, VERY LIKELY not needed. Images, containers, networks\n"  \
-		"volumes, and build caches NOT related to this project WILL BE LOST.\n" \
-		"Please make sure you fully understand what you're about to do\n"       \
-		"and consider 'make clean' instead.\n"                                  \
-		"Press ENTER to continue anyway..." && read c
-	$(MAKE) clean
-	$(D) ps --quiet --all | xargs -r $(D) rm -f # non-graceful shutdown because wdgaf
-	$(D) system prune --all --volumes --force        # dangerous
+	$(DC) down --remove-orphans
 
+# `clean' will remove all volumes and some files (e.g. node_modules), see Makefile.clean
 .PHONY: re
 re: clean
 	$(MAKE)
diff --git a/Makefile.aux b/Makefile.aux
new file mode 100644
index 00000000..7bbec818
--- /dev/null
+++ b/Makefile.aux
@@ -0,0 +1,55 @@
+# Exports the stuff loaded from config.env and .env so it's available to docker compose
+.EXPORT_ALL_VARIABLES:
+
+.PHONY: check-env
+check-env:
+	@test -e .env || {        \
+		printf '\033[33m%s \033[42;30m%s\033[m\033[33m\n%s\n%s\n%s\n%s\n%s\033[m'          \
+			"Warning: .env doesn't exist, trying to run" "cp .env.example .env"            \
+			"Warning: Since the file didn't exist, no environment variables from"          \
+			"Warning: that file will be included/exposed inside this Makefile."            \
+			"Warning: It is STRONGLY recommended you abort this step, manually"            \
+			"Warning: copy the file, adjust its contents, and then run make again."        \
+			"Warning: Press ENTER to continue (run the cp command) or CTRL-C to abort..."; \
+		read c;               \
+		cp .env.example .env; \
+	}
+
+define dev-env
+	[ -n "$(DEV_HTTP_PORT)" ]  &&  \
+	[ -n "$(DEV_HTTPS_PORT)" ] &&  \
+	[ -n "$(DEV_DOMAINS)" ]    &&  \
+	HTTP_PORT="$(DEV_HTTP_PORT)"   \
+	HTTPS_PORT="$(DEV_HTTPS_PORT)" \
+	DOMAINS="$(DEV_DOMAINS)"       \
+	NODE_ENV="development"         \
+	WATCH="1"                      \
+	CADDY_EXTRA_GLOBAL_DIRECTIVES="$$(printf %b "$(DEV_CADDY_EXTRA_GLOBAL_DIRECTIVES)")" \
+	CADDY_EXTRA_SITE_DIRECTIVES="$$(printf %b "$(DEV_CADDY_EXTRA_SITE_DIRECTIVES)")"     \
+	$(DC) $(1)
+endef
+
+define prod-env
+	[ -n "$(PROD_HTTP_PORT)" ]  &&  \
+	[ -n "$(PROD_HTTPS_PORT)" ] &&  \
+	[ -n "$(PROD_DOMAINS)" ]    &&  \
+	HTTP_PORT="$(PROD_HTTP_PORT)"   \
+	HTTPS_PORT="$(PROD_HTTPS_PORT)" \
+	DOMAINS="$(PROD_DOMAINS)"       \
+	NODE_ENV="production"           \
+	WATCH="0"                       \
+	CADDY_EXTRA_GLOBAL_DIRECTIVES="$$(printf %b "$(PROD_CADDY_EXTRA_GLOBAL_DIRECTIVES)")" \
+	CADDY_EXTRA_SITE_DIRECTIVES="$$(printf %b "$(PROD_CADDY_EXTRA_SITE_DIRECTIVES)")"     \
+	$(DC) $(1)
+endef
+
+define wait-progress
+	printf '\033[33m%s\033[m\n' \
+		"INFO: Starting to watch for filesystem changes in $(1) second(s)"
+	sleep 1
+endef
+
+.PHONY: ensure-secret-files
+ensure-secret-files: clean-secrets-folder
+	@mkdir -p ./.secrets/
+	@touch $(VAULT_TOKEN_EXCHANGE_FILES)
diff --git a/Makefile.clean b/Makefile.clean
new file mode 100644
index 00000000..52a05759
--- /dev/null
+++ b/Makefile.clean
@@ -0,0 +1,93 @@
+### clean specific volumes
+.PHONY: clean-frontend-volume
+clean-frontend-volume: down
+	$(D) volume rm --force ft-transcendence_frontend
+
+.PHONY: clean-vault
+clean-vault: down
+	$(D) volume rm --force ft-transcendence_vault
+	$(D) volume rm --force ft-transcendence_vault-logs
+	$(D) volume rm --force ft-transcendence_vault-secrets
+
+.PHONY: clean-db
+clean-db: down
+	$(D) volume rm --force ft-transcendence_drizzle
+
+.PHONY: clean-elk
+clean-elk: down
+	$(D) volume rm --force ft-transcendence_elasticsearch-data
+
+.PHONY: clean-caddy
+clean-caddy: down
+	$(D) volume rm --force ft-transcendence_elasticsearch-caddy-data
+
+### clean all volumes, including caddy-db (user data) and caddy-data (TLS certificates)
+### not suitable for production, obviously
+.PHONY: vclean
+vclean: down
+	$(MAKE) clean-frontend-volume clean-vault clean-db clean-elk clean-caddy
+	$(D) system prune --force
+
+# Clean various files/folders
+.PHONY: clean-secrets-folder
+clean-secrets-folder:
+	$(RM) -r ./.secrets/
+
+.PHONY: clean-backend-files
+clean-backend-files:
+	$(RM) -r ./backend/node_modules/ ./backend/dist/ ./backend/.tap/
+
+.PHONY: clean-frontend-files
+clean-frontend-files:
+	$(RM) -r ./frontend/node_modules/ ./frontend/dist/
+
+.PHONY: clean-cli-files
+clean-cli-files:
+	$(RM) -r ./cli/node_modules/
+
+# Removes all project generated files/folders, DOES NOT REMOVE VOLUMES
+.PHONY: fclean
+fclean: clean-secrets-folder clean-backend-files clean-frontend-files clean-cli-files
+
+# Remove all files/folders/volumes of the project
+.PHONY: clean
+clean: vclean fclean
+
+# Remove (almost) EVERYTHING docker related
+.PHONY: dockerclean
+dockerclean: down
+	@printf '\033[33mWarning: %b\033[m'                                         \
+		"You're about the delete ALL:\n"                                        \
+		" - containers (running or not)\n"                                      \
+		" - docker images (dangling and unused)\n"                              \
+		" - volumes (named or unnamed)\n"                                       \
+		" - networks\n"                                                         \
+		" - build caches\n"                                                     \
+		"This is VERY, VERY LIKELY not needed. Images, containers, networks\n"  \
+		"volumes, and build caches NOT related to this project WILL BE LOST.\n" \
+		"Please make sure you fully understand what you're about to do\n"       \
+		"and consider 'make clean' instead.\n"                                  \
+		"Press ENTER to continue anyway (or CTRL-C to abort)..." && read c
+	$(D) ps --quiet --all | xargs -r $(D) rm -f # non-graceful shutdown because wdgaf
+	$(D) system prune --all --volumes --force   # dangerous
+
+# Remove everything docker related and everything in
+.PHONY: deepclean
+deepclean:
+	@# VERY dangerous command
+	@printf '\033[33mWarning: %b\033[m'                                                \
+		"You're about to run a DANGEROUS COMMAND:\n"                                   \
+		" - \033[41;30m git clean -dffxi \033[m\n"                                     \
+		"It will permanently delete EVERYTHING that is not tracked (interactively)!\n" \
+		"INCLUDING .gitignored FILES. It is pretty much equivalent to cloning the\n"   \
+ 		"repo fresh. You might lose ALL files you haven't commited yet, so either\n"   \
+		"lose them or save them using (for example) the following commands:\n"         \
+		" - \033[32mgit stash --include-untracked\033[m\n"                             \
+		" - \033[32mgit add --intend-to-add --all\033[m\n"                             \
+		" - \033[32mgit add --all\033[m\n"                                             \
+		"Or run the dangerous command anyway, because it will be interactive,\n"       \
+		"you can decide which files to remove and which to keep.\n"                    \
+		"Press ENTER to go to the selection (or CTLR-C to abort)..." && read c
+	git clean -dffxi
+	$(MAKE) dockerclean
+	$(MAKE) clean
diff --git a/compose.yaml b/compose.yaml
index 3e952278..4095ab22 100644
--- a/compose.yaml
+++ b/compose.yaml
@@ -180,9 +180,10 @@ services:
         cap_add:
             - IPC_LOCK
         volumes:
-            - "vault:/vault/file/"
+            - "vault-storage:/vault/file/"
             - "vault-secret:/vault/secret/"
             - "vault-logs:/vault/logs/"
+            - "./env.json:/vault/config/env.json:ro"
             - "./.secrets/backend_vault_token:/run/secrets/backend_vault_token"
         environment:
             <<: *env-watch
@@ -204,15 +205,12 @@ services:
                 - path: "./vault/config.hcl"
                   action: sync+restart
                   target: "/vault/config/config.hcl"
-                - path: "./vault/env.json"
-                  action: sync+restart
-                  target: "/vault/config/env.json"
                 - path: "./vault/policies/"
                   action: sync+restart
                   target: "/vault/policies/"
 
 volumes:
-    vault:
+    vault-storage:
     vault-secret:
     vault-logs:
     caddy-data:
diff --git a/vault/env.json b/env.json
similarity index 100%
rename from vault/env.json
rename to env.json
diff --git a/vault/Dockerfile b/vault/Dockerfile
index ec9fc2ca..82a3b3f8 100644
--- a/vault/Dockerfile
+++ b/vault/Dockerfile
@@ -6,7 +6,6 @@ COPY ./entrypoint.sh /entrypoint.sh
 COPY ./replace_json_templates.py /replace_json_templates.py
 COPY ./healthcheck.sh /healthcheck.sh
 COPY ./config.hcl /vault/config/config.hcl
-COPY ./env.json /vault/config/env.json
 COPY ./policies/ /vault/policies/
 
 HEALTHCHECK --interval=10s --timeout=2s --start-period=8s --start-interval=1s --retries=3 CMD ["/healthcheck.sh"]
diff --git a/vault/README.md b/vault/README.md
index 93d97b54..f7d0649c 100644
--- a/vault/README.md
+++ b/vault/README.md
@@ -13,14 +13,14 @@ the file to prevent unwanted access from the host system.
 
 ## How Vault initially starts up
 
-When Vault is started for the first time, the `vault` volume mounted at `/vault/file`
+When Vault is started for the first time, the `vault-storage` volume mounted at `/vault/file`
 will be empty. The entrypoint recognizes that and starts the initialization process,
 where it will start (`vault server`) and initialize (`vault operator init`) Vault.
 Then it will extract the **unseal keys** and the **root token** from the stdout.
 It uses the unseal keys to unseal Vault and then the root token to create
 the policies and tokens for all the services. After that, if the environment
 variables `SAVE_UNSEAL_KEYS` or `SAVE_ROOT_TOKEN` are `1`, it will save the
-respective secret in another volume called `vault_secret` at `/vault/secret/`.
+respective secret in another volume called `vault-secret` at `/vault/secret/`.
 This is the default, but for security they should be `0` and you should look
 at the service logs and make note of those secrets. However, as of now, there
 is no way to provide those secrets to Vault at startup. One possible way would
@@ -104,7 +104,7 @@ Let's say your service is called `foo`, then the steps would be the following:
     +     foo:
     +         networks:
     +             ft-transcendence-net:
-    +                 ipv4_address: &foo_ip 10.42.42.3
+    +                 ipv4_address: &foo-ip 10.42.42.3
     +         volumes:
     +             - "./.secrets/foo_vault_token:/run/secrets/foo_vault_token"
     +         depends_on:
@@ -122,22 +122,23 @@ Let's say your service is called `foo`, then the steps would be the following:
               restart: unless-stopped
               networks:
                   ft-transcendence-net
-                      ipv4_address: &vault_ip 10.42.42.42
+                      ipv4_address: &vault-ip 10.42.42.42
               extra_hosts:
-                  backend: *backend_ip
-                  caddy: *caddy_ip
-    +             foo: *foo_ip
+                  backend: *backend-ip
+                  caddy: *caddy-ip
+    +             foo: *foo-ip
               cap_add:
                   - IPC_LOCK
               volumes:
-                  - "vault:/vault/file/"
-                  - "vault_secret:/vault/secret/"
+                  - "vault-storage:/vault/file/"
+                  - "vault-secret:/vault/secret/"
                   - "./.secrets/backend_vault_token:/run/secrets/backend_vault_token"
     +             - "./.secrets/foo_vault_token:/run/secrets/foo_vault_token"
               environment:
-                  LOGLEVEL: debug
-                  SAVE_UNSEAL_KEYS: 1
-                  SAVE_ROOT_TOKEN: 1
+                  <<: *env-watch
+                  LOGLEVEL: "debug"
+                  SAVE_UNSEAL_KEYS: "1"
+                  SAVE_ROOT_TOKEN: "1"
               tty: true
     ```
 


Reviews:
user: login: copilot-pull-request-reviewer[bot]
body: ## Pull Request Overview

This PR refactors the Makefile structure and related configurations to improve semantic clarity and streamline deployment. Key changes include:
- Renaming and remapping volume mounts in compose.yaml (e.g., using "vault-storage" instead of "vault").
- Moving env.json to the repository root and mounting it as a read-only file.
- Updating the deployment workflow by replacing "make clean" with "make down" to adjust cleanup procedures.

### Reviewed Changes

Copilot reviewed 3 out of 7 changed files in this pull request and generated 1 comment.

| File                                           | Description                                                             |
| ---------------------------------------------- | ----------------------------------------------------------------------- |
| compose.yaml                                   | Updated volume names and added a read-only mount for env.json           |
| .github/workflows/deploy-production.yaml       | Changed cleanup command from "make clean" to "make down"                  |

<details>
<summary>Files not reviewed (4)</summary>

* **Makefile**: Language not supported
* **Makefile.aux**: Language not supported
* **Makefile.clean**: Language not supported
* **vault/Dockerfile**: Language not supported
</details>

<details>
<summary>Comments suppressed due to low confidence (1)</summary>

**compose.yaml:183**
* Renaming the vault volume to 'vault-storage' requires ensuring that all service references and related documentation are updated to reflect this change.
```
            - "vault-storage:/vault/file/"
```
</details>


state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-30T15:51:56Z
user: login: darrenkuro
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-03-30T15:55:10Z
user: login: darrenkuro
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-03-30T15:58:15Z
user: login: cubernetes
state: COMMENTED
author_association: OWNER
submitted_at: 2025-03-30T16:00:09Z
user: login: cubernetes
state: COMMENTED
author_association: OWNER
submitted_at: 2025-03-30T16:01:19Z
user: login: cubernetes
state: COMMENTED
author_association: OWNER
submitted_at: 2025-03-30T16:01:31Z
user: login: cubernetes
state: COMMENTED
author_association: OWNER
submitted_at: 2025-03-30T16:04:55Z
user: login: darrenkuro
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-03-30T16:08:19Z
user: login: cubernetes
state: COMMENTED
author_association: OWNER
submitted_at: 2025-03-30T16:13:58Z
user: login: darrenkuro
state: APPROVED
author_association: COLLABORATOR
submitted_at: 2025-03-30T16:31:15Z

Review comments:
diff_hunk: @@ -52,7 +52,7 @@ jobs:
                      git stash --include-untracked || : ; : 'git stash may fail (if it does, prolly docker related' ; \
                      git checkout --force ${{ secrets.PRODUCTION_BRANCH }} ;                                          \
                      git pull --rebase --force ${{ secrets.REMOTE_NAME }} ${{ secrets.PRODUCTION_BRANCH }} ;          \
path: .github/workflows/deploy-production.yaml
user: login: Copilot
body: Changing from 'make clean' to 'make down' alters the cleanup procedure. Verify that 'make down' covers all necessary cleanup steps previously handled by 'make clean' to maintain deployment reliability.
```suggestion
                     git pull --rebase --force ${{ secrets.REMOTE_NAME }} ${{ secrets.PRODUCTION_BRANCH }} ;          \
                     make clean ;                                                                                     \
```
created_at: 2025-03-30T15:51:55Z
author_association: CONTRIBUTOR
diff_hunk: @@ -1,72 +1,31 @@
+# Change to docker-compose if you need
 DC := docker compose
+# Change to podman if you need
 D := docker
-
-VAULT_TOKEN_EXCHANGE_FILES := ./.secrets/backend_vault_token
-
+# Enables you do run `make` alone
 .DEFAULT_GOAL := dev
 
+# When registering a new service that needs vault, a file needs
+# to be added here for the exchange of the vault token. The
+# naming scheme is strict, it must be
+# ./.secrets/${service}_vault_token
+# where ${service} is the same as the JSON root subkeys in ./env.json
+VAULT_TOKEN_EXCHANGE_FILES := \
+	./.secrets/backend_vault_token
+
+# Must be in standard dotenv format
 -include .env
 include config.env
-.EXPORT_ALL_VARIABLES:
-
-.PHONY: check-env
-check-env:
-	@test -e .env || {        \
-		printf '\033[33m%s \033[42;30m%s\033[m\033[33m\n%s\n%s\n%s\n%s\n%s\033[m'          \
-			"Warning: .env doesn't exist, trying to run" "cp .env.example .env"            \
-			"Warning: Since the file didn't exist, no environment variables from"          \
-			"Warning: that file will be included/exposed inside this Makefile."            \
-			"Warning: It is STRONGLY recommended you abort this step, manually"            \
-			"Warning: copy the file, adjust its contents, and then run make again."        \
-			"Warning: Press ENTER to continue (run the cp command) or CTRL-C to abort..."; \
-		read c;               \
-		cp .env.example .env; \
-	}
-
-define dev-env
-	[ -n "$(DEV_HTTP_PORT)" ]  &&  \
-	[ -n "$(DEV_HTTPS_PORT)" ] &&  \
-	[ -n "$(DEV_DOMAINS)" ]    &&  \
-	HTTP_PORT="$(DEV_HTTP_PORT)"   \
-	HTTPS_PORT="$(DEV_HTTPS_PORT)" \
-	DOMAINS="$(DEV_DOMAINS)"       \
-	NODE_ENV="development"         \
-	WATCH="1"                      \
-	CADDY_EXTRA_GLOBAL_DIRECTIVES="$$(printf %b "$(DEV_CADDY_EXTRA_GLOBAL_DIRECTIVES)")" \
-	CADDY_EXTRA_SITE_DIRECTIVES="$$(printf %b "$(DEV_CADDY_EXTRA_SITE_DIRECTIVES)")"     \
-	$(DC) $(1)
-endef
-
-define prod-env
-	[ -n "$(PROD_HTTP_PORT)" ]  &&  \
-	[ -n "$(PROD_HTTPS_PORT)" ] &&  \
-	[ -n "$(PROD_DOMAINS)" ]    &&  \
-	HTTP_PORT="$(PROD_HTTP_PORT)"   \
-	HTTPS_PORT="$(PROD_HTTPS_PORT)" \
-	DOMAINS="$(PROD_DOMAINS)"       \
-	NODE_ENV="production"           \
-	WATCH="0"                       \
-	CADDY_EXTRA_GLOBAL_DIRECTIVES="$$(printf %b "$(PROD_CADDY_EXTRA_GLOBAL_DIRECTIVES)")" \
-	CADDY_EXTRA_SITE_DIRECTIVES="$$(printf %b "$(PROD_CADDY_EXTRA_SITE_DIRECTIVES)")"     \
-	$(DC) $(1)
-endef
-
-define wait-progress
-	printf '\033[33m%s\033[m\n' \
-		"INFO: Starting to watch for filesystem changes in $(1) second(s)"
-	sleep 1
-endef
 
-.PHONY: ensure-secret-files
-ensure-secret-files:
-	@mkdir -p ./.secrets/
-	@$(RM) -r $(VAULT_TOKEN_EXCHANGE_FILES)
-	@touch $(VAULT_TOKEN_EXCHANGE_FILES)
+# Helper Makefile
+include Makefile.clean
+include Makefile.aux
 
-# This target is needed for legacy docker compose versions where there's no `--watch' flag for `docker compose up'.
-# Use the `dev' target instead.
+# This target is needed for legacy docker compose versions where there is no `--watch' flag for `docker compose up'.
path: Makefile
user: login: darrenkuro
body: Mismatched quotes? I'm pretty sure there are ticks paired with single quotes?
created_at: 2025-03-30T15:55:10Z
author_association: COLLABORATOR
diff_hunk: @@ -1,72 +1,31 @@
+# Change to docker-compose if you need
 DC := docker compose
+# Change to podman if you need
 D := docker
-
-VAULT_TOKEN_EXCHANGE_FILES := ./.secrets/backend_vault_token
-
+# Enables you do run `make` alone
 .DEFAULT_GOAL := dev
 
+# When registering a new service that needs vault, a file needs
+# to be added here for the exchange of the vault token. The
+# naming scheme is strict, it must be
+# ./.secrets/${service}_vault_token
+# where ${service} is the same as the JSON root subkeys in ./env.json
+VAULT_TOKEN_EXCHANGE_FILES := \
+	./.secrets/backend_vault_token
+
+# Must be in standard dotenv format
 -include .env
 include config.env
-.EXPORT_ALL_VARIABLES:
-
-.PHONY: check-env
-check-env:
-	@test -e .env || {        \
-		printf '\033[33m%s \033[42;30m%s\033[m\033[33m\n%s\n%s\n%s\n%s\n%s\033[m'          \
-			"Warning: .env doesn't exist, trying to run" "cp .env.example .env"            \
-			"Warning: Since the file didn't exist, no environment variables from"          \
-			"Warning: that file will be included/exposed inside this Makefile."            \
-			"Warning: It is STRONGLY recommended you abort this step, manually"            \
-			"Warning: copy the file, adjust its contents, and then run make again."        \
-			"Warning: Press ENTER to continue (run the cp command) or CTRL-C to abort..."; \
-		read c;               \
-		cp .env.example .env; \
-	}
-
-define dev-env
-	[ -n "$(DEV_HTTP_PORT)" ]  &&  \
-	[ -n "$(DEV_HTTPS_PORT)" ] &&  \
-	[ -n "$(DEV_DOMAINS)" ]    &&  \
-	HTTP_PORT="$(DEV_HTTP_PORT)"   \
-	HTTPS_PORT="$(DEV_HTTPS_PORT)" \
-	DOMAINS="$(DEV_DOMAINS)"       \
-	NODE_ENV="development"         \
-	WATCH="1"                      \
-	CADDY_EXTRA_GLOBAL_DIRECTIVES="$$(printf %b "$(DEV_CADDY_EXTRA_GLOBAL_DIRECTIVES)")" \
-	CADDY_EXTRA_SITE_DIRECTIVES="$$(printf %b "$(DEV_CADDY_EXTRA_SITE_DIRECTIVES)")"     \
-	$(DC) $(1)
-endef
-
-define prod-env
-	[ -n "$(PROD_HTTP_PORT)" ]  &&  \
-	[ -n "$(PROD_HTTPS_PORT)" ] &&  \
-	[ -n "$(PROD_DOMAINS)" ]    &&  \
-	HTTP_PORT="$(PROD_HTTP_PORT)"   \
-	HTTPS_PORT="$(PROD_HTTPS_PORT)" \
-	DOMAINS="$(PROD_DOMAINS)"       \
-	NODE_ENV="production"           \
-	WATCH="0"                       \
-	CADDY_EXTRA_GLOBAL_DIRECTIVES="$$(printf %b "$(PROD_CADDY_EXTRA_GLOBAL_DIRECTIVES)")" \
-	CADDY_EXTRA_SITE_DIRECTIVES="$$(printf %b "$(PROD_CADDY_EXTRA_SITE_DIRECTIVES)")"     \
-	$(DC) $(1)
-endef
-
-define wait-progress
-	printf '\033[33m%s\033[m\n' \
-		"INFO: Starting to watch for filesystem changes in $(1) second(s)"
-	sleep 1
-endef
 
-.PHONY: ensure-secret-files
-ensure-secret-files:
-	@mkdir -p ./.secrets/
-	@$(RM) -r $(VAULT_TOKEN_EXCHANGE_FILES)
-	@touch $(VAULT_TOKEN_EXCHANGE_FILES)
+# Helper Makefile
+include Makefile.clean
+include Makefile.aux
 
-# This target is needed for legacy docker compose versions where there's no `--watch' flag for `docker compose up'.
-# Use the `dev' target instead.
+# This target is needed for legacy docker compose versions where there is no `--watch' flag for `docker compose up'.
+# The `dev' target is preferred.
 .PHONY: dev-old-compose
-dev-old-compose: check-env clean-app-volumes ensure-secret-files
+dev-old-compose: check-env
+	$(MAKE) clean-app-volumes ensure-secret-files
path: Makefile
user: login: darrenkuro
body: I think this should be `clean-frontend-volume` here now?
created_at: 2025-03-30T15:58:15Z
author_association: COLLABORATOR
diff_hunk: @@ -1,72 +1,31 @@
+# Change to docker-compose if you need
 DC := docker compose
+# Change to podman if you need
 D := docker
-
-VAULT_TOKEN_EXCHANGE_FILES := ./.secrets/backend_vault_token
-
+# Enables you do run `make` alone
 .DEFAULT_GOAL := dev
 
+# When registering a new service that needs vault, a file needs
+# to be added here for the exchange of the vault token. The
+# naming scheme is strict, it must be
+# ./.secrets/${service}_vault_token
+# where ${service} is the same as the JSON root subkeys in ./env.json
+VAULT_TOKEN_EXCHANGE_FILES := \
+	./.secrets/backend_vault_token
+
+# Must be in standard dotenv format
 -include .env
 include config.env
-.EXPORT_ALL_VARIABLES:
-
-.PHONY: check-env
-check-env:
-	@test -e .env || {        \
-		printf '\033[33m%s \033[42;30m%s\033[m\033[33m\n%s\n%s\n%s\n%s\n%s\033[m'          \
-			"Warning: .env doesn't exist, trying to run" "cp .env.example .env"            \
-			"Warning: Since the file didn't exist, no environment variables from"          \
-			"Warning: that file will be included/exposed inside this Makefile."            \
-			"Warning: It is STRONGLY recommended you abort this step, manually"            \
-			"Warning: copy the file, adjust its contents, and then run make again."        \
-			"Warning: Press ENTER to continue (run the cp command) or CTRL-C to abort..."; \
-		read c;               \
-		cp .env.example .env; \
-	}
-
-define dev-env
-	[ -n "$(DEV_HTTP_PORT)" ]  &&  \
-	[ -n "$(DEV_HTTPS_PORT)" ] &&  \
-	[ -n "$(DEV_DOMAINS)" ]    &&  \
-	HTTP_PORT="$(DEV_HTTP_PORT)"   \
-	HTTPS_PORT="$(DEV_HTTPS_PORT)" \
-	DOMAINS="$(DEV_DOMAINS)"       \
-	NODE_ENV="development"         \
-	WATCH="1"                      \
-	CADDY_EXTRA_GLOBAL_DIRECTIVES="$$(printf %b "$(DEV_CADDY_EXTRA_GLOBAL_DIRECTIVES)")" \
-	CADDY_EXTRA_SITE_DIRECTIVES="$$(printf %b "$(DEV_CADDY_EXTRA_SITE_DIRECTIVES)")"     \
-	$(DC) $(1)
-endef
-
-define prod-env
-	[ -n "$(PROD_HTTP_PORT)" ]  &&  \
-	[ -n "$(PROD_HTTPS_PORT)" ] &&  \
-	[ -n "$(PROD_DOMAINS)" ]    &&  \
-	HTTP_PORT="$(PROD_HTTP_PORT)"   \
-	HTTPS_PORT="$(PROD_HTTPS_PORT)" \
-	DOMAINS="$(PROD_DOMAINS)"       \
-	NODE_ENV="production"           \
-	WATCH="0"                       \
-	CADDY_EXTRA_GLOBAL_DIRECTIVES="$$(printf %b "$(PROD_CADDY_EXTRA_GLOBAL_DIRECTIVES)")" \
-	CADDY_EXTRA_SITE_DIRECTIVES="$$(printf %b "$(PROD_CADDY_EXTRA_SITE_DIRECTIVES)")"     \
-	$(DC) $(1)
-endef
-
-define wait-progress
-	printf '\033[33m%s\033[m\n' \
-		"INFO: Starting to watch for filesystem changes in $(1) second(s)"
-	sleep 1
-endef
 
-.PHONY: ensure-secret-files
-ensure-secret-files:
-	@mkdir -p ./.secrets/
-	@$(RM) -r $(VAULT_TOKEN_EXCHANGE_FILES)
-	@touch $(VAULT_TOKEN_EXCHANGE_FILES)
+# Helper Makefile
+include Makefile.clean
+include Makefile.aux
 
-# This target is needed for legacy docker compose versions where there's no `--watch' flag for `docker compose up'.
-# Use the `dev' target instead.
+# This target is needed for legacy docker compose versions where there is no `--watch' flag for `docker compose up'.
path: Makefile
user: login: cubernetes
body: Common quoting style when quoting code elements, can't give you examples from the top of my head, but I've seen it many times in documentation (for example extensively used in the bash man page)
- https://english.stackexchange.com/questions/17695/any-reference-on-the-usage-of-a-backtick-and-single-quotation-mark-like-this
- https://www.man7.org/linux/man-pages/man1/bash.1.html
created_at: 2025-03-30T16:00:09Z
author_association: OWNER
diff_hunk: @@ -52,7 +52,7 @@ jobs:
                      git stash --include-untracked || : ; : 'git stash may fail (if it does, prolly docker related' ; \
                      git checkout --force ${{ secrets.PRODUCTION_BRANCH }} ;                                          \
                      git pull --rebase --force ${{ secrets.REMOTE_NAME }} ${{ secrets.PRODUCTION_BRANCH }} ;          \
path: .github/workflows/deploy-production.yaml
user: login: cubernetes
body: Nope
created_at: 2025-03-30T16:01:19Z
author_association: OWNER
diff_hunk: @@ -1,72 +1,31 @@
+# Change to docker-compose if you need
 DC := docker compose
+# Change to podman if you need
 D := docker
-
-VAULT_TOKEN_EXCHANGE_FILES := ./.secrets/backend_vault_token
-
+# Enables you do run `make` alone
 .DEFAULT_GOAL := dev
 
+# When registering a new service that needs vault, a file needs
+# to be added here for the exchange of the vault token. The
+# naming scheme is strict, it must be
+# ./.secrets/${service}_vault_token
+# where ${service} is the same as the JSON root subkeys in ./env.json
+VAULT_TOKEN_EXCHANGE_FILES := \
+	./.secrets/backend_vault_token
+
+# Must be in standard dotenv format
 -include .env
 include config.env
-.EXPORT_ALL_VARIABLES:
-
-.PHONY: check-env
-check-env:
-	@test -e .env || {        \
-		printf '\033[33m%s \033[42;30m%s\033[m\033[33m\n%s\n%s\n%s\n%s\n%s\033[m'          \
-			"Warning: .env doesn't exist, trying to run" "cp .env.example .env"            \
-			"Warning: Since the file didn't exist, no environment variables from"          \
-			"Warning: that file will be included/exposed inside this Makefile."            \
-			"Warning: It is STRONGLY recommended you abort this step, manually"            \
-			"Warning: copy the file, adjust its contents, and then run make again."        \
-			"Warning: Press ENTER to continue (run the cp command) or CTRL-C to abort..."; \
-		read c;               \
-		cp .env.example .env; \
-	}
-
-define dev-env
-	[ -n "$(DEV_HTTP_PORT)" ]  &&  \
-	[ -n "$(DEV_HTTPS_PORT)" ] &&  \
-	[ -n "$(DEV_DOMAINS)" ]    &&  \
-	HTTP_PORT="$(DEV_HTTP_PORT)"   \
-	HTTPS_PORT="$(DEV_HTTPS_PORT)" \
-	DOMAINS="$(DEV_DOMAINS)"       \
-	NODE_ENV="development"         \
-	WATCH="1"                      \
-	CADDY_EXTRA_GLOBAL_DIRECTIVES="$$(printf %b "$(DEV_CADDY_EXTRA_GLOBAL_DIRECTIVES)")" \
-	CADDY_EXTRA_SITE_DIRECTIVES="$$(printf %b "$(DEV_CADDY_EXTRA_SITE_DIRECTIVES)")"     \
-	$(DC) $(1)
-endef
-
-define prod-env
-	[ -n "$(PROD_HTTP_PORT)" ]  &&  \
-	[ -n "$(PROD_HTTPS_PORT)" ] &&  \
-	[ -n "$(PROD_DOMAINS)" ]    &&  \
-	HTTP_PORT="$(PROD_HTTP_PORT)"   \
-	HTTPS_PORT="$(PROD_HTTPS_PORT)" \
-	DOMAINS="$(PROD_DOMAINS)"       \
-	NODE_ENV="production"           \
-	WATCH="0"                       \
-	CADDY_EXTRA_GLOBAL_DIRECTIVES="$$(printf %b "$(PROD_CADDY_EXTRA_GLOBAL_DIRECTIVES)")" \
-	CADDY_EXTRA_SITE_DIRECTIVES="$$(printf %b "$(PROD_CADDY_EXTRA_SITE_DIRECTIVES)")"     \
-	$(DC) $(1)
-endef
-
-define wait-progress
-	printf '\033[33m%s\033[m\n' \
-		"INFO: Starting to watch for filesystem changes in $(1) second(s)"
-	sleep 1
-endef
 
-.PHONY: ensure-secret-files
-ensure-secret-files:
-	@mkdir -p ./.secrets/
-	@$(RM) -r $(VAULT_TOKEN_EXCHANGE_FILES)
-	@touch $(VAULT_TOKEN_EXCHANGE_FILES)
+# Helper Makefile
+include Makefile.clean
+include Makefile.aux
 
-# This target is needed for legacy docker compose versions where there's no `--watch' flag for `docker compose up'.
-# Use the `dev' target instead.
+# This target is needed for legacy docker compose versions where there is no `--watch' flag for `docker compose up'.
+# The `dev' target is preferred.
 .PHONY: dev-old-compose
-dev-old-compose: check-env clean-app-volumes ensure-secret-files
+dev-old-compose: check-env
+	$(MAKE) clean-app-volumes ensure-secret-files
path: Makefile
user: login: cubernetes
body: Correct!
created_at: 2025-03-30T16:01:31Z
author_association: OWNER
diff_hunk: @@ -1,72 +1,31 @@
+# Change to docker-compose if you need
 DC := docker compose
+# Change to podman if you need
 D := docker
-
-VAULT_TOKEN_EXCHANGE_FILES := ./.secrets/backend_vault_token
-
+# Enables you do run `make` alone
 .DEFAULT_GOAL := dev
 
+# When registering a new service that needs vault, a file needs
+# to be added here for the exchange of the vault token. The
+# naming scheme is strict, it must be
+# ./.secrets/${service}_vault_token
+# where ${service} is the same as the JSON root subkeys in ./env.json
+VAULT_TOKEN_EXCHANGE_FILES := \
+	./.secrets/backend_vault_token
+
+# Must be in standard dotenv format
 -include .env
 include config.env
-.EXPORT_ALL_VARIABLES:
-
-.PHONY: check-env
-check-env:
-	@test -e .env || {        \
-		printf '\033[33m%s \033[42;30m%s\033[m\033[33m\n%s\n%s\n%s\n%s\n%s\033[m'          \
-			"Warning: .env doesn't exist, trying to run" "cp .env.example .env"            \
-			"Warning: Since the file didn't exist, no environment variables from"          \
-			"Warning: that file will be included/exposed inside this Makefile."            \
-			"Warning: It is STRONGLY recommended you abort this step, manually"            \
-			"Warning: copy the file, adjust its contents, and then run make again."        \
-			"Warning: Press ENTER to continue (run the cp command) or CTRL-C to abort..."; \
-		read c;               \
-		cp .env.example .env; \
-	}
-
-define dev-env
-	[ -n "$(DEV_HTTP_PORT)" ]  &&  \
-	[ -n "$(DEV_HTTPS_PORT)" ] &&  \
-	[ -n "$(DEV_DOMAINS)" ]    &&  \
-	HTTP_PORT="$(DEV_HTTP_PORT)"   \
-	HTTPS_PORT="$(DEV_HTTPS_PORT)" \
-	DOMAINS="$(DEV_DOMAINS)"       \
-	NODE_ENV="development"         \
-	WATCH="1"                      \
-	CADDY_EXTRA_GLOBAL_DIRECTIVES="$$(printf %b "$(DEV_CADDY_EXTRA_GLOBAL_DIRECTIVES)")" \
-	CADDY_EXTRA_SITE_DIRECTIVES="$$(printf %b "$(DEV_CADDY_EXTRA_SITE_DIRECTIVES)")"     \
-	$(DC) $(1)
-endef
-
-define prod-env
-	[ -n "$(PROD_HTTP_PORT)" ]  &&  \
-	[ -n "$(PROD_HTTPS_PORT)" ] &&  \
-	[ -n "$(PROD_DOMAINS)" ]    &&  \
-	HTTP_PORT="$(PROD_HTTP_PORT)"   \
-	HTTPS_PORT="$(PROD_HTTPS_PORT)" \
-	DOMAINS="$(PROD_DOMAINS)"       \
-	NODE_ENV="production"           \
-	WATCH="0"                       \
-	CADDY_EXTRA_GLOBAL_DIRECTIVES="$$(printf %b "$(PROD_CADDY_EXTRA_GLOBAL_DIRECTIVES)")" \
-	CADDY_EXTRA_SITE_DIRECTIVES="$$(printf %b "$(PROD_CADDY_EXTRA_SITE_DIRECTIVES)")"     \
-	$(DC) $(1)
-endef
-
-define wait-progress
-	printf '\033[33m%s\033[m\n' \
-		"INFO: Starting to watch for filesystem changes in $(1) second(s)"
-	sleep 1
-endef
 
-.PHONY: ensure-secret-files
-ensure-secret-files:
-	@mkdir -p ./.secrets/
-	@$(RM) -r $(VAULT_TOKEN_EXCHANGE_FILES)
-	@touch $(VAULT_TOKEN_EXCHANGE_FILES)
+# Helper Makefile
+include Makefile.clean
+include Makefile.aux
 
-# This target is needed for legacy docker compose versions where there's no `--watch' flag for `docker compose up'.
-# Use the `dev' target instead.
+# This target is needed for legacy docker compose versions where there is no `--watch' flag for `docker compose up'.
path: Makefile
user: login: cubernetes
body: Although now that I'm digging into this a bit more, the 
```
`'
```
style seems to be used for single characters and 
```
``''
```
for longer strings, but I've seen
```
``''
```
being used much rarer than
```
`'
```
created_at: 2025-03-30T16:04:55Z
author_association: OWNER
diff_hunk: @@ -1,72 +1,31 @@
+# Change to docker-compose if you need
 DC := docker compose
+# Change to podman if you need
 D := docker
-
-VAULT_TOKEN_EXCHANGE_FILES := ./.secrets/backend_vault_token
-
+# Enables you do run `make` alone
 .DEFAULT_GOAL := dev
 
+# When registering a new service that needs vault, a file needs
+# to be added here for the exchange of the vault token. The
+# naming scheme is strict, it must be
+# ./.secrets/${service}_vault_token
+# where ${service} is the same as the JSON root subkeys in ./env.json
+VAULT_TOKEN_EXCHANGE_FILES := \
+	./.secrets/backend_vault_token
+
+# Must be in standard dotenv format
 -include .env
 include config.env
-.EXPORT_ALL_VARIABLES:
-
-.PHONY: check-env
-check-env:
-	@test -e .env || {        \
-		printf '\033[33m%s \033[42;30m%s\033[m\033[33m\n%s\n%s\n%s\n%s\n%s\033[m'          \
-			"Warning: .env doesn't exist, trying to run" "cp .env.example .env"            \
-			"Warning: Since the file didn't exist, no environment variables from"          \
-			"Warning: that file will be included/exposed inside this Makefile."            \
-			"Warning: It is STRONGLY recommended you abort this step, manually"            \
-			"Warning: copy the file, adjust its contents, and then run make again."        \
-			"Warning: Press ENTER to continue (run the cp command) or CTRL-C to abort..."; \
-		read c;               \
-		cp .env.example .env; \
-	}
-
-define dev-env
-	[ -n "$(DEV_HTTP_PORT)" ]  &&  \
-	[ -n "$(DEV_HTTPS_PORT)" ] &&  \
-	[ -n "$(DEV_DOMAINS)" ]    &&  \
-	HTTP_PORT="$(DEV_HTTP_PORT)"   \
-	HTTPS_PORT="$(DEV_HTTPS_PORT)" \
-	DOMAINS="$(DEV_DOMAINS)"       \
-	NODE_ENV="development"         \
-	WATCH="1"                      \
-	CADDY_EXTRA_GLOBAL_DIRECTIVES="$$(printf %b "$(DEV_CADDY_EXTRA_GLOBAL_DIRECTIVES)")" \
-	CADDY_EXTRA_SITE_DIRECTIVES="$$(printf %b "$(DEV_CADDY_EXTRA_SITE_DIRECTIVES)")"     \
-	$(DC) $(1)
-endef
-
-define prod-env
-	[ -n "$(PROD_HTTP_PORT)" ]  &&  \
-	[ -n "$(PROD_HTTPS_PORT)" ] &&  \
-	[ -n "$(PROD_DOMAINS)" ]    &&  \
-	HTTP_PORT="$(PROD_HTTP_PORT)"   \
-	HTTPS_PORT="$(PROD_HTTPS_PORT)" \
-	DOMAINS="$(PROD_DOMAINS)"       \
-	NODE_ENV="production"           \
-	WATCH="0"                       \
-	CADDY_EXTRA_GLOBAL_DIRECTIVES="$$(printf %b "$(PROD_CADDY_EXTRA_GLOBAL_DIRECTIVES)")" \
-	CADDY_EXTRA_SITE_DIRECTIVES="$$(printf %b "$(PROD_CADDY_EXTRA_SITE_DIRECTIVES)")"     \
-	$(DC) $(1)
-endef
-
-define wait-progress
-	printf '\033[33m%s\033[m\n' \
-		"INFO: Starting to watch for filesystem changes in $(1) second(s)"
-	sleep 1
-endef
 
-.PHONY: ensure-secret-files
-ensure-secret-files:
-	@mkdir -p ./.secrets/
-	@$(RM) -r $(VAULT_TOKEN_EXCHANGE_FILES)
-	@touch $(VAULT_TOKEN_EXCHANGE_FILES)
+# Helper Makefile
+include Makefile.clean
+include Makefile.aux
 
-# This target is needed for legacy docker compose versions where there's no `--watch' flag for `docker compose up'.
-# Use the `dev' target instead.
+# This target is needed for legacy docker compose versions where there is no `--watch' flag for `docker compose up'.
path: Makefile
user: login: darrenkuro
body: Huh interesting, I'll look into it more later but if it's intentional then you can just resolve this

I'd like to be consistent though if possible; so maybe after doing a bit of a research and deciding on this style we will change all the quotes in comments to this styles later?
created_at: 2025-03-30T16:08:19Z
author_association: COLLABORATOR
diff_hunk: @@ -1,72 +1,31 @@
+# Change to docker-compose if you need
 DC := docker compose
+# Change to podman if you need
 D := docker
-
-VAULT_TOKEN_EXCHANGE_FILES := ./.secrets/backend_vault_token
-
+# Enables you do run `make` alone
 .DEFAULT_GOAL := dev
 
+# When registering a new service that needs vault, a file needs
+# to be added here for the exchange of the vault token. The
+# naming scheme is strict, it must be
+# ./.secrets/${service}_vault_token
+# where ${service} is the same as the JSON root subkeys in ./env.json
+VAULT_TOKEN_EXCHANGE_FILES := \
+	./.secrets/backend_vault_token
+
+# Must be in standard dotenv format
 -include .env
 include config.env
-.EXPORT_ALL_VARIABLES:
-
-.PHONY: check-env
-check-env:
-	@test -e .env || {        \
-		printf '\033[33m%s \033[42;30m%s\033[m\033[33m\n%s\n%s\n%s\n%s\n%s\033[m'          \
-			"Warning: .env doesn't exist, trying to run" "cp .env.example .env"            \
-			"Warning: Since the file didn't exist, no environment variables from"          \
-			"Warning: that file will be included/exposed inside this Makefile."            \
-			"Warning: It is STRONGLY recommended you abort this step, manually"            \
-			"Warning: copy the file, adjust its contents, and then run make again."        \
-			"Warning: Press ENTER to continue (run the cp command) or CTRL-C to abort..."; \
-		read c;               \
-		cp .env.example .env; \
-	}
-
-define dev-env
-	[ -n "$(DEV_HTTP_PORT)" ]  &&  \
-	[ -n "$(DEV_HTTPS_PORT)" ] &&  \
-	[ -n "$(DEV_DOMAINS)" ]    &&  \
-	HTTP_PORT="$(DEV_HTTP_PORT)"   \
-	HTTPS_PORT="$(DEV_HTTPS_PORT)" \
-	DOMAINS="$(DEV_DOMAINS)"       \
-	NODE_ENV="development"         \
-	WATCH="1"                      \
-	CADDY_EXTRA_GLOBAL_DIRECTIVES="$$(printf %b "$(DEV_CADDY_EXTRA_GLOBAL_DIRECTIVES)")" \
-	CADDY_EXTRA_SITE_DIRECTIVES="$$(printf %b "$(DEV_CADDY_EXTRA_SITE_DIRECTIVES)")"     \
-	$(DC) $(1)
-endef
-
-define prod-env
-	[ -n "$(PROD_HTTP_PORT)" ]  &&  \
-	[ -n "$(PROD_HTTPS_PORT)" ] &&  \
-	[ -n "$(PROD_DOMAINS)" ]    &&  \
-	HTTP_PORT="$(PROD_HTTP_PORT)"   \
-	HTTPS_PORT="$(PROD_HTTPS_PORT)" \
-	DOMAINS="$(PROD_DOMAINS)"       \
-	NODE_ENV="production"           \
-	WATCH="0"                       \
-	CADDY_EXTRA_GLOBAL_DIRECTIVES="$$(printf %b "$(PROD_CADDY_EXTRA_GLOBAL_DIRECTIVES)")" \
-	CADDY_EXTRA_SITE_DIRECTIVES="$$(printf %b "$(PROD_CADDY_EXTRA_SITE_DIRECTIVES)")"     \
-	$(DC) $(1)
-endef
-
-define wait-progress
-	printf '\033[33m%s\033[m\n' \
-		"INFO: Starting to watch for filesystem changes in $(1) second(s)"
-	sleep 1
-endef
 
-.PHONY: ensure-secret-files
-ensure-secret-files:
-	@mkdir -p ./.secrets/
-	@$(RM) -r $(VAULT_TOKEN_EXCHANGE_FILES)
-	@touch $(VAULT_TOKEN_EXCHANGE_FILES)
+# Helper Makefile
+include Makefile.clean
+include Makefile.aux
 
-# This target is needed for legacy docker compose versions where there's no `--watch' flag for `docker compose up'.
-# Use the `dev' target instead.
+# This target is needed for legacy docker compose versions where there is no `--watch' flag for `docker compose up'.
path: Makefile
user: login: cubernetes
body: We can absolutely do that :D. For ease of collaboration we will probably end up deciding on either plain single or double quotes. The
```
`'
```
style is a little bit opinionated haha, although I feel like relatively common in shell scripts specifically
created_at: 2025-03-30T16:13:57Z
author_association: OWNER

PR comments:
user: login: darrenkuro
created_at: 2025-03-30T16:09:33Z
body: Could we maybe changing the names for `Makefile.aux/clean` to `Makefile.aux/clean.mk`? The extension .mk will give my editor at least the correct parsing and styling; files with all white text are a bit jarring lol
author_association: COLLABORATOR
user: login: cubernetes
created_at: 2025-03-30T16:12:47Z
body: Oh lol, sure sure. I'm not 100% sure what scheme you mean exactly, this?:
Makefile.aux -> Makefile.aux.mk
Makefile.clean -> Makefile.clean.mk

In that case, because .mk means make already, I would suggest we rather do
clean.mk
aux.mk
How does that feel? For consisteny, we could even rename the Makefile to makefile (see https://www.gnu.org/software/make/manual/html_node/Makefile-Names.html).

What do you say?
author_association: OWNER
user: login: darrenkuro
created_at: 2025-03-30T16:19:23Z
body: `.mk` does mean Makefile I believe, but I don't really see a big problem with it because since files are sorted often alphabetically, they will be grouped together and that could be more visually pleasing on the side bar. That's the issue in an editor though, I guess if you live in the terminal you'd barely notice lol. Since it'd still be makefile and not makefile.mk, I think I'd rather do Makefile, Makefile.aux.mk, Makefile.clean.mk unless the repetition really bothers you. Let me look into it see if there's any naming conventions. Tbh I didn't even know you could separate Makefile contents like this before.
author_association: COLLABORATOR
user: login: cubernetes
created_at: 2025-03-30T16:21:48Z
body: Ohh yeah, no the naming makes sense, when I do vim Make<TAB> it's nice to have all 3. Ok I'm gonna rename them
author_association: OWNER
user: login: cubernetes
created_at: 2025-03-30T16:24:35Z
body: Gonna have to make one more commit, because as of now none of the clean targets depend on the `down` target, so everything fails lol
author_association: OWNER
user: login: darrenkuro
created_at: 2025-03-30T16:26:21Z
body: So apparently the convention for Makefiles per AI (didn't check too much) is that if it's in root folder, they are called `Makefile`, `Makefile.subfilea` `Makefile.subfileb`; and if in a dedicated folder they are called Makefile, and in `/make` you'd have the `subfilea.mk` `subfileb.mk`. I also figured out that I can force the editor (VS code to load Makefile regardless with this in the setting)
```
  "files.associations": {
    "Makefile.*": "makefile"
  }
```

So you could switch back to the old names if you'd like (might be more conventional); but I feel like either way is fine and with `.mk` extension it'd work out of the box for anyone working in vs code.
author_association: COLLABORATOR
user: login: cubernetes
created_at: 2025-03-30T16:27:35Z
body: Ok haha gonna remove the extension again
author_association: OWNER