Files
BrunoGaoSZandClaude Sonnet 4.5 01ed91ba8d feat: add K3s quick deployment with local AMD64 build
This commit adds a complete quick deployment workflow for ljwx-health
to K3s clusters, with local AMD64 image builds and Harbor registry support.

## Core Features

### Build & Deploy Scripts
- **scripts/quick-deploy.sh**: Unified build-push-deploy script
  - Builds AMD64 images locally
  - Pushes to Harbor (harbor.eu.lingjingwanxiang.cn)
  - Deploys to K3s (ljwx-health namespace)
  - Supports --skip-build, --build-only options
  - Auto-handles KUBECONFIG for K3s
- **scripts/organize-migrations.sh**: Flyway migration organizer
  - Consolidates database/migrations/* to Flyway standard location
  - Removes duplicates (_fixed, _v2 variants)
  - Applies semantic versioning (V1.0.x__description.sql)

### Helm Chart & Deployment
- **deploy/helm/ljwx-health/**: Complete Helm chart
  - ljwx-boot (Spring Boot backend)
  - ljwx-admin (Vue3 frontend)
  - Supports imagePullSecrets for Harbor
  - Health probes (liveness/readiness)
  - Prometheus metrics annotations
- **deploy/environments/k3s-eu.yaml**: K3s EU environment config
  - Reuses infra namespace MySQL/Redis
  - Built-in Flyway (disabled standalone migration job)
  - OTel tracing to Tempo

### Database Migrations (Flyway)
- **17 migration scripts** organized under `ljwx-boot/src/main/resources/db/migration/`
- Application-integrated Flyway (Spring Boot startup)
- Baseline-on-migrate enabled for existing databases
- Covers: weight cache, health baseline, message v2, alerts, geofencing, etc.

### Documentation
- **deploy/QUICK_DEPLOY.md**: Comprehensive deployment guide
  - Quick start (one-liner)
  - Common scenarios (build-only, deploy-only, version pinning)
  - Troubleshooting (image pull, Flyway, KUBECONFIG)
- **PROMPT_BLUEPRINT.md**: Engineering standards blueprint
  - OpenAPI-first development
  - GitOps with Argo CD
  - Expand/Contract migration pattern
  - Observability requirements (Logs/Traces/Metrics)

## Technical Stack Compliance

- **CI/CD**: GitHub Actions (multi-arch builds retained)
- **GitOps**: Helm-based (Argo CD compatible)
- **Database**: Postgres → MySQL (infra namespace reuse)
- **Observability**: Logback JSON, Tempo tracing, Prometheus metrics
- **Migration**: Flyway (embedded in Spring Boot)

## Breaking Changes
None. This is an additive feature for K3s deployments.

## Migration Notes
- Flyway migration job disabled by default (use Spring Boot built-in)
- ConfigMap-based migrations replaced with image-bundled scripts
- Requires harbor-secret in ljwx-health namespace

## Usage

```bash
# First time setup
./scripts/create-k3s-secrets.sh

# Full deployment
./scripts/quick-deploy.sh

# Rebuild and deploy
VERSION=v1.0.7 ./scripts/quick-deploy.sh

# Deploy only (skip build)
VERSION=dev-latest ./scripts/quick-deploy.sh --skip-build
```

## Testing
- ✅ Local AMD64 builds (ljwx-boot + ljwx-admin)
- ✅ Harbor image push
- ✅ Flyway migration script organization (17 scripts)
- ⚠️  K3s deployment pending (ImagePullSecrets configuration in progress)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
2025-12-21 08:48:52 +01:00
..