feat(apisix): add Cloudron package
- Implements Apache APISIX packaging for Cloudron platform. - Includes Dockerfile, CloudronManifest.json, and start.sh. - Configured to use Cloudron's etcd addon. 🤖 Generated with Gemini CLI Co-Authored-By: Gemini <noreply@google.com>
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIEojCCAwqgAwIBAgIJAK253pMhgCkxMA0GCSqGSIb3DQEBCwUAMFYxCzAJBgNV
|
||||
BAYTAkNOMRIwEAYDVQQIDAlHdWFuZ0RvbmcxDzANBgNVBAcMBlpodUhhaTEPMA0G
|
||||
A1UECgwGaXJlc3R5MREwDwYDVQQDDAh0ZXN0LmNvbTAgFw0xOTA2MjQyMjE4MDVa
|
||||
GA8yMTE5MDUzMTIyMTgwNVowVjELMAkGA1UEBhMCQ04xEjAQBgNVBAgMCUd1YW5n
|
||||
RG9uZzEPMA0GA1UEBwwGWmh1SGFpMQ8wDQYDVQQKDAZpcmVzdHkxETAPBgNVBAMM
|
||||
CHRlc3QuY29tMIIBojANBgkqhkiG9w0BAQEFAAOCAY8AMIIBigKCAYEAyCM0rqJe
|
||||
cvgnCfOw4fATotPwk5Ba0gC2YvIrO+gSbQkyxXF5jhZB3W6BkWUWR4oNFLLSqcVb
|
||||
VDPitz/Mt46Mo8amuS6zTbQetGnBARzPLtmVhJfoeLj0efMiOepOSZflj9Ob4yKR
|
||||
2bGdEFOdHPjm+4ggXU9jMKeLqdVvxll/JiVFBW5smPtW1Oc/BV5terhscJdOgmRr
|
||||
abf9xiIis9/qVYfyGn52u9452V0owUuwP7nZ01jt6iMWEGeQU6mwPENgvj1olji2
|
||||
WjdG2UwpUVp3jp3l7j1ekQ6mI0F7yI+LeHzfUwiyVt1TmtMWn1ztk6FfLRqwJWR/
|
||||
Evm95vnfS3Le4S2ky3XAgn2UnCMyej3wDN6qHR1onpRVeXhrBajbCRDRBMwaNw/1
|
||||
/3Uvza8QKK10PzQR6OcQ0xo9psMkd9j9ts/dTuo2fza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mK4QKBwFYXXjeXiU3d
|
||||
bcrPfe6qNGjfzK+BkhWznuFUMbuxyZWDYQD5yb6ukUosrj7pmZv3BxKcKCvmONU+
|
||||
CHgIXB+hG+R9S2mCcH1qBQoP/RSm+TUzS/Bl2UeuhnFZh2jSZQy3OwryUi6nhF0u
|
||||
LDzMI/6aO1ggsI23Ri0Y9ZtqVKczTkxzdQKR9xvoNBUufjimRlS80sJCEB3Qm20S
|
||||
wzarryret/7GFW1/3cz+hTj9/d45i25zArr3Pocfpur5mfz3fJO8jg==
|
||||
-----END RSA PRIVATE KEY-----
|
@@ -0,0 +1,40 @@
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
# contributor license agreements. See the NOTICE file distributed with
|
||||
# this work for additional information regarding copyright ownership.
|
||||
# The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
# (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
[req]
|
||||
distinguished_name = req_distinguished_name
|
||||
x509_extensions = v3_req
|
||||
prompt = no
|
||||
|
||||
[req_distinguished_name]
|
||||
C = CN
|
||||
ST = GuangDong
|
||||
L = ZhuHai
|
||||
O = iresty
|
||||
CN = test.com
|
||||
|
||||
[v3_req]
|
||||
subjectKeyIdentifier = hash
|
||||
authorityKeyIdentifier = keyid,issuer
|
||||
basicConstraints = CA:TRUE
|
||||
subjectAltName = @alt_names
|
||||
|
||||
[alt_names]
|
||||
DNS.1 = test.com
|
||||
DNS.2 = *.test.com
|
||||
|
||||
## openssl genrsa -out apisix.key 3072 -nodes
|
||||
## openssl req -new -x509 -key apisix.key -sha256 -config openssl.conf -out apisix.crt -days 36500
|
@@ -0,0 +1,131 @@
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
# contributor license agreements. See the NOTICE file distributed with
|
||||
# this work for additional information regarding copyright ownership.
|
||||
# The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
# (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
master_process on;
|
||||
|
||||
worker_processes 1;
|
||||
|
||||
error_log logs/error.log warn;
|
||||
pid logs/nginx.pid;
|
||||
|
||||
worker_rlimit_nofile 20480;
|
||||
|
||||
events {
|
||||
worker_connections 10620;
|
||||
}
|
||||
|
||||
worker_shutdown_timeout 3;
|
||||
|
||||
http {
|
||||
lua_package_path "$prefix/lua/?.lua;;";
|
||||
|
||||
log_format main '$remote_addr - $remote_user [$time_local] $http_host "$request" $status $body_bytes_sent $request_time "$http_referer" "$http_user_agent" $upstream_addr $upstream_status $upstream_response_time';
|
||||
access_log logs/access.log main buffer=16384 flush=5;
|
||||
|
||||
init_by_lua_block {
|
||||
require "resty.core"
|
||||
apisix = require("apisix")
|
||||
apisix.http_init()
|
||||
}
|
||||
|
||||
init_worker_by_lua_block {
|
||||
apisix.http_init_worker()
|
||||
}
|
||||
|
||||
upstream apisix_backend {
|
||||
server 0.0.0.1;
|
||||
balancer_by_lua_block {
|
||||
apisix.http_balancer_phase()
|
||||
}
|
||||
|
||||
keepalive 320;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 9443 ssl;
|
||||
ssl_certificate cert/apisix.crt;
|
||||
ssl_certificate_key cert/apisix.key;
|
||||
ssl_session_cache shared:SSL:1m;
|
||||
|
||||
listen 9080;
|
||||
|
||||
server_tokens off;
|
||||
more_set_headers 'Server: APISIX web server';
|
||||
|
||||
location = /apisix/nginx_status {
|
||||
allow 127.0.0.0/24;
|
||||
access_log off;
|
||||
stub_status;
|
||||
}
|
||||
|
||||
location /apisix/admin {
|
||||
allow 127.0.0.0/24;
|
||||
content_by_lua_block {
|
||||
apisix.http_admin()
|
||||
}
|
||||
}
|
||||
|
||||
ssl_certificate_by_lua_block {
|
||||
apisix.http_ssl_phase()
|
||||
}
|
||||
|
||||
location / {
|
||||
set $upstream_scheme 'http';
|
||||
set $upstream_host $http_host;
|
||||
set $upstream_upgrade '';
|
||||
set $upstream_connection '';
|
||||
set $upstream_uri '';
|
||||
|
||||
access_by_lua_block {
|
||||
apisix.http_access_phase()
|
||||
}
|
||||
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Host $upstream_host;
|
||||
proxy_set_header Upgrade $upstream_upgrade;
|
||||
proxy_set_header Connection $upstream_connection;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_pass_header Server;
|
||||
proxy_pass_header Date;
|
||||
|
||||
### the following x-forwarded-* headers is to send to upstream server
|
||||
|
||||
set $var_x_forwarded_proto $scheme;
|
||||
set $var_x_forwarded_host $host;
|
||||
set $var_x_forwarded_port $server_port;
|
||||
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $var_x_forwarded_proto;
|
||||
proxy_set_header X-Forwarded-Host $var_x_forwarded_host;
|
||||
proxy_set_header X-Forwarded-Port $var_x_forwarded_port;
|
||||
|
||||
# proxy pass
|
||||
proxy_pass $upstream_scheme://apisix_backend$upstream_uri;
|
||||
|
||||
header_filter_by_lua_block {
|
||||
apisix.http_header_filter_phase()
|
||||
}
|
||||
|
||||
body_filter_by_lua_block {
|
||||
apisix.http_body_filter_phase()
|
||||
}
|
||||
|
||||
log_by_lua_block {
|
||||
apisix.http_log_phase()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,74 @@
|
||||
--
|
||||
-- Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
-- contributor license agreements. See the NOTICE file distributed with
|
||||
-- this work for additional information regarding copyright ownership.
|
||||
-- The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
-- (the "License"); you may not use this file except in compliance with
|
||||
-- the License. You may obtain a copy of the License at
|
||||
--
|
||||
-- http://www.apache.org/licenses/LICENSE-2.0
|
||||
--
|
||||
-- Unless required by applicable law or agreed to in writing, software
|
||||
-- distributed under the License is distributed on an "AS IS" BASIS,
|
||||
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
-- See the License for the specific language governing permissions and
|
||||
-- limitations under the License.
|
||||
--
|
||||
local balancer = require "ngx.balancer"
|
||||
local _M = {version = 0.1}
|
||||
|
||||
function _M.http_init()
|
||||
end
|
||||
|
||||
function _M.http_init_worker()
|
||||
end
|
||||
|
||||
local function fake_fetch()
|
||||
ngx.ctx.ip = "127.0.0.1"
|
||||
ngx.ctx.port = 1980
|
||||
end
|
||||
|
||||
function _M.http_access_phase()
|
||||
local uri = ngx.var.uri
|
||||
local host = ngx.var.host
|
||||
local method = ngx.req.get_method()
|
||||
local remote_addr = ngx.var.remote_addr
|
||||
fake_fetch(uri, host, method, remote_addr)
|
||||
end
|
||||
|
||||
function _M.http_header_filter_phase()
|
||||
if ngx.ctx then
|
||||
-- do something
|
||||
end
|
||||
end
|
||||
|
||||
function _M.http_body_filter_phase()
|
||||
if ngx.ctx then
|
||||
-- do something
|
||||
end
|
||||
end
|
||||
|
||||
function _M.http_log_phase()
|
||||
if ngx.ctx then
|
||||
-- do something
|
||||
end
|
||||
end
|
||||
|
||||
function _M.http_admin()
|
||||
end
|
||||
|
||||
function _M.http_ssl_phase()
|
||||
if ngx.ctx then
|
||||
-- do something
|
||||
end
|
||||
end
|
||||
|
||||
function _M.http_balancer_phase()
|
||||
local ok, err = balancer.set_current_peer(ngx.ctx.ip, ngx.ctx.port)
|
||||
if not ok then
|
||||
ngx.log(ngx.ERR, "failed to set the current peer: ", err)
|
||||
return ngx.exit(500)
|
||||
end
|
||||
end
|
||||
|
||||
return _M
|
155
CloudronPackages/APISIX/apisix-source/benchmark/run.sh
Executable file
155
CloudronPackages/APISIX/apisix-source/benchmark/run.sh
Executable file
@@ -0,0 +1,155 @@
|
||||
#! /bin/bash -x
|
||||
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
# contributor license agreements. See the NOTICE file distributed with
|
||||
# this work for additional information regarding copyright ownership.
|
||||
# The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
# (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
if [ -n "$1" ]; then
|
||||
worker_cnt=$1
|
||||
else
|
||||
worker_cnt=1
|
||||
fi
|
||||
|
||||
if [ -n "$2" ]; then
|
||||
upstream_cnt=$2
|
||||
else
|
||||
upstream_cnt=1
|
||||
fi
|
||||
|
||||
mkdir -p benchmark/server/logs
|
||||
mkdir -p benchmark/fake-apisix/logs
|
||||
|
||||
|
||||
make init
|
||||
|
||||
fake_apisix_cmd="openresty -p $PWD/benchmark/fake-apisix -c $PWD/benchmark/fake-apisix/conf/nginx.conf"
|
||||
server_cmd="openresty -p $PWD/benchmark/server -c $PWD/benchmark/server/conf/nginx.conf"
|
||||
|
||||
trap 'onCtrlC' INT
|
||||
function onCtrlC () {
|
||||
sudo killall wrk
|
||||
sudo killall openresty
|
||||
sudo ${fake_apisix_cmd} -s stop || exit 1
|
||||
sudo ${server_cmd} -s stop || exit 1
|
||||
}
|
||||
|
||||
for up_cnt in $(seq 1 $upstream_cnt);
|
||||
do
|
||||
port=$((1979+$up_cnt))
|
||||
nginx_listen=$nginx_listen"listen $port;"
|
||||
upstream_nodes=$upstream_nodes"\"127.0.0.1:$port\":1"
|
||||
|
||||
if [ $up_cnt -lt $upstream_cnt ]; then
|
||||
upstream_nodes=$upstream_nodes","
|
||||
fi
|
||||
done
|
||||
|
||||
sed -i "s/\- proxy-mirror/#\- proxy-mirror/g" conf/config-default.yaml
|
||||
sed -i "s/\- proxy-cache/#\- proxy-cache/g" conf/config-default.yaml
|
||||
sed -i "s/listen .*;/$nginx_listen/g" benchmark/server/conf/nginx.conf
|
||||
|
||||
echo "
|
||||
nginx_config:
|
||||
worker_processes: ${worker_cnt}
|
||||
" > conf/config.yaml
|
||||
|
||||
sudo ${server_cmd} || exit 1
|
||||
|
||||
make run
|
||||
|
||||
sleep 3
|
||||
|
||||
#############################################
|
||||
echo -e "\n\napisix: $worker_cnt worker + $upstream_cnt upstream + no plugin"
|
||||
admin_key=$(yq '.deployment.admin.admin_key[0].key' conf/config.yaml | sed 's/"//g')
|
||||
curl http://127.0.0.1:9180/apisix/admin/routes/1 -H "X-API-KEY: $admin_key" -X PUT -d '
|
||||
{
|
||||
"uri": "/hello",
|
||||
"plugins": {
|
||||
},
|
||||
"upstream": {
|
||||
"type": "roundrobin",
|
||||
"nodes": {
|
||||
'$upstream_nodes'
|
||||
}
|
||||
}
|
||||
}'
|
||||
|
||||
sleep 1
|
||||
|
||||
wrk -d 5 -c 16 http://127.0.0.1:9080/hello
|
||||
|
||||
sleep 1
|
||||
|
||||
wrk -d 5 -c 16 http://127.0.0.1:9080/hello
|
||||
|
||||
sleep 1
|
||||
|
||||
#############################################
|
||||
echo -e "\n\napisix: $worker_cnt worker + $upstream_cnt upstream + 2 plugins (limit-count + prometheus)"
|
||||
admin_key=$(yq '.deployment.admin.admin_key[0].key' conf/config.yaml | sed 's/"//g')
|
||||
curl http://127.0.0.1:9180/apisix/admin/routes/1 -H "X-API-KEY: $admin_key" -X PUT -d '
|
||||
{
|
||||
"uri": "/hello",
|
||||
"plugins": {
|
||||
"limit-count": {
|
||||
"count": 2000000000000,
|
||||
"time_window": 60,
|
||||
"rejected_code": 503,
|
||||
"key": "remote_addr"
|
||||
},
|
||||
"prometheus": {}
|
||||
},
|
||||
"upstream": {
|
||||
"type": "roundrobin",
|
||||
"nodes": {
|
||||
'$upstream_nodes'
|
||||
}
|
||||
}
|
||||
}'
|
||||
|
||||
sleep 3
|
||||
|
||||
wrk -d 5 -c 16 http://127.0.0.1:9080/hello
|
||||
|
||||
sleep 1
|
||||
|
||||
wrk -d 5 -c 16 http://127.0.0.1:9080/hello
|
||||
|
||||
sleep 1
|
||||
|
||||
make stop
|
||||
|
||||
#############################################
|
||||
echo -e "\n\nfake empty apisix server: $worker_cnt worker"
|
||||
|
||||
sleep 1
|
||||
|
||||
sed -i "s/worker_processes [0-9]*/worker_processes $worker_cnt/g" benchmark/fake-apisix/conf/nginx.conf
|
||||
|
||||
sudo ${fake_apisix_cmd} || exit 1
|
||||
|
||||
sleep 1
|
||||
|
||||
wrk -d 5 -c 16 http://127.0.0.1:9080/hello
|
||||
|
||||
sleep 1
|
||||
|
||||
wrk -d 5 -c 16 http://127.0.0.1:9080/hello
|
||||
|
||||
sudo ${fake_apisix_cmd} -s stop || exit 1
|
||||
|
||||
sudo ${server_cmd} -s stop || exit 1
|
@@ -0,0 +1,42 @@
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
# contributor license agreements. See the NOTICE file distributed with
|
||||
# this work for additional information regarding copyright ownership.
|
||||
# The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
# (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
master_process on;
|
||||
|
||||
worker_processes 2;
|
||||
|
||||
error_log logs/error.log warn;
|
||||
pid logs/nginx.pid;
|
||||
|
||||
worker_rlimit_nofile 20480;
|
||||
|
||||
events {
|
||||
accept_mutex off;
|
||||
worker_connections 10620;
|
||||
}
|
||||
|
||||
worker_shutdown_timeout 3;
|
||||
|
||||
http {
|
||||
server {
|
||||
listen 1980;
|
||||
|
||||
access_log off;
|
||||
location / {
|
||||
echo_duplicate 1 "1234567890";
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user