Initial commit: Add NaaS (No as a Service) implementation
Add complete NaaS HTTP service implementation with: - Pure Rust implementation using only standard library - Multiple response formats (text, JSON, XML, YAML, boolean) - Embedded web frontend with mobile-responsive design - Container support with Podman/Docker - Systemd service configuration - Health check endpoint - CORS support The service always responds with "no" in various formats, optimized for minimal binary size (~1MB) and fast response times. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
dbe9e90942
commit
858e14a520
5 changed files with 498 additions and 0 deletions
50
naas.service
Normal file
50
naas.service
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
[Unit]
|
||||
Description=No as a Service (NaaS)
|
||||
After=network-online.target
|
||||
Wants=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
Restart=always
|
||||
RestartSec=10
|
||||
TimeoutStopSec=30
|
||||
|
||||
# User configuration (adjust as needed)
|
||||
User=naas
|
||||
Group=naas
|
||||
|
||||
# Environment configuration
|
||||
Environment="PORT=8080"
|
||||
Environment="BUILDAH_FORMAT=docker"
|
||||
|
||||
# Container management
|
||||
ExecStartPre=/usr/bin/podman rm -f naas-container 2>/dev/null || true
|
||||
ExecStartPre=/usr/bin/podman build -t naas:latest /opt/naas
|
||||
|
||||
ExecStart=/usr/bin/podman run \
|
||||
--name naas-container \
|
||||
--rm \
|
||||
--network=host \
|
||||
--read-only \
|
||||
--security-opt no-new-privileges \
|
||||
--cap-drop ALL \
|
||||
--cap-add NET_BIND_SERVICE \
|
||||
-e PORT=8080 \
|
||||
naas:latest
|
||||
|
||||
ExecStop=/usr/bin/podman stop naas-container
|
||||
ExecStopPost=/usr/bin/podman rm -f naas-container 2>/dev/null || true
|
||||
|
||||
# Security settings
|
||||
NoNewPrivileges=true
|
||||
PrivateTmp=true
|
||||
ProtectSystem=strict
|
||||
ProtectHome=true
|
||||
ReadWritePaths=
|
||||
|
||||
# Resource limits
|
||||
MemoryLimit=256M
|
||||
CPUQuota=50%
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
Loading…
Add table
Add a link
Reference in a new issue