Files
kontextwerk/Makefile
2025-10-02 08:54:03 +02:00

79 lines
3.6 KiB
Makefile

DOCKER_COMPOSE=docker compose -f docker-compose-local.yml
DOCKER_COMPOSE_PLAYWRIGHT = docker-compose -f docker-compose-playwright.yml
.DEFAULT_GOAL := help
.PHONY: docker-up docker-up-tibi-dev docker-start docker-start-tibi-dev docker-down docker-ps docker-logs yarn-upgrade fix-permissions
include ./.env
help: ## show this help
@echo MAKE TARGETS
@grep -h -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
docker-up: ## bring docker compose stack up in background
$(DOCKER_COMPOSE) --profile tibi up -d
docker-up-tibi-dev: ## bring docker compose stack up in background with tibi-dev
$(DOCKER_COMPOSE) --profile tibi-dev up -d
docker-up-chisel: ## bring up chisel tunnel
$(DOCKER_COMPOSE) --profile chisel up -d
docker-down: ## take docker compose stack down
$(DOCKER_COMPOSE) --profile tibi-dev --profile tibi --profile chisel down
docker-start: ## start docker compose stack in foreground and take it down after CTRL-C
$(DOCKER_COMPOSE) --profile tibi up; $(DOCKER_COMPOSE) --profile tibi-dev --profile tibi --profile chisel down
docker-start-tibi-dev: ## start docker compose stack in foreground and take it down after CTRL-C (with tibi-dev)
$(DOCKER_COMPOSE) --profile tibi-dev up; $(DOCKER_COMPOSE) --profile tibi-dev --profile tibi --profile chisel down
docker-ps: ## show container state
$(DOCKER_COMPOSE) --profile tibi-dev --profile tibi --profile chisel ps
docker-logs: ## show docker logs and follow
$(DOCKER_COMPOSE) --profile tibi-dev --profile tibi --profile chisel logs -f --tail=100 || true
docker-pull: ## pull docker images
$(DOCKER_COMPOSE) --profile tibi-dev --profile tibi --profile chisel pull
docker-%:
$(DOCKER_COMPOSE) $*
yarn-upgrade: ## interactive yarn upgrade
$(DOCKER_COMPOSE) run --rm yarnstart yarn upgrade-interactive
$(DOCKER_COMPOSE) restart yarnstart
fix-permissions: ## set files/directories owner to UID:GID from .env
sudo chown -R $(CODER_UID):$(CODER_GID) ./
playwright-run-ui: ## run playwright tests in cli
BROWSER=chromium CURRENT_UID=$(CODER_UID):$(CODER_GID) PY_MODE='' PY_SPECFLAG='tests/ui/**/*.spec.js' $(DOCKER_COMPOSE_PLAYWRIGHT) up --exit-code-from=playwright; $(DOCKER_COMPOSE_PLAYWRIGHT) down
playwright-open-ui: ## open playwright tests via remote X
BROWSER=chromium CURRENT_UID=$(CODER_UID):$(CODER_GID) PY_MODE='--ui' PY_SPECFLAG='' $(DOCKER_COMPOSE_PLAYWRIGHT) --profile vnc up --exit-code-from=playwright; $(DOCKER_COMPOSE_PLAYWRIGHT) --profile vnc down
playwright-run-api: ## run playwright tests in cli
BROWSER=chromium CURRENT_UID=$(CODER_UID):$(CODER_GID) PY_MODE='' PY_SPECFLAG='tests/api/**/*.spec.js' $(DOCKER_COMPOSE_PLAYWRIGHT) up --exit-code-from=playwright; $(DOCKER_COMPOSE_PLAYWRIGHT) down
playwright-open-api: ## open playwright tests via remote X
BROWSER=chromium CURRENT_UID=$(CODER_UID):$(CODER_GID) PY_MODE='--ui' PY_SPECFLAG='' $(DOCKER_COMPOSE_PLAYWRIGHT) --profile vnc up --exit-code-from=playwright; $(DOCKER_COMPOSE_PLAYWRIGHT) --profile vnc down
docker-down-playwright: ## take docker compose stack down
$(DOCKER_COMPOSE_PLAYWRIGHT) --profile tibi-dev --profile tibi --profile chisel down
mongo-sync-master-to-local: ## sync mongo from master to local
$(DOCKER_COMPOSE) up mongo -d
read -s -p "Enter chisel password: " CHISEL_PASSWORD; \
chisel client --auth coder:$$CHISEL_PASSWORD http://dock4.basehosts.de:10987 27017:mongo:27017 &
sleep 3
mongodump --archive --gzip --db=wmbasic_bkdf_tibi_2024 | $(DOCKER_COMPOSE) exec -T mongo mongorestore --archive --gzip --nsFrom='wmbasic_bkdf_tibi_2024.*' --nsTo='bkdf_tibi_2024_bkdf_tibi_2024.*' --nsInclude='wmbasic_bkdf_tibi_2024.*' --drop
sleep 3
killall chisel