synor/docs/PLAN/PHASE9-SynorHosting/01-Milestone-02-HostingGateway.md
Gulshan Yadav c829362729 feat(cli): add deploy command for Synor Hosting
Add `synor deploy` command group for deploying web applications:
- `synor deploy push` - upload project to Synor Hosting
- `synor deploy init` - create synor.json configuration
- `synor deploy list` - list all deployments
- `synor deploy delete` - remove a deployment

Features:
- synor.json configuration parsing with build/routes/headers
- Framework auto-detection (Next.js, Vite, Astro, Angular, SvelteKit)
- Build command execution with install support
- Multipart file upload to storage gateway
- Deployment name validation with reserved word protection
- Content type detection for 20+ MIME types

Also adds Phase 9 milestone documentation and marks Synor Hosting
as 100% complete in the roadmap.
2026-01-10 12:59:35 +05:30

66 lines
1.8 KiB
Markdown

# Milestone 02: Hosting Gateway
> HTTP gateway server for serving hosted web applications
## Status: Complete
## Tasks
- [x] Create HostingGateway server with Axum
- [x] Implement request handler with host-based routing
- [x] Implement content fetching from Synor Storage
- [x] Add content type detection (20+ MIME types)
- [x] Implement RateLimiter with token bucket algorithm
- [x] Add CacheControl middleware for immutable assets
- [x] Create SSL configuration structure
- [x] Create hosting-gateway binary
- [x] Create Docker configuration (Dockerfile + Caddy)
- [x] Create docker-compose.hosting.yml
- [x] Add comprehensive test coverage (37 tests total)
## Files
```
crates/synor-hosting/src/
├── server/
│ ├── mod.rs # HostingGateway, GatewayConfig
│ ├── handler.rs # Request routing, content fetching
│ ├── middleware.rs # RateLimiter, CacheControl
│ └── ssl.rs # SSL configuration
├── bin/
│ └── hosting-gateway.rs
docker/hosting-gateway/
├── Dockerfile # Multi-stage Rust build
└── Caddyfile # Wildcard HTTPS for *.synor.cc
docker-compose.hosting.yml
```
## Key Components
- `HostingGateway`: Main HTTP server using Axum
- `GatewayConfig`: Configuration (listen addr, domain, storage URL, rate limit)
- `RateLimiter`: Token bucket rate limiting per client IP
- `CacheControl`: Immutable asset detection for optimal caching
- Caddy reverse proxy with automatic Let's Encrypt HTTPS
## Architecture
```
Internet → Caddy (HTTPS) → HostingGateway → Storage Gateway → Storage Nodes
*.synor.cc wildcard cert
```
## Validation Commands
```bash
cargo test -p synor-hosting
cargo build -p synor-hosting --features server
docker-compose -f docker-compose.hosting.yml build
```
---
*Completed: January 2026*