2024-01-09 15:30:36 +01:00
|
|
|
# /!\ /!\ /!\ /!\ /!\ /!\ /!\ DISCLAIMER /!\ /!\ /!\ /!\ /!\ /!\ /!\ /!\
|
|
|
|
|
#
|
|
|
|
|
# This Makefile is only meant to be used for DEVELOPMENT purpose as we are
|
|
|
|
|
# changing the user id that will run in the container.
|
|
|
|
|
#
|
|
|
|
|
# PLEASE DO NOT USE IT FOR YOUR CI/PRODUCTION/WHATEVER...
|
|
|
|
|
#
|
|
|
|
|
# /!\ /!\ /!\ /!\ /!\ /!\ /!\ /!\ /!\ /!\ /!\ /!\ /!\ /!\ /!\ /!\ /!\ /!\
|
|
|
|
|
#
|
|
|
|
|
# Note to developers:
|
|
|
|
|
#
|
|
|
|
|
# While editing this file, please respect the following statements:
|
|
|
|
|
#
|
|
|
|
|
# 1. Every variable should be defined in the ad hoc VARIABLES section with a
|
|
|
|
|
# relevant subsection
|
|
|
|
|
# 2. Every new rule should be defined in the ad hoc RULES section with a
|
|
|
|
|
# relevant subsection depending on the targeted service
|
|
|
|
|
# 3. Rules should be sorted alphabetically within their section
|
|
|
|
|
# 4. When a rule has multiple dependencies, you should:
|
|
|
|
|
# - duplicate the rule name to add the help string (if required)
|
|
|
|
|
# - write one dependency per line to increase readability and diffs
|
|
|
|
|
# 5. .PHONY rule statement should be written after the corresponding rule
|
|
|
|
|
# ==============================================================================
|
|
|
|
|
# VARIABLES
|
|
|
|
|
|
|
|
|
|
BOLD := \033[1m
|
|
|
|
|
RESET := \033[0m
|
|
|
|
|
GREEN := \033[1;32m
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# -- Database
|
|
|
|
|
|
|
|
|
|
DB_HOST = postgresql
|
|
|
|
|
DB_PORT = 5432
|
|
|
|
|
|
|
|
|
|
# -- Docker
|
|
|
|
|
# Get the current user ID to use for docker run and docker exec commands
|
|
|
|
|
DOCKER_UID = $(shell id -u)
|
|
|
|
|
DOCKER_GID = $(shell id -g)
|
|
|
|
|
DOCKER_USER = $(DOCKER_UID):$(DOCKER_GID)
|
|
|
|
|
COMPOSE = DOCKER_USER=$(DOCKER_USER) docker compose
|
|
|
|
|
COMPOSE_EXEC = $(COMPOSE) exec
|
|
|
|
|
COMPOSE_EXEC_APP = $(COMPOSE_EXEC) app-dev
|
|
|
|
|
COMPOSE_RUN = $(COMPOSE) run --rm
|
|
|
|
|
COMPOSE_RUN_APP = $(COMPOSE_RUN) app-dev
|
|
|
|
|
COMPOSE_RUN_CROWDIN = $(COMPOSE_RUN) crowdin crowdin
|
|
|
|
|
WAIT_DB = @$(COMPOSE_RUN) dockerize -wait tcp://$(DB_HOST):$(DB_PORT) -timeout 60s
|
|
|
|
|
|
|
|
|
|
# -- Backend
|
|
|
|
|
MANAGE = $(COMPOSE_RUN_APP) python manage.py
|
2024-08-06 10:40:28 +02:00
|
|
|
MAIL_NPM = $(COMPOSE_RUN) -w /app/src/mail node npm
|
2024-01-09 15:30:36 +01:00
|
|
|
|
|
|
|
|
# -- Frontend
|
|
|
|
|
PATH_FRONT = ./src/frontend
|
|
|
|
|
|
|
|
|
|
# ==============================================================================
|
|
|
|
|
# RULES
|
|
|
|
|
|
|
|
|
|
default: help
|
|
|
|
|
|
|
|
|
|
data/media:
|
|
|
|
|
@mkdir -p data/media
|
|
|
|
|
|
|
|
|
|
data/static:
|
|
|
|
|
@mkdir -p 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 \
|
2025-09-09 12:32:30 +02:00
|
|
|
env.d/development/kc_postgresql \
|
|
|
|
|
env.d/development/summary
|
2024-01-09 15:30:36 +01:00
|
|
|
.PHONY: create-env-files
|
|
|
|
|
|
|
|
|
|
bootstrap: ## Prepare Docker images for the project
|
|
|
|
|
bootstrap: \
|
|
|
|
|
data/media \
|
|
|
|
|
data/static \
|
|
|
|
|
create-env-files \
|
|
|
|
|
build \
|
|
|
|
|
migrate \
|
|
|
|
|
demo \
|
|
|
|
|
back-i18n-compile \
|
|
|
|
|
mails-install \
|
|
|
|
|
mails-build
|
|
|
|
|
.PHONY: bootstrap
|
|
|
|
|
|
|
|
|
|
# -- Docker/compose
|
2025-03-13 18:53:14 +01:00
|
|
|
build: ## build the project containers
|
|
|
|
|
@$(MAKE) build-backend
|
|
|
|
|
@$(MAKE) build-frontend
|
2024-01-09 15:30:36 +01:00
|
|
|
.PHONY: build
|
|
|
|
|
|
2025-03-13 18:53:14 +01:00
|
|
|
build-backend: ## build the app-dev container
|
|
|
|
|
@$(COMPOSE) build app-dev
|
|
|
|
|
.PHONY: build-backend
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
build-frontend: ## build the frontend container
|
|
|
|
|
@$(COMPOSE) build frontend
|
|
|
|
|
.PHONY: build-frontend
|
|
|
|
|
|
2024-01-09 15:30:36 +01:00
|
|
|
down: ## stop and remove containers, networks, images, and volumes
|
|
|
|
|
@$(COMPOSE) down
|
|
|
|
|
.PHONY: down
|
|
|
|
|
|
|
|
|
|
logs: ## display app-dev logs (follow mode)
|
|
|
|
|
@$(COMPOSE) logs -f app-dev
|
|
|
|
|
.PHONY: logs
|
|
|
|
|
|
2025-03-13 18:53:14 +01:00
|
|
|
run-backend: ## start only the backend application and all needed services
|
2024-01-09 15:30:36 +01:00
|
|
|
@$(COMPOSE) up --force-recreate -d celery-dev
|
|
|
|
|
@echo "Wait for postgresql to be up..."
|
|
|
|
|
@$(WAIT_DB)
|
2025-03-13 18:53:14 +01:00
|
|
|
.PHONY: run-backend
|
|
|
|
|
|
2025-09-09 12:32:30 +02:00
|
|
|
run-summary: ## start only the summary application and all needed services
|
|
|
|
|
@$(COMPOSE) up --force-recreate -d celery-summary
|
|
|
|
|
.PHONY: run-summary
|
|
|
|
|
|
2025-03-13 18:53:14 +01:00
|
|
|
run:
|
|
|
|
|
run: ## start the wsgi (production) and development server
|
|
|
|
|
@$(MAKE) run-backend
|
2025-09-09 12:32:30 +02:00
|
|
|
@$(MAKE) run-summary
|
2025-03-13 18:53:14 +01:00
|
|
|
@$(COMPOSE) up --force-recreate -d frontend
|
2024-01-09 15:30:36 +01:00
|
|
|
.PHONY: run
|
|
|
|
|
|
|
|
|
|
status: ## an alias for "docker compose ps"
|
|
|
|
|
@$(COMPOSE) ps
|
|
|
|
|
.PHONY: status
|
|
|
|
|
|
|
|
|
|
stop: ## stop the development server using Docker
|
|
|
|
|
@$(COMPOSE) stop
|
|
|
|
|
.PHONY: stop
|
|
|
|
|
|
2025-03-13 18:54:20 +01:00
|
|
|
# -- Front
|
|
|
|
|
|
|
|
|
|
frontend-development-install: ## install the frontend locally
|
|
|
|
|
cd $(PATH_FRONT) && npm i
|
|
|
|
|
.PHONY: frontend-development-install
|
|
|
|
|
|
|
|
|
|
frontend-lint: ## run the frontend linter
|
|
|
|
|
cd $(PATH_FRONT) && npm run lint
|
|
|
|
|
.PHONY: frontend-lint
|
|
|
|
|
|
|
|
|
|
frontend-format: ## run the frontend format
|
|
|
|
|
cd $(PATH_FRONT) && npm run format
|
|
|
|
|
.PHONY: frontend-format
|
|
|
|
|
|
|
|
|
|
run-frontend-development: ## run the frontend in development mode
|
|
|
|
|
@$(COMPOSE) stop frontend
|
|
|
|
|
cd $(PATH_FRONT) && npm run dev
|
|
|
|
|
.PHONY: run-frontend-development
|
|
|
|
|
|
2024-01-09 15:30:36 +01:00
|
|
|
# -- Backend
|
|
|
|
|
|
|
|
|
|
demo: ## flush db then create a demo for load testing purpose
|
|
|
|
|
@$(MAKE) resetdb
|
|
|
|
|
@$(MANAGE) create_demo
|
|
|
|
|
.PHONY: demo
|
|
|
|
|
|
|
|
|
|
# Nota bene: Black should come after isort just in case they don't agree...
|
|
|
|
|
lint: ## lint back-end python sources
|
|
|
|
|
lint: \
|
|
|
|
|
lint-ruff-format \
|
|
|
|
|
lint-ruff-check \
|
|
|
|
|
lint-pylint
|
|
|
|
|
.PHONY: lint
|
|
|
|
|
|
|
|
|
|
lint-ruff-format: ## format back-end python sources with ruff
|
|
|
|
|
@echo 'lint:ruff-format started…'
|
|
|
|
|
@$(COMPOSE_RUN_APP) ruff format .
|
|
|
|
|
.PHONY: lint-ruff-format
|
|
|
|
|
|
|
|
|
|
lint-ruff-check: ## lint back-end python sources with ruff
|
|
|
|
|
@echo 'lint:ruff-check started…'
|
|
|
|
|
@$(COMPOSE_RUN_APP) ruff check . --fix
|
|
|
|
|
.PHONY: lint-ruff-check
|
|
|
|
|
|
|
|
|
|
lint-pylint: ## lint back-end python sources with pylint only on changed files from main
|
|
|
|
|
@echo 'lint:pylint started…'
|
2024-07-31 12:54:06 +02:00
|
|
|
@$(COMPOSE_RUN_APP) pylint meet demo core
|
2024-01-09 15:30:36 +01:00
|
|
|
.PHONY: lint-pylint
|
|
|
|
|
|
|
|
|
|
test: ## run project tests
|
|
|
|
|
@$(MAKE) test-back-parallel
|
|
|
|
|
.PHONY: test
|
|
|
|
|
|
|
|
|
|
test-back: ## run back-end tests
|
|
|
|
|
@args="$(filter-out $@,$(MAKECMDGOALS))" && \
|
|
|
|
|
bin/pytest $${args:-${1}}
|
|
|
|
|
.PHONY: test-back
|
|
|
|
|
|
|
|
|
|
test-back-parallel: ## run all back-end tests in parallel
|
|
|
|
|
@args="$(filter-out $@,$(MAKECMDGOALS))" && \
|
|
|
|
|
bin/pytest -n auto $${args:-${1}}
|
|
|
|
|
.PHONY: test-back-parallel
|
|
|
|
|
|
2024-07-01 18:10:40 +02:00
|
|
|
makemigrations: ## run django makemigrations for the Meet project.
|
2024-01-09 15:30:36 +01:00
|
|
|
@echo "$(BOLD)Running makemigrations$(RESET)"
|
|
|
|
|
@$(COMPOSE) up -d postgresql
|
|
|
|
|
@$(WAIT_DB)
|
|
|
|
|
@$(MANAGE) makemigrations
|
|
|
|
|
.PHONY: makemigrations
|
|
|
|
|
|
2024-07-01 18:10:40 +02:00
|
|
|
migrate: ## run django migrations for the Meet project.
|
2024-01-09 15:30:36 +01:00
|
|
|
@echo "$(BOLD)Running migrations$(RESET)"
|
|
|
|
|
@$(COMPOSE) up -d postgresql
|
|
|
|
|
@$(WAIT_DB)
|
|
|
|
|
@$(MANAGE) migrate
|
|
|
|
|
.PHONY: migrate
|
|
|
|
|
|
|
|
|
|
superuser: ## Create an admin superuser with password "admin"
|
|
|
|
|
@echo "$(BOLD)Creating a Django superuser$(RESET)"
|
|
|
|
|
@$(MANAGE) createsuperuser --email admin@example.com --password admin
|
|
|
|
|
.PHONY: superuser
|
|
|
|
|
|
|
|
|
|
back-i18n-compile: ## compile the gettext files
|
|
|
|
|
@$(MANAGE) compilemessages --ignore="venv/**/*"
|
|
|
|
|
.PHONY: back-i18n-compile
|
|
|
|
|
|
|
|
|
|
back-i18n-generate: ## create the .pot files used for i18n
|
|
|
|
|
@$(MANAGE) makemessages -a --keep-pot
|
|
|
|
|
.PHONY: back-i18n-generate
|
|
|
|
|
|
|
|
|
|
shell: ## connect to database shell
|
|
|
|
|
@$(MANAGE) shell #_plus
|
|
|
|
|
.PHONY: dbshell
|
|
|
|
|
|
|
|
|
|
# -- Database
|
|
|
|
|
|
|
|
|
|
dbshell: ## connect to database shell
|
|
|
|
|
docker compose exec app-dev python manage.py dbshell
|
|
|
|
|
.PHONY: dbshell
|
|
|
|
|
|
|
|
|
|
resetdb: FLUSH_ARGS ?=
|
|
|
|
|
resetdb: ## flush database and create a superuser "admin"
|
|
|
|
|
@echo "$(BOLD)Flush database$(RESET)"
|
|
|
|
|
@$(MANAGE) flush $(FLUSH_ARGS)
|
|
|
|
|
@${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
|
|
|
|
|
|
2025-09-09 12:32:30 +02:00
|
|
|
env.d/development/summary:
|
|
|
|
|
cp -n env.d/development/summary.dist env.d/development/summary
|
|
|
|
|
|
2024-01-09 15:30:36 +01:00
|
|
|
# -- Internationalization
|
|
|
|
|
|
|
|
|
|
env.d/development/crowdin:
|
|
|
|
|
cp -n env.d/development/crowdin.dist env.d/development/crowdin
|
|
|
|
|
|
2024-07-03 18:30:25 +02:00
|
|
|
crowdin-download: ## Download translated message from Crowdin
|
2024-01-09 15:30:36 +01:00
|
|
|
@$(COMPOSE_RUN_CROWDIN) download -c crowdin/config.yml
|
|
|
|
|
.PHONY: crowdin-download
|
|
|
|
|
|
|
|
|
|
crowdin-download-sources: ## Download sources from Crowdin
|
|
|
|
|
@$(COMPOSE_RUN_CROWDIN) download sources -c crowdin/config.yml
|
|
|
|
|
.PHONY: crowdin-download-sources
|
|
|
|
|
|
2024-07-03 18:30:25 +02:00
|
|
|
crowdin-upload: ## Upload source translations to Crowdin
|
2024-01-09 15:30:36 +01:00
|
|
|
@$(COMPOSE_RUN_CROWDIN) upload sources -c crowdin/config.yml
|
|
|
|
|
.PHONY: crowdin-upload
|
|
|
|
|
|
2024-07-19 12:27:51 +02:00
|
|
|
crowdin-upload-translations: ## Upload translations to Crowdin
|
|
|
|
|
@$(COMPOSE_RUN_CROWDIN) upload translations -c crowdin/config.yml
|
|
|
|
|
.PHONY: crowdin-upload-translations
|
|
|
|
|
|
2024-01-09 15:30:36 +01:00
|
|
|
i18n-compile: ## compile all translations
|
|
|
|
|
i18n-compile: \
|
2024-07-19 12:27:51 +02:00
|
|
|
back-i18n-compile
|
2024-01-09 15:30:36 +01:00
|
|
|
.PHONY: i18n-compile
|
|
|
|
|
|
|
|
|
|
i18n-generate: ## create the .pot files and extract frontend messages
|
|
|
|
|
i18n-generate: \
|
|
|
|
|
back-i18n-generate \
|
|
|
|
|
frontend-i18n-generate
|
|
|
|
|
.PHONY: i18n-generate
|
|
|
|
|
|
|
|
|
|
i18n-download-and-compile: ## download all translated messages and compile them to be used by all applications
|
|
|
|
|
i18n-download-and-compile: \
|
|
|
|
|
crowdin-download \
|
|
|
|
|
i18n-compile
|
|
|
|
|
.PHONY: i18n-download-and-compile
|
|
|
|
|
|
|
|
|
|
i18n-generate-and-upload: ## generate source translations for all applications and upload them to Crowdin
|
|
|
|
|
i18n-generate-and-upload: \
|
|
|
|
|
i18n-generate \
|
|
|
|
|
crowdin-upload
|
|
|
|
|
.PHONY: i18n-generate-and-upload
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# -- Mail generator
|
|
|
|
|
|
|
|
|
|
mails-build: ## Convert mjml files to html and text
|
2024-08-06 10:40:28 +02:00
|
|
|
@$(MAIL_NPM) run build
|
2024-01-09 15:30:36 +01:00
|
|
|
.PHONY: mails-build
|
|
|
|
|
|
|
|
|
|
mails-build-html-to-plain-text: ## Convert html files to text
|
2024-08-06 10:40:28 +02:00
|
|
|
@$(MAIL_NPM) run build-html-to-plain-text
|
2024-01-09 15:30:36 +01:00
|
|
|
.PHONY: mails-build-html-to-plain-text
|
|
|
|
|
|
|
|
|
|
mails-build-mjml-to-html: ## Convert mjml files to html and text
|
2024-08-06 10:40:28 +02:00
|
|
|
@$(MAIL_NPM) run build-mjml-to-html
|
2024-01-09 15:30:36 +01:00
|
|
|
.PHONY: mails-build-mjml-to-html
|
|
|
|
|
|
|
|
|
|
mails-install: ## install the mail generator
|
2024-08-06 10:40:28 +02:00
|
|
|
@$(MAIL_NPM) install
|
2024-01-09 15:30:36 +01:00
|
|
|
.PHONY: mails-install
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# -- Misc
|
|
|
|
|
clean: ## restore repository state as it was freshly cloned
|
|
|
|
|
git clean -idx
|
|
|
|
|
.PHONY: clean
|
|
|
|
|
|
|
|
|
|
help:
|
2024-07-01 18:10:40 +02:00
|
|
|
@echo "$(BOLD)Meet Makefile"
|
2024-01-09 15:30:36 +01:00
|
|
|
@echo "Please use 'make $(BOLD)target$(RESET)' where $(BOLD)target$(RESET) is one of:"
|
|
|
|
|
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(firstword $(MAKEFILE_LIST)) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "$(GREEN)%-30s$(RESET) %s\n", $$1, $$2}'
|
|
|
|
|
.PHONY: help
|
|
|
|
|
|
2024-07-19 12:27:51 +02:00
|
|
|
frontend-i18n-extract: ## Check the frontend code and generate missing translations keys in translation files
|
|
|
|
|
cd $(PATH_FRONT) && npm run i18n:extract
|
2024-01-09 15:30:36 +01:00
|
|
|
.PHONY: frontend-i18n-extract
|
|
|
|
|
|
2024-07-03 18:30:25 +02:00
|
|
|
frontend-i18n-generate: ## Generate the frontend json files used for Crowdin
|
2024-01-09 15:30:36 +01:00
|
|
|
frontend-i18n-generate: \
|
|
|
|
|
crowdin-download-sources \
|
|
|
|
|
frontend-i18n-extract
|
|
|
|
|
.PHONY: frontend-i18n-generate
|
|
|
|
|
|
|
|
|
|
# -- K8S
|
|
|
|
|
build-k8s-cluster: ## build the kubernetes cluster using kind
|
|
|
|
|
./bin/start-kind.sh
|
|
|
|
|
.PHONY: build-k8s-cluster
|
|
|
|
|
|
2025-01-13 11:48:47 +01:00
|
|
|
install-external-secrets: ## install the kubernetes secrets from Vaultwarden
|
|
|
|
|
./bin/install-external-secrets.sh
|
2024-12-20 14:07:01 +01:00
|
|
|
.PHONY: build-k8s-cluster
|
|
|
|
|
|
2024-01-09 15:30:36 +01:00
|
|
|
start-tilt: ## start the kubernetes cluster using kind
|
|
|
|
|
tilt up -f ./bin/Tiltfile
|
|
|
|
|
.PHONY: build-k8s-cluster
|
|
|
|
|
|
2024-12-06 12:18:51 +01:00
|
|
|
start-tilt-keycloak: ## start the kubernetes cluster using kind, without Pro Connect for authentication, use keycloak
|
|
|
|
|
DEV_ENV=dev-keycloak tilt up -f ./bin/Tiltfile
|
|
|
|
|
.PHONY: build-k8s-cluster
|
2025-06-26 19:17:25 +02:00
|
|
|
|
|
|
|
|
start-tilt-dinum: ## start the kubernetes cluster using kind, without Pro Connect for authentication, but with DINUM styles
|
|
|
|
|
DEV_ENV=dev-dinum tilt up -f ./bin/Tiltfile
|
|
|
|
|
.PHONY: build-k8s-cluster
|