cleanup: remove binaries and build artifacts from git tracking
Remove large files that should not be committed: - insertr binary (19MB) - generated Go executable - test-output/ and client-dist/ - build output directories - demo-site/insertr.js - generated from lib/dist/insertr.js - internal/content/assets/*.js - embedded build artifacts - outdated integration/version control summary files - log files (server.log) Update .gitignore to exclude: - Compiled binaries (insertr, insertr.exe) - Generated assets (demo-site/insertr.js, internal/content/assets/*.js) - Build output directories (test-output/, client-dist/) - Database files (*.db) and log files (*.log) - Air temporary files Repository size reduction: ~20MB+ of unnecessary tracked files removed
This commit is contained in:
122
TODO.md
122
TODO.md
@@ -362,3 +362,125 @@ PUT /api/content/{id}/draft
|
||||
5. **Graceful Degradation**: Fallback to basic editing if draft system fails
|
||||
|
||||
**Note**: Current architecture already supports foundation for all these enhancements through the unified Editor system and API client pattern.
|
||||
|
||||
## 🏗️ **Server-Hosted Static Sites Implementation** (Sept 2025)
|
||||
|
||||
### **✅ COMPLETED: Unified Binary HTTP Server**
|
||||
The HTTP server has been successfully implemented and is production-ready:
|
||||
- ✅ **Full REST API** - All content CRUD operations (`internal/api/handlers.go`)
|
||||
- ✅ **Multi-Database Support** - SQLite + PostgreSQL with sqlc-generated queries
|
||||
- ✅ **Authentication System** - JWT + mock tokens, ready for authentik integration
|
||||
- ✅ **Bulk Operations** - Efficient bulk content retrieval (`injector.go:56-96`)
|
||||
- ✅ **Content Enhancement** - Build-time content injection from database
|
||||
|
||||
### **🎯 NEW PRIORITY: Server-Hosted File Enhancement**
|
||||
|
||||
**Goal**: Enable real-time content updates for server-hosted static sites through database-driven file enhancement.
|
||||
|
||||
**Architecture**: Database as source of truth → Content changes → File updates → Immediate deployment
|
||||
|
||||
### **Phase 1: Core File Enhancement System**
|
||||
- [ ] **Extend enhancer.go** - Add `EnhanceInPlace()` method for in-place file modification
|
||||
- [ ] **Site Manager** - Create registration system for static site paths
|
||||
- [ ] **Handler Integration** - Hook file enhancement into `UpdateContent()` API calls
|
||||
- [ ] **Configuration Extension** - Add sites configuration to `insertr.yaml`
|
||||
|
||||
**Files to modify**:
|
||||
- `internal/content/enhancer.go` - Add in-place enhancement methods
|
||||
- `internal/api/handlers.go:225` - Integrate file enhancement trigger
|
||||
- `insertr.yaml` - Add sites configuration section
|
||||
- `cmd/serve.go` - Initialize site manager in server
|
||||
|
||||
### **Phase 2: Multi-Site Server Management**
|
||||
- [ ] **CLI Site Commands** - `insertr sites register/list/enhance`
|
||||
- [ ] **File Backup System** - Backup original files before enhancement
|
||||
- [ ] **Error Handling** - Graceful file permission and disk space handling
|
||||
- [ ] **Performance Optimization** - Selective file updates, change detection
|
||||
|
||||
### **Phase 3: Production Features**
|
||||
- [ ] **Authentik Integration** - OIDC authentication for production deployment
|
||||
- [ ] **Caddy Integration** - Reverse proxy configuration templates
|
||||
- [ ] **Monitoring & Logging** - Track enhancement operations and errors
|
||||
- [ ] **Multi-Environment** - Development vs production configuration
|
||||
|
||||
### **Implementation Approach: Leverage Existing Architecture**
|
||||
|
||||
**Reuse Existing Components**:
|
||||
- ✅ **Bulk Injection** - `injector.go:56-96` already handles efficient content injection
|
||||
- ✅ **Multi-Site Support** - `siteID` parameter used throughout API and database
|
||||
- ✅ **Authentication** - `auth.go:47-67` supports JWT tokens ready for authentik
|
||||
- ✅ **Content Client Interface** - `types.go:18-28` extensible for new features
|
||||
|
||||
**New Components** (minimal additions):
|
||||
- **Site Manager** - Register static site paths and manage file enhancement
|
||||
- **In-Place Enhancer** - Extend existing enhancer for file modification
|
||||
- **Configuration** - Extend YAML config for site registration
|
||||
|
||||
### **Target Deployment Architecture**
|
||||
```
|
||||
┌─────────────────────────────────────┐
|
||||
│ Caddy Reverse Proxy │
|
||||
├─────────────────┬───────────────────┤
|
||||
│ Static Sites │ Insertr Server │
|
||||
│ /site1/* ────→ │ :8080/api/* │
|
||||
│ /site2/* ────→ │ Authentication │
|
||||
│ /admin/* ────→ │ File Enhancement │
|
||||
└─────────────────┴───────────────────┘
|
||||
│ │
|
||||
▼ ▼
|
||||
┌─────────────┐ ┌─────────────────┐
|
||||
│Static Files │ │ Database + │
|
||||
│/var/www/ │◄───┤ Enhancement │
|
||||
│ site1/ │ │ Engine │
|
||||
│ site2/ │ └─────────────────┘
|
||||
└─────────────┘
|
||||
```
|
||||
|
||||
**Content Update Workflow**:
|
||||
1. Editor makes content change → API call to `/api/content/{id}`
|
||||
2. Content saved to database (source of truth)
|
||||
3. File enhancement triggered → Static files updated in-place
|
||||
4. Changes immediately visible to visitors (served by Caddy)
|
||||
|
||||
### **Future CI/CD Integration Features** (Post-Server Implementation)
|
||||
|
||||
#### **External Build Trigger System**
|
||||
- **Webhook Integration**: Trigger external CI/CD pipelines when content changes
|
||||
- **GitHub Actions Templates**: Pre-built workflows for Hugo, Next.js, Jekyll + Insertr
|
||||
- **Platform Integrations**: Native Netlify, Vercel, CloudFlare Pages integration
|
||||
- **Build Status Tracking**: Monitor external build progress and deployment status
|
||||
|
||||
#### **Hybrid Deployment Models**
|
||||
- **File + Pipeline Mode**: Server-hosted sites with optional CI/CD rebuilds
|
||||
- **Content API Mode**: Headless CMS for external static site generators
|
||||
- **Multi-Environment**: Staging/production deployment coordination
|
||||
- **Build Caching**: Intelligent rebuilds based on content vs template changes
|
||||
|
||||
#### **Advanced Content Workflows**
|
||||
- **Scheduled Publishing**: Time-based content activation
|
||||
- **Content Approval**: Multi-user approval workflows before deployment
|
||||
- **A/B Testing**: Content variations for different user segments
|
||||
- **Rollback Integration**: Coordinate content rollbacks with deployment rollbacks
|
||||
|
||||
### **Draft System Foundation** (Ready for Extension)
|
||||
|
||||
**Current Architecture Supports**:
|
||||
- ✅ **Bulk Operations** - `injector.go:56-96` efficient for batch content updates
|
||||
- ✅ **Version Control** - Full version history with rollback capabilities
|
||||
- ✅ **Content Types** - Extensible type system ready for draft fields
|
||||
|
||||
**Future Draft Features**:
|
||||
- **Server-Side Drafts** - Extend `ContentItem` with `is_draft` field
|
||||
- **Batch Publishing** - Publish multiple draft items simultaneously
|
||||
- **Preview Mode** - View sites with draft content before publishing
|
||||
- **Auto-Save Drafts** - Background saving during editing sessions
|
||||
|
||||
### **Benefits of Server-Hosted Approach**
|
||||
|
||||
1. **✅ Immediate Deployment** - Content changes are live instantly
|
||||
2. **✅ Database Source of Truth** - No git-based workflow complexity
|
||||
3. **✅ Content-Only Updates** - No template rebuilds required
|
||||
4. **✅ Existing Infrastructure** - Leverages Caddy + authentik setup
|
||||
5. **✅ Performance** - Static file serving with dynamic content injection
|
||||
6. **✅ Multi-Site** - Single server manages multiple enhanced sites
|
||||
7. **✅ Zero Downtime** - Updates don't require site rebuilds or deploys
|
||||
|
||||
Reference in New Issue
Block a user