Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .github/workflows/check-openresty-modules.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Check OpenResty Modules

on:
pull_request:
paths:
- 'apps/openresty/**'
- 'scripts/check-openresty-modules.sh'
push:
branches: ['dev']
paths:
- 'apps/openresty/**'
- 'scripts/check-openresty-modules.sh'

jobs:
check-openresty-modules:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Verify module.json matches module.catalog.json
run: bash scripts/check-openresty-modules.sh
44 changes: 44 additions & 0 deletions apps/openresty/1.27.1.2-5-1-focal/build/Dockerfile.modules
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
ARG RESTY_IMAGE_BASE="ubuntu"
ARG RESTY_IMAGE_TAG="focal"
ARG PANEL_OPENRESTY_VERSION="1.27.1.2-5-1-focal"

FROM 1panel/openresty:${PANEL_OPENRESTY_VERSION} AS panel-openresty

FROM ${RESTY_IMAGE_BASE}:${RESTY_IMAGE_TAG} AS module-builder

SHELL ["/bin/bash", "-o", "pipefail", "-c"]

ARG RESTY_VERSION="1.27.1.2"
ARG RESTY_J="1"
ARG RESTY_ADD_PACKAGE_BUILDDEPS=""

RUN DEBIAN_FRONTEND=noninteractive apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
build-essential ca-certificates curl git libgd-dev libgeoip-dev libpcre3-dev \
libreadline-dev libssl-dev libxslt1-dev make patchelf perl unzip wget zlib1g-dev \
${RESTY_ADD_PACKAGE_BUILDDEPS}

COPY tmp /tmp
COPY --from=panel-openresty /usr/local/openresty/modules/ngx_brotli /usr/local/openresty/modules/ngx_brotli

RUN bash /tmp/module-pre.sh \
&& cd /tmp \
&& tar xzf openresty-${RESTY_VERSION}.tar.gz \
&& cd /tmp/openresty-${RESTY_VERSION} \
&& mapfile -t MODULE_CONFIG < /tmp/module-config.args \
&& ./configure -j${RESTY_J} --with-compat --with-http_ssl_module --with-stream --with-stream_ssl_module --with-http_realip_module --with-http_dav_module "${MODULE_CONFIG[@]}" \
&& NGINX_BUILD_DIR="$(find build -mindepth 1 -maxdepth 1 -type d -name 'nginx-*' | head -n 1)" \
&& test -n "${NGINX_BUILD_DIR}" \
&& make -C "${NGINX_BUILD_DIR}" -j${RESTY_J} modules \
&& mkdir -p /out/lib \
&& find "${NGINX_BUILD_DIR}/objs" -maxdepth 1 -type f -name '*.so' -exec cp -a {} /out/ \; \
&& test -n "$(find /out -maxdepth 1 -type f -name '*.so' -print -quit)" \
&& if find /usr/local/lib -maxdepth 1 -name '*.so*' -print -quit 2>/dev/null | grep -q .; then \
find /usr/local/lib -maxdepth 1 -name '*.so*' -exec cp -a {} /out/lib/ \; ; \
fi \
&& find /out -maxdepth 1 -type f -name '*.so' \
-exec patchelf --set-rpath '$ORIGIN/lib:/usr/local/openresty/1pwaf/libraries' {} \;

FROM ${RESTY_IMAGE_BASE}:${RESTY_IMAGE_TAG} AS module-output
COPY --from=module-builder /out /out
CMD ["/bin/true"]
59 changes: 59 additions & 0 deletions apps/openresty/1.27.1.2-5-1-focal/build/module.catalog.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
[
{
"name": "ngx_brotli",
"script": "",
"packages": [
"libbrotli-dev"
],
"params": "--add-module=/usr/local/openresty/modules/ngx_brotli",
"enable": false,
"buildMode": "auto",
"provider": "local",
"dynamicSupport": "unknown",
"loadOrder": 10
},
{
"name": "rtmp",
"script": "unzip -o /tmp/nginx-rtmp-module.zip -d /tmp",
"packages": [],
"params": "--add-module=/tmp/nginx-rtmp-module",
"enable": false,
"buildMode": "auto",
"provider": "local",
"dynamicSupport": "unknown",
"loadOrder": 20
},
{
"name": "web_dav",
"script": "unzip -o /tmp/nginx-dav-ext-module.zip -d /tmp",
"packages": [],
"params": "--with-http_dav_module --add-module=/tmp/nginx-dav-ext-module",
"enable": false,
"buildMode": "auto",
"provider": "local",
"dynamicSupport": "unknown",
"loadOrder": 30
},
{
"name": "geoip2",
"script": "unzip -o /tmp/ngx_http_geoip2_module.zip -d /tmp && tar -zxvf /tmp/libmaxminddb.tar.gz -C /tmp && cd /tmp/libmaxminddb && ./configure && make && make install",
"packages": [],
"params": "--add-module=/tmp/ngx_http_geoip2_module",
"enable": false,
"buildMode": "auto",
"provider": "local",
"dynamicSupport": "unknown",
"loadOrder": 40
},
{
"name": "http_substitutions_filter",
"script": "unzip -o /tmp/ngx_http_substitutions_filter_module.zip -d /tmp",
"packages": [],
"params": "--add-module=/tmp/ngx_http_substitutions_filter_module",
"enable": false,
"buildMode": "auto",
"provider": "local",
"dynamicSupport": "unknown",
"loadOrder": 50
}
]
64 changes: 43 additions & 21 deletions apps/openresty/1.27.1.2-5-1-focal/build/module.json
Original file line number Diff line number Diff line change
@@ -1,37 +1,59 @@
[
{
"name":"ngx_brotli",
"script":"",
"packages":[],
"name": "ngx_brotli",
"script": "",
"packages": [
"libbrotli-dev"
],
"params": "--add-module=/usr/local/openresty/modules/ngx_brotli",
"enable":false
"enable": false,
"buildMode": "auto",
"provider": "local",
"dynamicSupport": "unknown",
"loadOrder": 10
},
{
"name":"rtmp",
"script":"unzip -o /tmp/nginx-rtmp-module.zip -d /tmp",
"packages":[],
"name": "rtmp",
"script": "unzip -o /tmp/nginx-rtmp-module.zip -d /tmp",
"packages": [],
"params": "--add-module=/tmp/nginx-rtmp-module",
"enable":false
"enable": false,
"buildMode": "auto",
"provider": "local",
"dynamicSupport": "unknown",
"loadOrder": 20
},
{
"name":"web_dav",
"script":"unzip -o /tmp/nginx-dav-ext-module.zip -d /tmp",
"packages":[],
"params": "--with-http_dav_module --add-module=/tmp/nginx-dav-ext-module",
"enable":false
"name": "web_dav",
"script": "unzip -o /tmp/nginx-dav-ext-module.zip -d /tmp",
"packages": [],
"params": "--with-http_dav_module --add-module=/tmp/nginx-dav-ext-module",
"enable": false,
"buildMode": "auto",
"provider": "local",
"dynamicSupport": "unknown",
"loadOrder": 30
},
{
"name":"geoip2",
"script":"unzip -o /tmp/ngx_http_geoip2_module.zip -d /tmp && tar -zxvf /tmp/libmaxminddb.tar.gz -C /tmp && cd /tmp/libmaxminddb && ./configure && make && make install",
"packages":[],
"name": "geoip2",
"script": "unzip -o /tmp/ngx_http_geoip2_module.zip -d /tmp && tar -zxvf /tmp/libmaxminddb.tar.gz -C /tmp && cd /tmp/libmaxminddb && ./configure && make && make install",
"packages": [],
"params": "--add-module=/tmp/ngx_http_geoip2_module",
"enable":false
"enable": false,
"buildMode": "auto",
"provider": "local",
"dynamicSupport": "unknown",
"loadOrder": 40
},
{
"name":"http_substitutions_filter",
"script":"unzip -o /tmp/ngx_http_substitutions_filter_module.zip -d /tmp",
"packages":[],
"name": "http_substitutions_filter",
"script": "unzip -o /tmp/ngx_http_substitutions_filter_module.zip -d /tmp",
"packages": [],
"params": "--add-module=/tmp/ngx_http_substitutions_filter_module",
"enable":false
"enable": false,
"buildMode": "auto",
"provider": "local",
"dynamicSupport": "unknown",
"loadOrder": 50
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

2 changes: 2 additions & 0 deletions apps/openresty/1.27.1.2-5-1-focal/conf/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ error_log /dev/stdout notice;
pid /var/run/nginx.pid;
worker_rlimit_nofile 51200;

include /usr/local/openresty/nginx/conf/modules-enabled/*.conf;

events {
use epoll;
worker_connections 5120;
Expand Down
2 changes: 2 additions & 0 deletions apps/openresty/1.27.1.2-5-1-focal/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ services:
- ./conf/mime.types:/usr/local/openresty/nginx/conf/mime.types
- ./conf/default:/usr/local/openresty/nginx/conf/default/
- ./conf/ssl:/usr/local/openresty/nginx/conf/ssl/
- ./conf/modules-enabled:/usr/local/openresty/nginx/conf/modules-enabled/:ro
- ./modules:/usr/local/openresty/nginx/modules/1panel/:ro
- ./log:/var/log/nginx
- ./root:/usr/share/nginx/html
- /etc/localtime:/etc/localtime
Expand Down
2 changes: 2 additions & 0 deletions apps/openresty/1.27.1.2-5-1-focal/scripts/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

source ./.env

mkdir -p modules conf/modules-enabled

sed -i -E "s/(listen[[:space:]]+)80([[:space:]]*default_server;)/\1${PANEL_APP_PORT_HTTP}\2/" conf/default/00.default.conf
sed -i -E "s/(listen[[:space:]]+)\[::]:80([[:space:]]*default_server;)/\1\[::]:${PANEL_APP_PORT_HTTP}\2/" conf/default/00.default.conf

Expand Down
17 changes: 12 additions & 5 deletions apps/openresty/1.27.1.2-5-1-focal/scripts/upgrade.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
#!/bin/bash
NGINX_CONF="conf/nginx.conf"
MODULE_INCLUDE="include /usr/local/openresty/nginx/conf/modules-enabled/*.conf;"

mkdir -p modules conf/modules-enabled

if [ ! -f "$NGINX_CONF" ]; then
echo "✗ failed: $NGINX_CONF not found"
exit 1
fi

if ! grep -Fq "$MODULE_INCLUDE" "$NGINX_CONF"; then
sed -i "1i$MODULE_INCLUDE" "$NGINX_CONF"
fi

STREAM_BLOCK='stream {
log_format streamlog '\''$remote_addr[$time_local] '\''
Expand All @@ -11,11 +23,6 @@ STREAM_BLOCK='stream {
include /usr/local/openresty/nginx/conf/stream.d/*.conf;
}'

if [ ! -f "$NGINX_CONF" ]; then
echo "✗ failed: $NGINX_CONF not found"
exit 1
fi

if grep -q "stream[[:space:]]*{" "$NGINX_CONF"; then
exit 0
fi
Expand Down
44 changes: 44 additions & 0 deletions apps/openresty/1.29.2.5-0-noble/build/Dockerfile.modules
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
ARG RESTY_IMAGE_BASE="ubuntu"
ARG RESTY_IMAGE_TAG="noble"
ARG PANEL_OPENRESTY_VERSION="1.29.2.5-0-noble"

FROM 1panel/openresty:${PANEL_OPENRESTY_VERSION} AS panel-openresty

FROM ${RESTY_IMAGE_BASE}:${RESTY_IMAGE_TAG} AS module-builder

SHELL ["/bin/bash", "-o", "pipefail", "-c"]

ARG RESTY_VERSION="1.29.2.5"
ARG RESTY_J="1"
ARG RESTY_ADD_PACKAGE_BUILDDEPS=""

RUN DEBIAN_FRONTEND=noninteractive apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
build-essential ca-certificates curl git libgd-dev libgeoip-dev libpcre2-dev \
libreadline-dev libssl-dev libxslt1-dev make patchelf perl unzip wget zlib1g-dev \
${RESTY_ADD_PACKAGE_BUILDDEPS}

COPY tmp /tmp
COPY --from=panel-openresty /usr/local/openresty/modules/ngx_brotli /usr/local/openresty/modules/ngx_brotli

RUN bash /tmp/module-pre.sh \
&& cd /tmp \
&& tar xzf openresty-${RESTY_VERSION}.tar.gz \
&& cd /tmp/openresty-${RESTY_VERSION} \
&& mapfile -t MODULE_CONFIG < /tmp/module-config.args \
&& ./configure -j${RESTY_J} --with-compat --with-http_ssl_module --with-stream --with-stream_ssl_module --with-http_realip_module --with-http_dav_module "${MODULE_CONFIG[@]}" \
&& NGINX_BUILD_DIR="$(find build -mindepth 1 -maxdepth 1 -type d -name 'nginx-*' | head -n 1)" \
&& test -n "${NGINX_BUILD_DIR}" \
&& make -C "${NGINX_BUILD_DIR}" -j${RESTY_J} modules \
&& mkdir -p /out/lib \
&& find "${NGINX_BUILD_DIR}/objs" -maxdepth 1 -type f -name '*.so' -exec cp -a {} /out/ \; \
&& test -n "$(find /out -maxdepth 1 -type f -name '*.so' -print -quit)" \
&& if find /usr/local/lib -maxdepth 1 -name '*.so*' -print -quit 2>/dev/null | grep -q .; then \
find /usr/local/lib -maxdepth 1 -name '*.so*' -exec cp -a {} /out/lib/ \; ; \
fi \
&& find /out -maxdepth 1 -type f -name '*.so' \
-exec patchelf --set-rpath '$ORIGIN/lib:/usr/local/openresty/1pwaf/libraries' {} \;

FROM ${RESTY_IMAGE_BASE}:${RESTY_IMAGE_TAG} AS module-output
COPY --from=module-builder /out /out
CMD ["/bin/true"]
59 changes: 59 additions & 0 deletions apps/openresty/1.29.2.5-0-noble/build/module.catalog.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
[
{
"name": "ngx_brotli",
"script": "",
"packages": [
"libbrotli-dev"
],
"params": "--add-module=/usr/local/openresty/modules/ngx_brotli",
"enable": false,
"buildMode": "auto",
"provider": "local",
"dynamicSupport": "unknown",
"loadOrder": 10
},
{
"name": "rtmp",
"script": "unzip -o /tmp/nginx-rtmp-module.zip -d /tmp",
"packages": [],
"params": "--add-module=/tmp/nginx-rtmp-module",
"enable": false,
"buildMode": "auto",
"provider": "local",
"dynamicSupport": "unknown",
"loadOrder": 20
},
{
"name": "web_dav",
"script": "unzip -o /tmp/nginx-dav-ext-module.zip -d /tmp",
"packages": [],
"params": "--with-http_dav_module --add-module=/tmp/nginx-dav-ext-module",
"enable": false,
"buildMode": "auto",
"provider": "local",
"dynamicSupport": "unknown",
"loadOrder": 30
},
{
"name": "geoip2",
"script": "unzip -o /tmp/ngx_http_geoip2_module.zip -d /tmp && tar -zxvf /tmp/libmaxminddb.tar.gz -C /tmp && cd /tmp/libmaxminddb && ./configure && make && make install",
"packages": [],
"params": "--add-module=/tmp/ngx_http_geoip2_module",
"enable": false,
"buildMode": "auto",
"provider": "local",
"dynamicSupport": "unknown",
"loadOrder": 40
},
{
"name": "http_substitutions_filter",
"script": "unzip -o /tmp/ngx_http_substitutions_filter_module.zip -d /tmp",
"packages": [],
"params": "--add-module=/tmp/ngx_http_substitutions_filter_module",
"enable": false,
"buildMode": "auto",
"provider": "local",
"dynamicSupport": "unknown",
"loadOrder": 50
}
]
Loading