From d0fae8cbb07a7a12ee416478e93491022f6bd30a Mon Sep 17 00:00:00 2001 From: ReachableCEO Date: Fri, 12 Sep 2025 13:48:42 -0500 Subject: [PATCH] merge: adopt feature branch changes for APISIX (manifest, Dockerfile, start.sh) and Jenkins (manifest, Dockerfile, start.sh) --- CloudronPackages/APISIX/CloudronManifest.json | 50 +++++++------- CloudronPackages/APISIX/Dockerfile | 69 +++++++------------ CloudronPackages/APISIX/start.sh | 36 ++++++++-- .../Jenkins/CloudronManifest.json | 2 +- CloudronPackages/Jenkins/Dockerfile | 25 ++++--- CloudronPackages/Jenkins/start.sh | 5 +- 6 files changed, 91 insertions(+), 96 deletions(-) diff --git a/CloudronPackages/APISIX/CloudronManifest.json b/CloudronPackages/APISIX/CloudronManifest.json index c0a91fa..d179abb 100644 --- a/CloudronPackages/APISIX/CloudronManifest.json +++ b/CloudronPackages/APISIX/CloudronManifest.json @@ -1,33 +1,33 @@ { - "id": "apisix", + "id": "com.apache.apisix.cloudron", "title": "Apache APISIX", - "description": "Apache APISIX is a dynamic, real-time, high-performance API gateway.", + "author": "Apache Software Foundation", + "description": "Apache APISIX is a dynamic, real-time, high-performance API gateway, based on the Nginx library and etcd.", "tagline": "High-performance API Gateway", - "icon": "https://cdn.cloudron.io/icons/apisix.svg", - "main": { - "type": "docker", - "image": "cloudron/base:4.2.0", - "ports": { - "9080/tcp": "APISIX HTTP/HTTPS Port" - }, - "healthCheck": { - "url": "/" - } - }, - "manifestVersion": 2, + "version": "3.6.0", + "healthCheckPath": "/health", + "httpPort": 9080, "addons": { "etcd": {} }, - "environment": { - "APISIX_ETCD_HOST": { - "type": "string", - "description": "etcd host for APISIX", - "required": true - }, - "APISIX_ETCD_PORT": { - "type": "string", - "description": "etcd port for APISIX", - "required": true + "manifestVersion": 2, + "website": "https://apisix.apache.org/", + "contactEmail": "dev@apisix.apache.org", + "icon": "logo.png", + "tags": [ + "api-gateway", + "proxy", + "nginx", + "microservices", + "load-balancer" + ], + "env": { + "APISIX_ADMIN_KEY": { + "description": "Admin API key for APISIX. Change this to a strong, unique value.", + "type": "secret" } - } + }, + "configurePath": "/", + "minBoxVersion": "7.0.0", + "postInstallMessage": "Apache APISIX has been successfully installed. The admin API is available at http://your-domain/apisix/admin with the configured admin key. Dashboard access requires additional configuration." } \ No newline at end of file diff --git a/CloudronPackages/APISIX/Dockerfile b/CloudronPackages/APISIX/Dockerfile index 6870fdc..ff19913 100644 --- a/CloudronPackages/APISIX/Dockerfile +++ b/CloudronPackages/APISIX/Dockerfile @@ -1,58 +1,35 @@ -FROM cloudron/base:4.2.0 AS build +FROM apache/apisix:3.6.0-debian -ENV DEBIAN_FRONTEND=noninteractive -ENV ENV_INST_LUADIR=/usr/local/apisix +# Switch to root user for package installation and setup +USER root -COPY apisix-source /apisix +# Install additional tools needed for Cloudron +RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y curl wget sudo --no-install-recommends && rm -rf /var/lib/apt/lists/* -WORKDIR /apisix +# Set up directory structure following Cloudron conventions +RUN mkdir -p /app/code /app/data -RUN set -x \ - && apt-get -y update --fix-missing \ - && apt-get install -y \ - make \ - git \ - sudo \ - libyaml-dev \ - libldap2-dev \ - && make deps \ - && mkdir -p ${ENV_INST_LUADIR} \ - && cp -r deps ${ENV_INST_LUADIR} \ - && make install - -FROM cloudron/base:4.2.0 - -# Install the runtime libyaml package -RUN apt-get -y update --fix-missing \ - && apt-get install -y libyaml-0-2 \ - && apt-get remove --purge --auto-remove -y \ - && mkdir -p /usr/local/apisix/ui - -COPY --from=build /usr/local/apisix /usr/local/apisix -COPY --from=build /usr/local/openresty /usr/local/openresty -COPY --from=build /usr/bin/apisix /usr/bin/apisix -# Assuming UI files are in apisix-source/ui, adjust if needed +# Copy APISIX to Cloudron app directory +RUN cp -r /usr/local/apisix/. /app/code/ && \ + mkdir -p /app/code/bin && \ + cp /usr/bin/apisix /app/code/bin/ -# Install brotli (from upstream install-brotli.sh) -RUN apt-get update && apt-get install -y \ - libbrotli-dev \ - --no-install-recommends && \ - rm -rf /var/lib/apt/lists/* +# Copy configuration template +COPY config.yaml /app/code/conf/config.yaml -ENV PATH=$PATH:/usr/local/openresty/luajit/bin:/usr/local/openresty/nginx/sbin:/usr/local/openresty/bin +# Copy start script +COPY start.sh /app/code/start.sh +RUN chmod +x /app/code/start.sh -WORKDIR /usr/local/apisix +# Set proper permissions +RUN groupadd -r cloudron && useradd -r -g cloudron cloudron && chown -R cloudron:cloudron /app/code /app/data -RUN ln -sf /dev/stdout /usr/local/apisix/logs/access.log \ - && ln -sf /dev/stderr /usr/local/apisix/logs/error.log +# Configure working directory +WORKDIR /app/code +# Expose ports EXPOSE 9080 9443 -# Copy our custom start.sh -COPY start.sh /usr/local/bin/start.sh -RUN chmod +x /usr/local/bin/start.sh - -ENTRYPOINT ["/usr/local/bin/start.sh"] - -STOPSIGNAL SIGQUIT +# Start the application as cloudron user +CMD ["/usr/bin/sudo", "-E", "-u", "cloudron", "/app/code/start.sh"] \ No newline at end of file diff --git a/CloudronPackages/APISIX/start.sh b/CloudronPackages/APISIX/start.sh index 2899aa8..515d85c 100644 --- a/CloudronPackages/APISIX/start.sh +++ b/CloudronPackages/APISIX/start.sh @@ -1,28 +1,50 @@ #!/usr/bin/env bash -set -euo pipefail +set -euxo pipefail -# Set APISIX prefix -PREFIX=${APISIX_PREFIX:=/usr/local/apisix} +# Set APISIX prefix to /app/code +PREFIX=/app/code + +# Log file for APISIX output +LOG_FILE="/app/data/apisix.log" + +# Ensure /app/data/conf exists +mkdir -p /app/data/conf # Generate APISIX configuration (config.yaml) to connect to Cloudron etcd -cat < ${PREFIX}/conf/config.yaml +cat < /app/data/conf/config.yaml apisix: etcd: host: - "http://${CLOUDRON_ETCD_HOST}:${CLOUDRON_ETCD_PORT}" prefix: "/apisix" timeout: 30 +deployment: + admin: + admin_key: + - name: admin + key: ${CLOUDRON_APP_SECRET} + role: admin # Other APISIX configuration can go here if needed EOF +# Print generated config.yaml and environment variables for debugging +cat /app/data/conf/config.yaml >> "${LOG_FILE}" 2>&1 +env >> "${LOG_FILE}" 2>&1 + +# Set APISIX_CONF_FILE environment variable +export APISIX_CONF_FILE=/app/data/conf/config.yaml + # Initialize APISIX -/usr/bin/apisix init +/app/code/bin/apisix init >> "${LOG_FILE}" 2>&1 # Initialize etcd connection for APISIX -/usr/bin/apisix init_etcd +/app/code/bin/apisix init_etcd >> "${LOG_FILE}" 2>&1 # Start OpenResty (APISIX server) -exec /usr/local/openresty/bin/openresty -p ${PREFIX} -g 'daemon off;' +/usr/local/openresty/bin/openresty -p ${PREFIX} -g 'daemon off;' >> "${LOG_FILE}" 2>&1 & + +# Tail the log file to keep the container running and show output +tail -f "${LOG_FILE}" \ No newline at end of file diff --git a/CloudronPackages/Jenkins/CloudronManifest.json b/CloudronPackages/Jenkins/CloudronManifest.json index 1613f17..7b6871e 100644 --- a/CloudronPackages/Jenkins/CloudronManifest.json +++ b/CloudronPackages/Jenkins/CloudronManifest.json @@ -4,7 +4,7 @@ "author": "Cloudron Packager", "description": "Jenkins is an open source automation server which enables developers to reliably build, test, and deploy their software.", "tagline": "The leading open source automation server", - "version": "1.0.0", + "version": "2.516.1", "healthCheckPath": "/login", "httpPort": 8080, "manifestVersion": 2, diff --git a/CloudronPackages/Jenkins/Dockerfile b/CloudronPackages/Jenkins/Dockerfile index 54bd007..ecc91e2 100644 --- a/CloudronPackages/Jenkins/Dockerfile +++ b/CloudronPackages/Jenkins/Dockerfile @@ -1,25 +1,24 @@ FROM cloudron/base:4.2.0 -# Add Jenkins repository key and repository +# Add Jenkins repository key and repository, and install Jenkins and dependencies RUN apt-get update && \ apt-get install -y gnupg curl software-properties-common && \ curl -fsSL https://pkg.jenkins.io/debian-stable/jenkins.io-2023.key | gpg --dearmor -o /usr/share/keyrings/jenkins-keyring.gpg && \ - echo deb [signed-by=/usr/share/keyrings/jenkins-keyring.gpg] https://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list - -# Install Jenkins and required dependencies -RUN apt-get update && \ + echo deb [signed-by=/usr/share/keyrings/jenkins-keyring.gpg] https://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list && \ + apt-get update && \ apt-get install -y openjdk-17-jdk jenkins fontconfig && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* # Install required plugins for Cloudron integration -RUN mkdir -p /tmp/data/plugins && \ - cd /tmp/data/plugins && \ - curl -L -o ldap.hpi https://updates.jenkins.io/latest/ldap.hpi && \ - curl -L -o oic-auth.hpi https://updates.jenkins.io/latest/oic-auth.hpi && \ - curl -L -o configuration-as-code.hpi https://updates.jenkins.io/latest/configuration-as-code.hpi && \ - curl -L -o credentials.hpi https://updates.jenkins.io/latest/credentials.hpi && \ - chmod 644 *.hpi +# Plugins: ldap, oic-auth, configuration-as-code, credentials +RUN curl -L https://repo.jenkins-ci.org/public/org/jenkins-ci/main/jenkins-cli/2.516.2/jenkins-cli-2.516.2.jar -o /usr/local/bin/jenkins-cli.jar && \ + chmod +x /usr/local/bin/jenkins-cli.jar && \ + java -jar /usr/local/bin/jenkins-cli.jar install-plugin \ + ldap \ + oic-auth \ + configuration-as-code \ + credentials # Create template for casc.yaml RUN mkdir -p /tmp/data/casc_configs @@ -46,4 +45,4 @@ RUN usermod -a -G jenkins cloudron && \ WORKDIR /app/data # Entry point -CMD ["/app/code/start.sh"] \ No newline at end of file +CMD ["/app/code/start.sh"] diff --git a/CloudronPackages/Jenkins/start.sh b/CloudronPackages/Jenkins/start.sh index e775748..ca9f7c7 100644 --- a/CloudronPackages/Jenkins/start.sh +++ b/CloudronPackages/Jenkins/start.sh @@ -1,5 +1,5 @@ #!/bin/bash -set -e +set -euo pipefail # Jenkins home directory JENKINS_HOME=/app/data/jenkins_home @@ -9,9 +9,6 @@ if [[ ! -d "${JENKINS_HOME}" ]]; then echo "Initializing Jenkins home directory" mkdir -p "${JENKINS_HOME}" cp -r /tmp/data/jenkins_home/* "${JENKINS_HOME}/" || true - # Copy plugins - mkdir -p "${JENKINS_HOME}/plugins" - cp -r /tmp/data/plugins/* "${JENKINS_HOME}/plugins/" || true # Create directory for JCasC mkdir -p "${JENKINS_HOME}/casc_configs" fi