feat: add APISIX Cloudron package (API-Gateway)
- Create Dockerfile wrapping official Apache APISIX image - Add CloudronManifest.json with etcd addon and multiple TCP ports - Create start.sh script with etcd wait and auto-configuration - Include README.md with comprehensive usage documentation - Add config.yaml.example for reference configuration - Add CHANGELOG.md for version tracking - Add logo.png (Apache APISIX branding) APISIX is a dynamic, real-time, high-performance API Gateway that provides rich traffic management features. Package includes: - Official Apache APISIX Docker image wrapper (143MB) - Cloudron etcd addon integration for configuration storage - Automatic etcd connection wait and configuration - Multiple exposed ports (9180: Admin API, 9080: HTTP, 9443: HTTPS) - 1024MB memory limit for gateway operations - Comprehensive documentation with API usage examples - Plugin configuration examples Ports: - 9180: Admin API port (REST API for configuration) - 9080: HTTP proxy port (client requests) - 9443: HTTPS proxy port (client requests with SSL) Features supported: - Dynamic configuration without restarts - Multi-protocol (HTTP/HTTPS, TCP/UDP, Dubbo, MQTT, gRPC, WebSocket) - Load balancing with multiple strategies - Security (IP restrictions, JWT, API Key auth) - Traffic management (rate limiting, circuit breaking, canary releases) - 100+ plugins for extensibility - AI Gateway capabilities for LLM workloads 💘 Generated with Crush Assisted-by: GLM-4.7 via Crush <crush@charm.land>
This commit is contained in:
69
Package-Workspace/API-Gateway/apisix/start.sh
Executable file
69
Package-Workspace/API-Gateway/apisix/start.sh
Executable file
@@ -0,0 +1,69 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
# Cloudron etcd connection
|
||||
ETCD_HOST=${CLOUDRON_ETCD_HOST:-127.0.0.1}
|
||||
ETCD_PORT=${CLOUDRON_ETCD_PORT:-2379}
|
||||
|
||||
echo "Etcd host: $ETCD_HOST"
|
||||
echo "Etcd port: $ETCD_PORT"
|
||||
|
||||
# Wait for etcd to be ready
|
||||
echo "Waiting for etcd to be ready..."
|
||||
MAX_WAIT=30
|
||||
WAIT_TIME=0
|
||||
while ! curl -f "http://${ETCD_HOST}:${ETCD_PORT}/health" 2>/dev/null; do
|
||||
if [ $WAIT_TIME -ge $MAX_WAIT ]; then
|
||||
echo "Timeout waiting for etcd"
|
||||
exit 1
|
||||
fi
|
||||
echo "Etcd is unavailable - sleeping ($WAIT_TIME/$MAX_WAIT)"
|
||||
sleep 2
|
||||
WAIT_TIME=$((WAIT_TIME+2))
|
||||
done
|
||||
|
||||
echo "Etcd is ready!"
|
||||
|
||||
# Create APISIX configuration file
|
||||
cat > /usr/local/apisix/conf/config.yaml << 'EOF'
|
||||
deployment:
|
||||
role: traditional
|
||||
role_traditional:
|
||||
config_provider: etcd
|
||||
admin:
|
||||
port: 9180
|
||||
allow_admin:
|
||||
- 0.0.0.0/0
|
||||
admin_key:
|
||||
- ${ADMIN_KEY:-admin-key-secret-change-me}
|
||||
admin_api_version: v3
|
||||
etcd:
|
||||
host:
|
||||
- ${ETCD_HOST}
|
||||
port: ${ETCD_PORT}
|
||||
prefix: "/apisix"
|
||||
timeout: 30
|
||||
apisix:
|
||||
ssl:
|
||||
ssl_trusted_certificate: /etc/ssl/certs/ca-certificates.crt
|
||||
ssl_protocols: "TLSv1.2 TLSv1.3"
|
||||
node_listen: 9080
|
||||
enable_ipv6: false
|
||||
enable_admin_cors: true
|
||||
enable_http2: true
|
||||
nginx_config:
|
||||
error_log: "logs/error.log"
|
||||
error_log_level: "warn"
|
||||
worker_processes: auto
|
||||
worker_rlimit_nofile: 20480
|
||||
event_worker_processes: 2
|
||||
worker_shutdown_timeout: 240s
|
||||
EOF
|
||||
|
||||
echo "APISIX configuration created at /usr/local/apisix/conf/config.yaml"
|
||||
cat /usr/local/apisix/conf/config.yaml
|
||||
|
||||
# Start APISIX
|
||||
echo "Starting APISIX..."
|
||||
exec /usr/bin/apisix start
|
||||
Reference in New Issue
Block a user