forked from aegis/pyserveX
150 lines
2.6 KiB
Markdown
150 lines
2.6 KiB
Markdown
# Konduktor (Go)
|
|
|
|
High-performance HTTP web server with extensible routing and process orchestration. (Previously known as PyServe in Python)
|
|
|
|
## Project Structure
|
|
|
|
```
|
|
go/
|
|
├── cmd/
|
|
│ ├── konduktor/ # Main server binary
|
|
│ └── konduktorctl/ # CLI management tool
|
|
├── internal/
|
|
│ ├── config/ # Configuration management
|
|
│ ├── logging/ # Structured logging
|
|
│ ├── middleware/ # HTTP middleware
|
|
│ ├── routing/ # HTTP routing
|
|
│ ├── extensions/ # Extension system (TODO)
|
|
│ └── process/ # Process management (TODO)
|
|
├── pkg/ # Public packages (TODO)
|
|
├── go.mod
|
|
├── go.sum
|
|
└── Makefile
|
|
```
|
|
|
|
## Building
|
|
|
|
```bash
|
|
cd go
|
|
|
|
# Download dependencies
|
|
make deps
|
|
|
|
# Build all binaries
|
|
make build
|
|
|
|
# Or build individually
|
|
make build-konduktor
|
|
make build-konduktorctl
|
|
```
|
|
|
|
## Running
|
|
|
|
```bash
|
|
# Run with default config
|
|
./bin/konduktor
|
|
|
|
# Run with custom config
|
|
./bin/konduktor -c ../config.yaml
|
|
|
|
# Run with flags
|
|
./bin/konduktor --host 127.0.0.1 --port 3000 --debug
|
|
```
|
|
|
|
## CLI Commands (konduktorctl)
|
|
|
|
```bash
|
|
# Start services
|
|
konduktorctl up
|
|
|
|
# Stop services
|
|
konduktorctl down
|
|
|
|
# View status
|
|
konduktorctl status
|
|
|
|
# View logs
|
|
konduktorctl logs -f
|
|
|
|
# Health check
|
|
konduktorctl health
|
|
|
|
# Scale services
|
|
konduktorctl scale api=3
|
|
|
|
# Configuration management
|
|
konduktorctl config show
|
|
konduktorctl config validate
|
|
|
|
# Initialize new project
|
|
konduktorctl init
|
|
```
|
|
|
|
## Configuration
|
|
|
|
Uses the same YAML configuration format as the Python version:
|
|
|
|
```yaml
|
|
server:
|
|
host: 0.0.0.0
|
|
port: 8080
|
|
|
|
http:
|
|
static_dir: ./static
|
|
templates_dir: ./templates
|
|
|
|
ssl:
|
|
enabled: false
|
|
cert_file: ./ssl/cert.pem
|
|
key_file: ./ssl/key.pem
|
|
|
|
logging:
|
|
level: INFO
|
|
console_output: true
|
|
|
|
extensions:
|
|
- type: routing
|
|
config:
|
|
regex_locations:
|
|
"=/health":
|
|
return: "200 OK"
|
|
```
|
|
|
|
## Development
|
|
|
|
```bash
|
|
# Format code
|
|
make fmt
|
|
|
|
# Run linter
|
|
make lint
|
|
|
|
# Run tests
|
|
make test
|
|
|
|
# Run with coverage
|
|
make test-coverage
|
|
```
|
|
|
|
## Migration from Python
|
|
|
|
This is a gradual rewrite of PyServe to Go. The project is now called **Konduktor**.
|
|
|
|
### Completed
|
|
- [x] Basic project structure
|
|
- [x] Configuration loading
|
|
- [x] HTTP server with graceful shutdown
|
|
- [x] Basic routing
|
|
- [x] Middleware (access log, recovery, server header)
|
|
- [x] CLI structure (konduktor, konduktorctl)
|
|
|
|
### TODO
|
|
- [ ] Extension system
|
|
- [x] Regex routing
|
|
- [x] Reverse proxy
|
|
- [ ] Process orchestration
|
|
- [ ] ASGI/WSGI adapter support
|
|
- [ ] WebSocket support
|
|
- [ ] Hot reload
|
|
- [ ] Metrics and monitoring
|