feat: add logging config generator script (refs #81)
All checks were successful
Deploy to Staging / Build Images (pull_request) Successful in 3m41s
Deploy to Staging / Deploy to Staging (pull_request) Successful in 31s
Deploy to Staging / Verify Staging (pull_request) Successful in 2m19s
Deploy to Staging / Notify Staging Ready (pull_request) Successful in 7s
Deploy to Staging / Notify Staging Failure (pull_request) Has been skipped
All checks were successful
Deploy to Staging / Build Images (pull_request) Successful in 3m41s
Deploy to Staging / Deploy to Staging (pull_request) Successful in 31s
Deploy to Staging / Verify Staging (pull_request) Successful in 2m19s
Deploy to Staging / Notify Staging Ready (pull_request) Successful in 7s
Deploy to Staging / Notify Staging Failure (pull_request) Has been skipped
Create generate-log-config.sh that maps a single LOG_LEVEL env var to per-container settings for Backend, Frontend, PostgreSQL, Redis, and Traefik. Script validates input and generates .env.logging file. Integrate script into staging and production CI/CD pipelines. Remove obsolete SPRINTS.md calendar file. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,36 +0,0 @@
|
||||
# SPRINTS.md — MotoVaultPro Sprint Calendar (2026)
|
||||
|
||||
**Cadence:** 2 weeks (14 days)
|
||||
**Sprint weeks:** Monday → Sunday
|
||||
**Naming convention:** `Sprint YYYY-MM-DD` (the Monday start date)
|
||||
|
||||
> Note: Sprint 26 ends on **2027-01-03** (it crosses into the next year).
|
||||
|
||||
| # | Sprint | Start (Mon) | End (Sun) |
|
||||
|---:|---|---|---|
|
||||
| 1 | Sprint 2026-01-05 | 2026-01-05 | 2026-01-18 |
|
||||
| 2 | Sprint 2026-01-19 | 2026-01-19 | 2026-02-01 |
|
||||
| 3 | Sprint 2026-02-02 | 2026-02-02 | 2026-02-15 |
|
||||
| 4 | Sprint 2026-02-16 | 2026-02-16 | 2026-03-01 |
|
||||
| 5 | Sprint 2026-03-02 | 2026-03-02 | 2026-03-15 |
|
||||
| 6 | Sprint 2026-03-16 | 2026-03-16 | 2026-03-29 |
|
||||
| 7 | Sprint 2026-03-30 | 2026-03-30 | 2026-04-12 |
|
||||
| 8 | Sprint 2026-04-13 | 2026-04-13 | 2026-04-26 |
|
||||
| 9 | Sprint 2026-04-27 | 2026-04-27 | 2026-05-10 |
|
||||
| 10 | Sprint 2026-05-11 | 2026-05-11 | 2026-05-24 |
|
||||
| 11 | Sprint 2026-05-25 | 2026-05-25 | 2026-06-07 |
|
||||
| 12 | Sprint 2026-06-08 | 2026-06-08 | 2026-06-21 |
|
||||
| 13 | Sprint 2026-06-22 | 2026-06-22 | 2026-07-05 |
|
||||
| 14 | Sprint 2026-07-06 | 2026-07-06 | 2026-07-19 |
|
||||
| 15 | Sprint 2026-07-20 | 2026-07-20 | 2026-08-02 |
|
||||
| 16 | Sprint 2026-08-03 | 2026-08-03 | 2026-08-16 |
|
||||
| 17 | Sprint 2026-08-17 | 2026-08-17 | 2026-08-30 |
|
||||
| 18 | Sprint 2026-08-31 | 2026-08-31 | 2026-09-13 |
|
||||
| 19 | Sprint 2026-09-14 | 2026-09-14 | 2026-09-27 |
|
||||
| 20 | Sprint 2026-09-28 | 2026-09-28 | 2026-10-11 |
|
||||
| 21 | Sprint 2026-10-12 | 2026-10-12 | 2026-10-25 |
|
||||
| 22 | Sprint 2026-10-26 | 2026-10-26 | 2026-11-08 |
|
||||
| 23 | Sprint 2026-11-09 | 2026-11-09 | 2026-11-22 |
|
||||
| 24 | Sprint 2026-11-23 | 2026-11-23 | 2026-12-06 |
|
||||
| 25 | Sprint 2026-12-07 | 2026-12-07 | 2026-12-20 |
|
||||
| 26 | Sprint 2026-12-21 | 2026-12-21 | 2027-01-03 |
|
||||
@@ -22,6 +22,7 @@ env:
|
||||
COMPOSE_FILE: docker-compose.yml
|
||||
COMPOSE_BLUE_GREEN: docker-compose.blue-green.yml
|
||||
HEALTH_CHECK_TIMEOUT: "60"
|
||||
LOG_LEVEL: INFO
|
||||
|
||||
jobs:
|
||||
# ============================================
|
||||
@@ -105,6 +106,12 @@ jobs:
|
||||
cp "$GITHUB_WORKSPACE/docker-compose.yml" "$DEPLOY_PATH/"
|
||||
cp "$GITHUB_WORKSPACE/docker-compose.blue-green.yml" "$DEPLOY_PATH/"
|
||||
|
||||
- name: Generate logging configuration
|
||||
run: |
|
||||
cd "$DEPLOY_PATH"
|
||||
chmod +x scripts/ci/generate-log-config.sh
|
||||
./scripts/ci/generate-log-config.sh "$LOG_LEVEL"
|
||||
|
||||
- name: Login to registry
|
||||
run: |
|
||||
echo "${{ secrets.REGISTRY_PASSWORD }}" | docker login -u "${{ secrets.REGISTRY_USER }}" --password-stdin "$REGISTRY"
|
||||
|
||||
@@ -18,6 +18,7 @@ env:
|
||||
COMPOSE_FILE: docker-compose.yml
|
||||
COMPOSE_STAGING: docker-compose.staging.yml
|
||||
HEALTH_CHECK_TIMEOUT: "60"
|
||||
LOG_LEVEL: INFO
|
||||
|
||||
jobs:
|
||||
# ============================================
|
||||
@@ -117,6 +118,12 @@ jobs:
|
||||
cp "$GITHUB_WORKSPACE/docker-compose.yml" "$DEPLOY_PATH/"
|
||||
cp "$GITHUB_WORKSPACE/docker-compose.staging.yml" "$DEPLOY_PATH/"
|
||||
|
||||
- name: Generate logging configuration
|
||||
run: |
|
||||
cd "$DEPLOY_PATH"
|
||||
chmod +x scripts/ci/generate-log-config.sh
|
||||
./scripts/ci/generate-log-config.sh "$LOG_LEVEL"
|
||||
|
||||
- name: Login to registry
|
||||
run: |
|
||||
echo "${{ secrets.REGISTRY_PASSWORD }}" | docker login -u "${{ secrets.REGISTRY_USER }}" --password-stdin "$REGISTRY"
|
||||
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -2,6 +2,7 @@ node_modules/
|
||||
.env
|
||||
.env.local
|
||||
.env.backup
|
||||
.env.logging
|
||||
dist/
|
||||
*.log
|
||||
.DS_Store
|
||||
|
||||
69
scripts/ci/generate-log-config.sh
Executable file
69
scripts/ci/generate-log-config.sh
Executable file
@@ -0,0 +1,69 @@
|
||||
#!/bin/bash
|
||||
# generate-log-config.sh - Generate .env.logging from LOG_LEVEL
|
||||
# Maps a single LOG_LEVEL environment variable to per-container settings
|
||||
#
|
||||
# Usage: ./generate-log-config.sh [LOG_LEVEL]
|
||||
# LOG_LEVEL: DEBUG, INFO, WARN, or ERROR (default: INFO)
|
||||
#
|
||||
# Output: Creates .env.logging file with container-specific log settings
|
||||
#
|
||||
# Exit codes:
|
||||
# 0 - Configuration generated successfully
|
||||
# 1 - Invalid LOG_LEVEL provided
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
LOG_LEVEL="${1:-INFO}"
|
||||
|
||||
# Validate input
|
||||
case "$LOG_LEVEL" in
|
||||
DEBUG|INFO|WARN|ERROR) ;;
|
||||
*)
|
||||
echo "Error: Invalid LOG_LEVEL '$LOG_LEVEL'. Must be DEBUG, INFO, WARN, or ERROR." >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# Convert to lowercase for services that need it
|
||||
LOG_LEVEL_LOWER=$(echo "$LOG_LEVEL" | tr '[:upper:]' '[:lower:]')
|
||||
|
||||
# Map PostgreSQL log settings based on level
|
||||
case "$LOG_LEVEL" in
|
||||
DEBUG) POSTGRES_LOG_STATEMENT="all"; POSTGRES_LOG_MIN_DURATION="0" ;;
|
||||
INFO) POSTGRES_LOG_STATEMENT="ddl"; POSTGRES_LOG_MIN_DURATION="500" ;;
|
||||
WARN) POSTGRES_LOG_STATEMENT="none"; POSTGRES_LOG_MIN_DURATION="1000" ;;
|
||||
ERROR) POSTGRES_LOG_STATEMENT="none"; POSTGRES_LOG_MIN_DURATION="-1" ;;
|
||||
esac
|
||||
|
||||
# Map Redis log level
|
||||
case "$LOG_LEVEL" in
|
||||
DEBUG) REDIS_LOGLEVEL="debug" ;;
|
||||
INFO) REDIS_LOGLEVEL="verbose" ;;
|
||||
WARN) REDIS_LOGLEVEL="notice" ;;
|
||||
ERROR) REDIS_LOGLEVEL="warning" ;;
|
||||
esac
|
||||
|
||||
# Generate .env.logging file
|
||||
cat > .env.logging << EOF
|
||||
# Generated by generate-log-config.sh - DO NOT EDIT MANUALLY
|
||||
# Regenerate with: ./scripts/ci/generate-log-config.sh $LOG_LEVEL
|
||||
LOG_LEVEL=$LOG_LEVEL
|
||||
|
||||
# Backend/OCR (Pino)
|
||||
BACKEND_LOG_LEVEL=$LOG_LEVEL_LOWER
|
||||
|
||||
# Frontend (Vite)
|
||||
VITE_LOG_LEVEL=$LOG_LEVEL_LOWER
|
||||
|
||||
# PostgreSQL
|
||||
POSTGRES_LOG_STATEMENT=$POSTGRES_LOG_STATEMENT
|
||||
POSTGRES_LOG_MIN_DURATION=$POSTGRES_LOG_MIN_DURATION
|
||||
|
||||
# Redis
|
||||
REDIS_LOGLEVEL=$REDIS_LOGLEVEL
|
||||
|
||||
# Traefik
|
||||
TRAEFIK_LOG_LEVEL=$LOG_LEVEL
|
||||
EOF
|
||||
|
||||
echo "Generated .env.logging with LOG_LEVEL=$LOG_LEVEL"
|
||||
Reference in New Issue
Block a user