merge: adopt feature branch changes for APISIX (manifest, Dockerfile, start.sh) and Jenkins (manifest, Dockerfile, start.sh)

This commit is contained in:
2025-09-12 13:48:42 -05:00
parent 26b311b9db
commit d0fae8cbb0
6 changed files with 91 additions and 96 deletions

View File

@@ -1,33 +1,33 @@
{ {
"id": "apisix", "id": "com.apache.apisix.cloudron",
"title": "Apache APISIX", "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", "tagline": "High-performance API Gateway",
"icon": "https://cdn.cloudron.io/icons/apisix.svg", "version": "3.6.0",
"main": { "healthCheckPath": "/health",
"type": "docker", "httpPort": 9080,
"image": "cloudron/base:4.2.0",
"ports": {
"9080/tcp": "APISIX HTTP/HTTPS Port"
},
"healthCheck": {
"url": "/"
}
},
"manifestVersion": 2,
"addons": { "addons": {
"etcd": {} "etcd": {}
}, },
"environment": { "manifestVersion": 2,
"APISIX_ETCD_HOST": { "website": "https://apisix.apache.org/",
"type": "string", "contactEmail": "dev@apisix.apache.org",
"description": "etcd host for APISIX", "icon": "logo.png",
"required": true "tags": [
}, "api-gateway",
"APISIX_ETCD_PORT": { "proxy",
"type": "string", "nginx",
"description": "etcd port for APISIX", "microservices",
"required": true "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."
} }

View File

@@ -1,58 +1,35 @@
FROM cloudron/base:4.2.0 AS build FROM apache/apisix:3.6.0-debian
ENV DEBIAN_FRONTEND=noninteractive # Switch to root user for package installation and setup
ENV ENV_INST_LUADIR=/usr/local/apisix 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 \ # Copy APISIX to Cloudron app directory
&& apt-get -y update --fix-missing \ RUN cp -r /usr/local/apisix/. /app/code/ && \
&& apt-get install -y \ mkdir -p /app/code/bin && \
make \ cp /usr/bin/apisix /app/code/bin/
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
# Install brotli (from upstream install-brotli.sh) # Copy configuration template
RUN apt-get update && apt-get install -y \ COPY config.yaml /app/code/conf/config.yaml
libbrotli-dev \
--no-install-recommends && \
rm -rf /var/lib/apt/lists/*
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 \ # Configure working directory
&& ln -sf /dev/stderr /usr/local/apisix/logs/error.log WORKDIR /app/code
# Expose ports
EXPOSE 9080 9443 EXPOSE 9080 9443
# Copy our custom start.sh # Start the application as cloudron user
COPY start.sh /usr/local/bin/start.sh CMD ["/usr/bin/sudo", "-E", "-u", "cloudron", "/app/code/start.sh"]
RUN chmod +x /usr/local/bin/start.sh
ENTRYPOINT ["/usr/local/bin/start.sh"]
STOPSIGNAL SIGQUIT

View File

@@ -1,28 +1,50 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -euo pipefail set -euxo pipefail
# Set APISIX prefix # Set APISIX prefix to /app/code
PREFIX=${APISIX_PREFIX:=/usr/local/apisix} 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 # Generate APISIX configuration (config.yaml) to connect to Cloudron etcd
cat <<EOF > ${PREFIX}/conf/config.yaml cat <<EOF > /app/data/conf/config.yaml
apisix: apisix:
etcd: etcd:
host: host:
- "http://${CLOUDRON_ETCD_HOST}:${CLOUDRON_ETCD_PORT}" - "http://${CLOUDRON_ETCD_HOST}:${CLOUDRON_ETCD_PORT}"
prefix: "/apisix" prefix: "/apisix"
timeout: 30 timeout: 30
deployment:
admin:
admin_key:
- name: admin
key: ${CLOUDRON_APP_SECRET}
role: admin
# Other APISIX configuration can go here if needed # Other APISIX configuration can go here if needed
EOF 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 # Initialize APISIX
/usr/bin/apisix init /app/code/bin/apisix init >> "${LOG_FILE}" 2>&1
# Initialize etcd connection for APISIX # Initialize etcd connection for APISIX
/usr/bin/apisix init_etcd /app/code/bin/apisix init_etcd >> "${LOG_FILE}" 2>&1
# Start OpenResty (APISIX server) # 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}"

View File

@@ -4,7 +4,7 @@
"author": "Cloudron Packager", "author": "Cloudron Packager",
"description": "Jenkins is an open source automation server which enables developers to reliably build, test, and deploy their software.", "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", "tagline": "The leading open source automation server",
"version": "1.0.0", "version": "2.516.1",
"healthCheckPath": "/login", "healthCheckPath": "/login",
"httpPort": 8080, "httpPort": 8080,
"manifestVersion": 2, "manifestVersion": 2,

View File

@@ -1,25 +1,24 @@
FROM cloudron/base:4.2.0 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 && \ RUN apt-get update && \
apt-get install -y gnupg curl software-properties-common && \ 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 && \ 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 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 && \
# Install Jenkins and required dependencies
RUN apt-get update && \
apt-get install -y openjdk-17-jdk jenkins fontconfig && \ apt-get install -y openjdk-17-jdk jenkins fontconfig && \
apt-get clean && \ apt-get clean && \
rm -rf /var/lib/apt/lists/* rm -rf /var/lib/apt/lists/*
# Install required plugins for Cloudron integration # Install required plugins for Cloudron integration
RUN mkdir -p /tmp/data/plugins && \ # Plugins: ldap, oic-auth, configuration-as-code, credentials
cd /tmp/data/plugins && \ 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 && \
curl -L -o ldap.hpi https://updates.jenkins.io/latest/ldap.hpi && \ chmod +x /usr/local/bin/jenkins-cli.jar && \
curl -L -o oic-auth.hpi https://updates.jenkins.io/latest/oic-auth.hpi && \ java -jar /usr/local/bin/jenkins-cli.jar install-plugin \
curl -L -o configuration-as-code.hpi https://updates.jenkins.io/latest/configuration-as-code.hpi && \ ldap \
curl -L -o credentials.hpi https://updates.jenkins.io/latest/credentials.hpi && \ oic-auth \
chmod 644 *.hpi configuration-as-code \
credentials
# Create template for casc.yaml # Create template for casc.yaml
RUN mkdir -p /tmp/data/casc_configs RUN mkdir -p /tmp/data/casc_configs

View File

@@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
set -e set -euo pipefail
# Jenkins home directory # Jenkins home directory
JENKINS_HOME=/app/data/jenkins_home JENKINS_HOME=/app/data/jenkins_home
@@ -9,9 +9,6 @@ if [[ ! -d "${JENKINS_HOME}" ]]; then
echo "Initializing Jenkins home directory" echo "Initializing Jenkins home directory"
mkdir -p "${JENKINS_HOME}" mkdir -p "${JENKINS_HOME}"
cp -r /tmp/data/jenkins_home/* "${JENKINS_HOME}/" || true 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 # Create directory for JCasC
mkdir -p "${JENKINS_HOME}/casc_configs" mkdir -p "${JENKINS_HOME}/casc_configs"
fi fi