From 65f86a8156b818d99e6c98661a0da4bf0bb41e95 Mon Sep 17 00:00:00 2001 From: Asai Neko Date: Thu, 29 Jan 2026 11:48:54 +0800 Subject: [PATCH] Set test env files Signed-off-by: Asai Neko --- Caddyfile | 9 +++ conpose.yaml | 98 ++++++++++++++++++++++++++++++ container/client-cms.Containerfile | 2 +- 3 files changed, 108 insertions(+), 1 deletion(-) create mode 100644 Caddyfile create mode 100644 conpose.yaml diff --git a/Caddyfile b/Caddyfile new file mode 100644 index 0000000..3e7a53c --- /dev/null +++ b/Caddyfile @@ -0,0 +1,9 @@ +test.nix.org.cn { + handle_path /* { + reverse_proxy client-cms:3000 + } + + handle_path /api/* { + reverse_proxy backend:8000 + } +} diff --git a/conpose.yaml b/conpose.yaml new file mode 100644 index 0000000..e29e998 --- /dev/null +++ b/conpose.yaml @@ -0,0 +1,98 @@ +services: + postgres: + image: docker.io/postgres:18-alpine + container_name: cms-db + environment: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + POSTGRES_DB: postgres + volumes: + - ./data/postgres:/var/lib/postgresql/data + healthcheck: + test: ["CMD-SHELL", "pg_isready -U postgres -d postgres"] + interval: 5s + timeout: 5s + retries: 5 + + redis: + image: docker.io/redis:8-alpine + container_name: cms-redis + volumes: + - ./data/redis:/data + healthcheck: + test: ["CMD-SHELL", "redis-cli ping | grep PONG"] + interval: 5s + timeout: 3s + retries: 5 + + meilisearch: + image: getmeili/meilisearch:v1.34.3 + container_name: cms-search + environment: + - MEILI_MASTER_KEY=your_master_key + volumes: + - ./data/meilisearch:/meili_data + healthcheck: + test: + ["CMD-SHELL", "curl -f http://localhost:7700/health || exit 1"] + interval: 5s + timeout: 3s + retries: 10 + + lgtm: + image: grafana/otel-lgtm:latest + container_name: lgtm-stack + ports: + - "3000:3000" + - "4317:4317" # OTLP gRPC + - "4318:4318" # OTLP HTTP + volumes: + - ./data/lgtm:/data + healthcheck: + test: + [ + "CMD-SHELL", + "curl -f http://localhost:3000/api/health || exit 1", + ] + interval: 10s + timeout: 5s + retries: 5 + + caddy: + image: docker.io/caddy:latest + container_name: caddy-proxy + restart: always + ports: + - "80:80" + - "443:443" + volumes: + - ./Caddyfile:/etc/caddy/Caddyfile + - ./data/caddy/data:/data + - ./data/caddy/config:/config + depends_on: + - backend + - client-cms + + client-cms: + image: registry.asnk.io/nixcn-cms/client-cms:dev + container_name: cms-client + restart: always + depends_on: + lgtm: + condition: service_healthy + + backend: + image: registry.asnk.io/nixcn-cms/backend:dev + container_name: cms-backend + restart: always + volumes: + - ./config.yaml:/app/config.yaml:ro + depends_on: + postgres: + condition: service_healthy + redis: + condition: service_healthy + meilisearch: + condition: service_healthy + lgtm: + condition: service_healthy diff --git a/container/client-cms.Containerfile b/container/client-cms.Containerfile index 76a8860..48eec67 100644 --- a/container/client-cms.Containerfile +++ b/container/client-cms.Containerfile @@ -3,7 +3,7 @@ RUN apk add just RUN npm install -g corepack && \ corepack enable WORKDIR /app -ENV VITE_APP_BASE_URL=$CLIENT_BASE_URL +ENV VITE_APP_BASE_URL=$VITE_APP_BASE_URL COPY . . RUN cd client/cms && pnpm install RUN cd client/cms && pnpm run build --outDir /app/.outputs/client/cms/dist