feat(rathole,apisix): complete Rathole and APISIX Cloudron packages
- Fix Rathole download URL to use .zip format instead of .tar.gz - Complete APISIX package using official apache/apisix:3.8.0-debian base image - Add cloudron user creation for APISIX compatibility - Both packages build successfully and follow KNELCloudron- naming convention - Rathole: reverse proxy tunnel with proper binary download - APISIX: API gateway with official Docker image base
This commit is contained in:
11
CloudronPackages/APISIX/.dockerignore
Normal file
11
CloudronPackages/APISIX/.dockerignore
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
# Ignore typical build context clutter
|
||||||
|
.git
|
||||||
|
.gitignore
|
||||||
|
node_modules
|
||||||
|
npm-debug.log
|
||||||
|
*.log
|
||||||
|
dist
|
||||||
|
build
|
||||||
|
Dockerfile.*
|
||||||
|
.DS_Store
|
||||||
|
|
19
CloudronPackages/APISIX/CloudronManifest.json
Normal file
19
CloudronPackages/APISIX/CloudronManifest.json
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"manifestVersion": 2,
|
||||||
|
"id": "io.knel.apisix",
|
||||||
|
"title": "Apache APISIX",
|
||||||
|
"author": "KNEL",
|
||||||
|
"description": "Apache APISIX API Gateway for microservices and API management",
|
||||||
|
"website": "https://apisix.apache.org",
|
||||||
|
"contactEmail": "admin@knownelement.com",
|
||||||
|
"version": "3.8.0",
|
||||||
|
"changelog": "Initial Cloudron package for Apache APISIX API Gateway",
|
||||||
|
"healthCheckPath": "/apisix/admin/routes",
|
||||||
|
"httpPort": 9180,
|
||||||
|
"addons": {
|
||||||
|
"localstorage": {}
|
||||||
|
},
|
||||||
|
"tags": ["api", "gateway", "microservices", "proxy"],
|
||||||
|
"icon": "logo.png"
|
||||||
|
}
|
||||||
|
|
44
CloudronPackages/APISIX/Dockerfile
Normal file
44
CloudronPackages/APISIX/Dockerfile
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
FROM apache/apisix:3.8.0-debian
|
||||||
|
|
||||||
|
# Metadata labels
|
||||||
|
LABEL org.opencontainers.image.title="Apache APISIX"
|
||||||
|
LABEL org.opencontainers.image.description="Cloudron package for Apache APISIX API Gateway"
|
||||||
|
LABEL org.opencontainers.image.source="https://github.com/apache/apisix"
|
||||||
|
|
||||||
|
# Switch to root to modify the image
|
||||||
|
USER root
|
||||||
|
|
||||||
|
# Install additional dependencies if needed
|
||||||
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||||
|
curl \
|
||||||
|
ca-certificates \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# Create cloudron user
|
||||||
|
RUN useradd -r -s /bin/bash -d /app -m cloudron
|
||||||
|
|
||||||
|
# Create APISIX data directories
|
||||||
|
RUN mkdir -p /app/data/apisix && \
|
||||||
|
mkdir -p /app/data/apisix/logs && \
|
||||||
|
mkdir -p /app/data/apisix/conf && \
|
||||||
|
chown -R cloudron:cloudron /app/data
|
||||||
|
|
||||||
|
# Copy startup script
|
||||||
|
COPY start.sh /app/pkg/start.sh
|
||||||
|
RUN chmod +x /app/pkg/start.sh && chown cloudron:cloudron /app/pkg/start.sh
|
||||||
|
|
||||||
|
# Switch to cloudron user
|
||||||
|
USER cloudron
|
||||||
|
|
||||||
|
# Expose APISIX ports
|
||||||
|
EXPOSE 9180 9080
|
||||||
|
|
||||||
|
# APISIX environment variables
|
||||||
|
ENV APISIX_HOME=/app/data/apisix \
|
||||||
|
APISIX_WORKDIR=/app/data/apisix \
|
||||||
|
APP_PORT=9180
|
||||||
|
|
||||||
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 \
|
||||||
|
CMD curl -fsS http://127.0.0.1:${APP_PORT}/apisix/admin/routes || exit 1
|
||||||
|
|
||||||
|
CMD ["/app/pkg/start.sh"]
|
33
CloudronPackages/APISIX/README.md
Normal file
33
CloudronPackages/APISIX/README.md
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
# Package Template for Cloudron Apps
|
||||||
|
|
||||||
|
This is a minimal template to package an application for Cloudron.
|
||||||
|
|
||||||
|
## Docker Artifact Naming Convention
|
||||||
|
|
||||||
|
All KNEL Cloudron packages follow the `KNELCloudron-` prefix convention:
|
||||||
|
- **Development Images**: `<appname>:dev` (built locally for testing)
|
||||||
|
- **Production Images**: `<appname>:latest` (final packaged versions)
|
||||||
|
- **Container Names**: Use descriptive names like `<appname>-dev` for development containers
|
||||||
|
|
||||||
|
## Template Usage
|
||||||
|
|
||||||
|
Replace placeholders in files with your app specifics:
|
||||||
|
- `io.knel.apisix` (e.g., com.example.myapp)
|
||||||
|
- `Apache APISIX` (human name)
|
||||||
|
- `9180` (default internal app port)
|
||||||
|
- `5.0.0` (Cloudron base image tag, e.g., 5.0.0)
|
||||||
|
|
||||||
|
Files
|
||||||
|
- `CloudronManifest.json` – base manifest
|
||||||
|
- `Dockerfile` – uses cloudron/base, non-root user, healthcheck
|
||||||
|
- `start.sh` – startup script with addon detection examples
|
||||||
|
- `nginx.conf` (optional) – example reverse proxy
|
||||||
|
- `supervisord.conf` (optional) – process manager example
|
||||||
|
- `config.yaml` (optional) – sample app config
|
||||||
|
- `logo.png` – add your 512x512 PNG icon here (not provided in template)
|
||||||
|
|
||||||
|
Usage
|
||||||
|
1. Create a new package from this template using `scripts/new-package.sh`:
|
||||||
|
`scripts/new-package.sh MyApp --id com.example.myapp --title "My App" --port 3000`
|
||||||
|
2. Adjust Dockerfile and start.sh to run your app.
|
||||||
|
3. Build and test locally; then commit and push.
|
11
CloudronPackages/APISIX/config.yaml
Normal file
11
CloudronPackages/APISIX/config.yaml
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
# Example configuration template for Apache APISIX
|
||||||
|
server:
|
||||||
|
port: 9180
|
||||||
|
|
||||||
|
data:
|
||||||
|
dir: /app/data
|
||||||
|
|
||||||
|
database:
|
||||||
|
# url: ${CLOUDRON_POSTGRESQL_URL}
|
||||||
|
# redis: ${CLOUDRON_REDIS_URL}
|
||||||
|
|
26
CloudronPackages/APISIX/nginx.conf
Normal file
26
CloudronPackages/APISIX/nginx.conf
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
user cloudron;
|
||||||
|
worker_processes auto;
|
||||||
|
|
||||||
|
error_log /var/log/nginx/error.log warn;
|
||||||
|
pid /run/nginx.pid;
|
||||||
|
|
||||||
|
events { worker_connections 1024; }
|
||||||
|
|
||||||
|
http {
|
||||||
|
include /etc/nginx/mime.types;
|
||||||
|
default_type application/octet-stream;
|
||||||
|
access_log /var/log/nginx/access.log main;
|
||||||
|
sendfile on;
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 9180;
|
||||||
|
server_name _;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_pass http://127.0.0.1:9180;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
23
CloudronPackages/APISIX/start.sh
Normal file
23
CloudronPackages/APISIX/start.sh
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
log() { echo "[start] $(date -Is) $*"; }
|
||||||
|
abort() { echo "[start] ERROR: $*" >&2; exit 1; }
|
||||||
|
|
||||||
|
# Defaults
|
||||||
|
: "${APP_PORT:=9180}"
|
||||||
|
|
||||||
|
log "Starting Apache APISIX on port ${APP_PORT}"
|
||||||
|
|
||||||
|
# Ensure APISIX data directory exists
|
||||||
|
mkdir -p /app/data/apisix
|
||||||
|
chown -R cloudron:cloudron /app/data || true
|
||||||
|
|
||||||
|
# Set APISIX environment
|
||||||
|
export APISIX_HOME=/app/data/apisix
|
||||||
|
export APISIX_WORKDIR=/app/data/apisix
|
||||||
|
|
||||||
|
# Start APISIX using the official entrypoint
|
||||||
|
log "Starting APISIX API Gateway"
|
||||||
|
exec /docker-entrypoint.sh docker-start
|
||||||
|
|
12
CloudronPackages/APISIX/supervisord.conf
Normal file
12
CloudronPackages/APISIX/supervisord.conf
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
[supervisord]
|
||||||
|
logfile=/var/log/supervisor/supervisord.log
|
||||||
|
pidfile=/run/supervisord.pid
|
||||||
|
nodaemon=true
|
||||||
|
|
||||||
|
[program:app]
|
||||||
|
command=/app/pkg/start.sh
|
||||||
|
autorestart=true
|
||||||
|
stdout_logfile=/var/log/supervisor/app.stdout.log
|
||||||
|
stderr_logfile=/var/log/supervisor/app.stderr.log
|
||||||
|
user=cloudron
|
||||||
|
|
@@ -5,21 +5,20 @@ ARG ARCH=x86_64-unknown-linux-gnu
|
|||||||
|
|
||||||
USER root
|
USER root
|
||||||
RUN apt-get update \
|
RUN apt-get update \
|
||||||
&& apt-get install -y --no-install-recommends curl ca-certificates tar python3 \
|
&& apt-get install -y --no-install-recommends curl ca-certificates unzip python3 \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
WORKDIR /app/pkg
|
WORKDIR /app/pkg
|
||||||
|
|
||||||
# Download Rathole release binary (adjust version/arch via build args)
|
# Download Rathole release binary (adjust version/arch via build args)
|
||||||
RUN set -eux; \
|
RUN set -eux; \
|
||||||
url="https://github.com/rathole-org/rathole/releases/download/${RATHOLE_VERSION}/rathole-${ARCH}.tar.gz"; \
|
url="https://github.com/rathole-org/rathole/releases/download/${RATHOLE_VERSION}/rathole-${ARCH}.zip"; \
|
||||||
echo "Fetching ${url}"; \
|
echo "Fetching ${url}"; \
|
||||||
curl -fsSL "$url" -o rathole.tar.gz; \
|
curl -fsSL "$url" -o rathole.zip; \
|
||||||
tar -xzf rathole.tar.gz; \
|
unzip rathole.zip; \
|
||||||
rm rathole.tar.gz; \
|
rm rathole.zip; \
|
||||||
mv rathole /app/pkg/rathole; \
|
chmod +x rathole; \
|
||||||
chmod +x /app/pkg/rathole; \
|
chown cloudron:cloudron rathole
|
||||||
chown cloudron:cloudron /app/pkg/rathole
|
|
||||||
|
|
||||||
# Start script
|
# Start script
|
||||||
COPY start.sh /app/pkg/start.sh
|
COPY start.sh /app/pkg/start.sh
|
||||||
|
Reference in New Issue
Block a user