# No as a Service (NaaS) A lightweight, production-ready HTTP service that always says "no" in various formats. ## Features - Minimal dependencies (pure Rust, standard library only) - Multiple response formats (text, JSON, XML, YAML, boolean) - Mobile-responsive web frontend - CORS support - Health check endpoint - Optimized for small binary size (~1MB) - Container-ready with health checks ## API Endpoints - `GET /` - Minimalist web page displaying "No" - `GET /playground` - Interactive API testing playground - `GET /api/no` - Returns plain text "no" - `GET /api/no?format=json` - Returns `{"answer": "no"}` - `GET /api/no?format=bool` - Returns `false` - `GET /api/no?format=xml` - Returns XML response - `GET /api/no?format=yaml` - Returns YAML response - `GET /health` - Health check endpoint ## Quick Start ### Local Development ```bash # Build and run locally cd naas cargo build --release PORT=8080 ./target/release/naas ``` Visit http://localhost:8080 ### Container Deployment with Podman ```bash # Build container cd naas BUILDAH_FORMAT=docker podman build -t naas:latest -f Containerfile . # Run container podman run -d \ --name naas \ -p 8080:8080 \ --restart=always \ naas:latest # Check health curl http://localhost:8080/health ``` ### Systemd Service Deployment 1. **Setup user and directory:** ```bash # Create service user sudo useradd -r -s /bin/false naas # Copy application files sudo mkdir -p /opt/naas sudo cp -r naas/* /opt/naas/ sudo chown -R naas:naas /opt/naas ``` 2. **Install systemd service:** ```bash # Copy service file sudo cp naas/naas.service /etc/systemd/system/ # Reload systemd and start service sudo systemctl daemon-reload sudo systemctl enable naas sudo systemctl start naas # Check status sudo systemctl status naas ``` 3. **View logs:** ```bash sudo journalctl -u naas -f ``` ## Production Deployment to no.donothireus.com ### Caddy Reverse Proxy Configuration ```caddyfile no.donothireus.com { reverse_proxy localhost:8080 { header_up Host {host} header_up X-Real-IP {remote_host} header_up X-Forwarded-For {remote_host} header_up X-Forwarded-Proto {scheme} } } ``` ### Full Production Setup 1. **Deploy application** using systemd service (see above) 2. **Configure Caddy** with the above Caddyfile configuration (SSL certificates are automatic with Caddy) 3. **Restart services:** ```bash sudo systemctl restart caddy sudo systemctl restart naas ``` ## Performance - Binary size: ~1MB (release build with optimizations) - Memory usage: <10MB - Startup time: <100ms - Request latency: <1ms ## Development ### Building from Source ```bash # Debug build cargo build # Release build with optimizations cargo build --release # Run tests cargo test ``` ### Container Build Options ```bash # Multi-platform build (if needed) podman build --platform linux/amd64,linux/arm64 -t naas:latest . # Build with specific Rust version podman build --build-arg RUST_VERSION=1.75 -t naas:latest . ``` ## Security - Runs as non-root user (UID 1000) - Read-only container filesystem - No new privileges - All capabilities dropped except NET_BIND_SERVICE - Memory and CPU limits enforced - CORS headers properly configured ## License This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. The MIT License is a permissive license that allows you to do almost anything with this code, including using it in commercial projects, modifying it, and distributing it, as long as you include the original copyright notice.