From 1ae34d6a18c353ea8ce9b0d9ada3a5b41f663139 Mon Sep 17 00:00:00 2001 From: Sebastian Frank Date: Thu, 30 Oct 2025 08:14:44 +0000 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat:=20add=20Copilot=20instruction?= =?UTF-8?q?s=20and=20enhance=20Docker=20Compose=20configuration=20for=20im?= =?UTF-8?q?proved=20routing?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/copilot-instructions.md | 25 +++++++++++++++++++++++++ Makefile | 8 +++++++- docker-compose-local.yml | 13 +++++++++++-- 3 files changed, 43 insertions(+), 3 deletions(-) create mode 100644 .github/copilot-instructions.md diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md new file mode 100644 index 0000000..53d8101 --- /dev/null +++ b/.github/copilot-instructions.md @@ -0,0 +1,25 @@ +# Copilot Instructions + +## Common Instructions + +- Look in the problems tab for any errors or warnings in the code +- Follow the existing code style and conventions used in the project +- Write clear and concise comments where necessary to explain complex logic +- Ensure code is modular and reusable where possible +- Write unit tests for new functionality and ensure existing tests pass, but only if there is a configured testing framework +- Avoid introducing new dependencies unless absolutely necessary, but ask the user if there is a specific library they want to use +- If you are unsure about any requirements or details, ask the user for clarification before proceeding +- Respect a11y and localization best practices if applicable, optimize for WCAG AA standards + +## Toolchain + +- See .env in root for project specific environment variables +- See Makefile for starting up the development environment with Docker +- If development environment is running, access the website at: https://${PROJECT_NAME}.code.testversion.online/ or ask the user for the correct URL +- You can also use Browser MCP, so ask user to connect if needed +- Esbuild is used, watching for changes in files to rebuild automatically +- To force a restart of the frontend build and dev-server run: `make restart-frontend` +- Backend is tibi-server configured in /api/ folder and also restarted if changes are detected in this folder +- To show last X lines of docker logs run: `make docker-logs-X` where X is the number + of lines you want to see +- For a11y testing use the MCP a11y tools if available diff --git a/Makefile b/Makefile index 86b4f40..5be43f8 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ DOCKER_COMPOSE=docker compose -f docker-compose-local.yml .DEFAULT_GOAL := help -.PHONY: init docker-up docker-up-tibi-dev docker-start docker-start-tibi-dev docker-down docker-ps docker-logs yarn-upgrade fix-permissions +.PHONY: init docker-up docker-restart-frontend docker-up-tibi-dev docker-start docker-start-tibi-dev docker-down docker-ps docker-logs yarn-upgrade fix-permissions mongo-sync-master-to-local media-sync-master-to-local mongo-sync-local-to-staging media-sync-local-to-staging include ./.env @@ -16,6 +16,9 @@ init: ## initialize required directories docker-up: init ## bring docker compose stack up in background $(DOCKER_COMPOSE) --profile tibi up -d +docker-restart-frontend: ## restart frontend build and dev-server + $(DOCKER_COMPOSE) restart yarnstart + docker-up-tibi-dev: init ## bring docker compose stack up in background with tibi-dev $(DOCKER_COMPOSE) --profile tibi-dev up -d @@ -37,6 +40,9 @@ docker-ps: ## show container state docker-logs: ## show docker logs and follow $(DOCKER_COMPOSE) --profile tibi-dev --profile tibi --profile chisel logs -f --tail=100 || true +docker-logs-%: ## show last X lines of docker logs + $(DOCKER_COMPOSE) --profile tibi-dev --profile tibi --profile chisel logs --tail=$* + docker-pull: ## pull docker images $(DOCKER_COMPOSE) --profile tibi-dev --profile tibi --profile chisel pull diff --git a/docker-compose-local.yml b/docker-compose-local.yml index c47236b..bfc11ee 100644 --- a/docker-compose-local.yml +++ b/docker-compose-local.yml @@ -19,8 +19,17 @@ services: labels: - traefik.enable=true - online.testversion.code.subdomain=${PROJECT_NAME} - - traefik.http.routers.${PROJECT_NAME}-yarnstart.middlewares=${PROJECT_NAME}-yarnstart - - traefik.http.middlewares.${PROJECT_NAME}-yarnstart.basicauth.usersfile=${PWD}/.basic-auth-web + # Create two routers: one without auth for MCP/curl, one with auth for others + # Router 1: MCP/curl access (based on user-agent header) + - traefik.http.routers.${PROJECT_NAME}-yarnstart-mcp.rule=HeadersRegexp(`User-Agent`, `.*(Playwright|puppeteer|Headless|curl).*`) + - traefik.http.routers.${PROJECT_NAME}-yarnstart-mcp.priority=100 + - traefik.http.routers.${PROJECT_NAME}-yarnstart-mcp.service=${PROJECT_NAME}-yarnstart + # Router 2: Regular access with basic auth + - traefik.http.routers.${PROJECT_NAME}-yarnstart.priority=50 + - traefik.http.routers.${PROJECT_NAME}-yarnstart.middlewares=${PROJECT_NAME}-yarnstart-auth + - traefik.http.middlewares.${PROJECT_NAME}-yarnstart-auth.basicauth.usersfile=${PWD}/.basic-auth-web + # Service definition + - traefik.http.services.${PROJECT_NAME}-yarnstart.loadbalancer.server.port=3000 user: ${CODER_UID}:${CODER_GID} tibiserver: