From 040eddbe6b2af078ded538e49e75e9a54bab741e Mon Sep 17 00:00:00 2001 From: Anthony LC Date: Fri, 18 Jul 2025 13:23:56 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7(project)=20change=20env.d=20system?= =?UTF-8?q?=20by=20using=20local=20files?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We had lot of problems with the previous env.d system. Users were often confused by the need to change the env.d files manually, leading to issues when using the project locally. This commit introduces a new system that uses .env.local files, which are automatically created and can be modified by users without affecting the original env.d files. This should simplify the development process and reduce confusion by removing the need to manually edit env.d files. --- .github/workflows/impress-frontend.yml | 4 +-- .gitignore | 3 +- CHANGELOG.md | 1 + Makefile | 30 +++++-------------- compose-e2e.yml | 1 + compose.yml | 8 +++++ env.d/development/{common.dist => common} | 0 .../{common.e2e.dist => common.e2e} | 0 env.d/development/{crowdin.dist => crowdin} | 0 .../{kc_postgresql.dist => kc_postgresql} | 0 .../{postgresql.dist => postgresql} | 0 11 files changed, 21 insertions(+), 26 deletions(-) rename env.d/development/{common.dist => common} (100%) rename env.d/development/{common.e2e.dist => common.e2e} (100%) rename env.d/development/{crowdin.dist => crowdin} (100%) rename env.d/development/{kc_postgresql.dist => kc_postgresql} (100%) rename env.d/development/{postgresql.dist => postgresql} (100%) diff --git a/.github/workflows/impress-frontend.yml b/.github/workflows/impress-frontend.yml index 3e57af1b20..1d8193522c 100644 --- a/.github/workflows/impress-frontend.yml +++ b/.github/workflows/impress-frontend.yml @@ -80,7 +80,7 @@ jobs: fail-on-cache-miss: true - name: Set e2e env variables - run: cat env.d/development/common.e2e.dist >> env.d/development/common.dist + run: cat env.d/development/common.e2e >> env.d/development/common.local - name: Install Playwright Browsers run: cd src/frontend/apps/e2e && yarn install --frozen-lockfile && yarn install-playwright chromium @@ -119,7 +119,7 @@ jobs: fail-on-cache-miss: true - name: Set e2e env variables - run: cat env.d/development/common.e2e.dist >> env.d/development/common.dist + run: cat env.d/development/common.e2e >> env.d/development/common.local - name: Install Playwright Browsers run: cd src/frontend/apps/e2e && yarn install --frozen-lockfile && yarn install-playwright firefox webkit chromium diff --git a/.gitignore b/.gitignore index aa55738154..ec7fe59c3e 100644 --- a/.gitignore +++ b/.gitignore @@ -40,8 +40,7 @@ venv/ ENV/ env.bak/ venv.bak/ -env.d/development/* -!env.d/development/*.dist +env.d/development/*.local env.d/terraform # npm diff --git a/CHANGELOG.md b/CHANGELOG.md index 9e6087d475..b0922849b7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ and this project adheres to ### Changed - ⚡️(docker) Optimize Dockerfile to use apk with --no-cache #743 +- 🔧(project) change env.d system by using local files #1200 ### Fixed diff --git a/Makefile b/Makefile index 70ef4978a7..39d6a76450 100644 --- a/Makefile +++ b/Makefile @@ -67,18 +67,18 @@ data/static: # -- Project -create-env-files: ## Copy the dist env files to env files -create-env-files: \ - env.d/development/common \ - env.d/development/crowdin \ - env.d/development/postgresql \ - env.d/development/kc_postgresql -.PHONY: create-env-files +create-env-local-files: ## create env.local files in env.d/development +create-env-local-files: + @touch env.d/development/crowdin.local + @touch env.d/development/common.local + @touch env.d/development/postgresql.local + @touch env.d/development/kc_postgresql.local +.PHONY: create-env-local-files pre-bootstrap: \ data/media \ data/static \ - create-env-files + create-env-local-files .PHONY: pre-bootstrap post-bootstrap: \ @@ -258,20 +258,6 @@ resetdb: ## flush database and create a superuser "admin" @${MAKE} superuser .PHONY: resetdb -env.d/development/common: - cp -n env.d/development/common.dist env.d/development/common - -env.d/development/postgresql: - cp -n env.d/development/postgresql.dist env.d/development/postgresql - -env.d/development/kc_postgresql: - cp -n env.d/development/kc_postgresql.dist env.d/development/kc_postgresql - -# -- Internationalization - -env.d/development/crowdin: - cp -n env.d/development/crowdin.dist env.d/development/crowdin - crowdin-download: ## Download translated message from crowdin @$(COMPOSE_RUN_CROWDIN) download -c crowdin/config.yml .PHONY: crowdin-download diff --git a/compose-e2e.yml b/compose-e2e.yml index 5b05b4cfaf..e940294a58 100644 --- a/compose-e2e.yml +++ b/compose-e2e.yml @@ -24,5 +24,6 @@ services: restart: unless-stopped env_file: - env.d/development/common + - env.d/development/common.local ports: - "4444:4444" \ No newline at end of file diff --git a/compose.yml b/compose.yml index adb6943175..88e178e353 100644 --- a/compose.yml +++ b/compose.yml @@ -10,6 +10,7 @@ services: retries: 300 env_file: - env.d/development/postgresql + - env.d/development/postgresql.local ports: - "15432:5432" @@ -66,7 +67,9 @@ services: - DJANGO_CONFIGURATION=Development env_file: - env.d/development/common + - env.d/development/common.local - env.d/development/postgresql + - env.d/development/postgresql.local ports: - "8071:8000" volumes: @@ -91,7 +94,9 @@ services: - DJANGO_CONFIGURATION=Development env_file: - env.d/development/common + - env.d/development/common.local - env.d/development/postgresql + - env.d/development/postgresql.local volumes: - ./src/backend:/app - ./data/static:/data/static @@ -135,6 +140,7 @@ services: - ".:/app" env_file: - env.d/development/crowdin + - env.d/development/crowdin.local user: "${DOCKER_USER:-1000}" working_dir: /app @@ -156,6 +162,7 @@ services: restart: unless-stopped env_file: - env.d/development/common + - env.d/development/common.local ports: - "4444:4444" volumes: @@ -174,6 +181,7 @@ services: - "5433:5432" env_file: - env.d/development/kc_postgresql + - env.d/development/kc_postgresql.local keycloak: image: quay.io/keycloak/keycloak:20.0.1 diff --git a/env.d/development/common.dist b/env.d/development/common similarity index 100% rename from env.d/development/common.dist rename to env.d/development/common diff --git a/env.d/development/common.e2e.dist b/env.d/development/common.e2e similarity index 100% rename from env.d/development/common.e2e.dist rename to env.d/development/common.e2e diff --git a/env.d/development/crowdin.dist b/env.d/development/crowdin similarity index 100% rename from env.d/development/crowdin.dist rename to env.d/development/crowdin diff --git a/env.d/development/kc_postgresql.dist b/env.d/development/kc_postgresql similarity index 100% rename from env.d/development/kc_postgresql.dist rename to env.d/development/kc_postgresql diff --git a/env.d/development/postgresql.dist b/env.d/development/postgresql similarity index 100% rename from env.d/development/postgresql.dist rename to env.d/development/postgresql