- Add Caddy client package (client.go) with Load/GetConfig/Ping methods - Implement config generator (config.go) transforming ProxyHost → Caddy JSON - Add pre-flight validator (validator.go) catching config errors before reload - Create manager (manager.go) with rollback capability using config snapshots - Add CaddyConfig model for audit trail of configuration changes - Update Config to include Caddy admin API and config dir settings - Create comprehensive unit tests with 100% coverage for caddy package Docker Infrastructure: - Add docker-compose.yml with Caddy sidecar container - Add docker-compose.dev.yml for development overrides - Create .github/workflows/docker-publish.yml for GHCR publishing - Update CI to build Docker images and run integration tests - Add DOCKER.md with comprehensive deployment guide - Update Makefile with docker-compose commands - Update README with Docker-first deployment instructions Configuration: - Add CPM_CADDY_ADMIN_API and CPM_CADDY_CONFIG_DIR env vars - Update .env.example with new Caddy settings - Update AutoMigrate to include CaddyConfig model All acceptance criteria met: ✅ Can programmatically generate valid Caddy JSON configs ✅ Can reload Caddy configuration via admin API ✅ Invalid configs caught by validator before reload ✅ Automatic rollback on failure via snapshot system
15 lines
363 B
Go
15 lines
363 B
Go
package models
|
|
|
|
import (
|
|
"time"
|
|
)
|
|
|
|
// CaddyConfig stores an audit trail of Caddy configuration changes.
|
|
type CaddyConfig struct {
|
|
ID uint `json:"id" gorm:"primaryKey"`
|
|
ConfigHash string `json:"config_hash" gorm:"index"`
|
|
AppliedAt time.Time `json:"applied_at"`
|
|
Success bool `json:"success"`
|
|
ErrorMsg string `json:"error_msg"`
|
|
}
|