feat: add Copilot instructions and enhance Docker Compose configuration for improved routing

This commit is contained in:
2025-10-30 08:14:44 +00:00
parent 4756eab175
commit 1ae34d6a18
3 changed files with 43 additions and 3 deletions

25
.github/copilot-instructions.md vendored Normal file
View File

@@ -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

View File

@@ -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

View File

@@ -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: