- 浏览: 2552525 次
- 性别:
- 来自: 成都
文章分类
最新评论
-
nation:
你好,在部署Mesos+Spark的运行环境时,出现一个现象, ...
Spark(4)Deal with Mesos -
sillycat:
AMAZON Relatedhttps://www.godad ...
AMAZON API Gateway(2)Client Side SSL with NGINX -
sillycat:
sudo usermod -aG docker ec2-use ...
Docker and VirtualBox(1)Set up Shared Disk for Virtual Box -
sillycat:
Every Half an Hour30 * * * * /u ...
Build Home NAS(3)Data Redundancy -
sillycat:
3 List the Cron Job I Have>c ...
Build Home NAS(3)Data Redundancy
A Rate-Limiting HTTP Proxy(7)Docker and Deployment
We plan to use sudo to run the command to start the nginx on port 80, we need to link the command first
>sudo ln -s /opt/openresty/nginx/sbin/nginx /usr/local/sbin/nginx
On MAC it works well, on RaspberryPI, it has this exception while running it
>sudo nginx -p /opt/luaweb/dist/app -c conf/nginx.conf
nginx: [emerg] getgrnam("owner") failed in /opt/luaweb/dist/app/conf/nginx.conf:1
Solution:
I change the nginx.conf and get rid of owner, it works.
After install the things, the URL for luarocks is as follow:
/tool/luarocks/lib/luarocks/rocks
The Makefile will build the binary and prepare the ENV.
IMAGE=sillycat/public
TAG=raspberrypi-openresty
NAME=raspberrypi-openresty
app-init:
rm -fr install
mkdir install
wget https://openresty.org/download/openresty-1.11.2.3.tar.gz -P install/
wget http://luarocks.github.io/luarocks/releases/luarocks-2.4.2.tar.gz -P install/
app-build:
./package.sh
tar -cvzf ./dist/$(NAME)-1.0.tgz ./luaweb-1.0
docker-context:
build: docker-context
docker build -t $(IMAGE):$(TAG) .
run:
docker run -d -p 80:80 --name $(NAME) $(IMAGE):$(TAG)
debug:
docker run -ti -p 80:80 --name $(NAME) $(IMAGE):$(TAG) /bin/bash
clean:
docker stop ${NAME}
docker rm ${NAME}
logs:
docker logs ${NAME}
publish:
docker push ${IMAGE}:${TAG}
fetch:
docker pull ${IMAGE}:${TAG}
And package.sh will help to binary the lua scripts
#!/usr/bin/env bash
rm -rf ./luaweb-1.0
mkdir -p luaweb-1.0/logs
mkdir -p luaweb-1.0/conf
cp -rf conf/nginx-prod.conf luaweb-1.0/conf/nginx.conf
cp -rf html luaweb-1.0
cp -rf lua luaweb-1.0
cp -rf lualib luaweb-1.0
luajit=/opt/openresty/luajit/bin/luajit
function compile() {
for file in $1
do
if test -f $file
then
$luajit -b $file $file
fi
done
}
compile "./luaweb-1.0/lua/web/*"
compile "./luaweb-1.0/lua/*"
Dockerfile will describe all the steps to set up image
#Set up nginx in Docker
#Prepre the OS
FROM resin/rpi-raspbian:jessie
MAINTAINER Carl Luo <luohuazju@gmail.com>
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get -y update
RUN apt-get install -y apt-utils
RUN apt-get -y dist-upgrade
RUN apt-get install -y build-essential gcc make
RUN apt-get install -y libpcre3 libpcre3-dev zlib1g-dev libgcrypt11-dev
RUN apt-get install -y libssl-dev wget unzip
#install
RUN mkdir -p /tool
RUN mkdir -p /install
#install openresty
ADDinstall/openresty-1.11.2.3.tar.gz /install/
WORKDIR /install/openresty-1.11.2.3
RUN./configure --prefix=/tool/openresty
RUN make
RUN make install
#install luarocks
ADDinstall/luarocks-2.4.2.tar.gz /install/
WORKDIR /install/luarocks-2.4.2
RUN./configure --with-lua="/tool/openresty/luajit" --lua-suffix="jit" --with-lua-include="/tool/openresty/luajit/include/luajit-2.1"
RUNmake build
RUNmake install
#install dependencies
RUNluarocks install md5
#install app
RUNmkdir -p /share/
ADDdist/raspberrypi-openresty-1.0.tgz /share/
#start the application
EXPOSE 80
RUN mkdir -p /app/
ADD start.sh /app/
WORKDIR /app/
CMD[ "./start.sh" ]
RUN ln -sf /dev/stdout /share/luaweb-1.0/logs/access.log
RUN ln -sf /dev/stderr /share/luaweb-1.0/logs/error.log
start.sh is the trigger to start the nginx service
#!/bin/sh -ex
cd /share/luaweb-1.0
/tool/openresty/nginx/sbin/nginx -p /share/luaweb-1.0 -c /share/luaweb-1.0/conf/nginx.conf -g "daemon off;"
References:
Previous Note
http://sillycat.iteye.com/blog/2374164
http://sillycat.iteye.com/blog/2374929
http://sillycat.iteye.com/blog/2374930
http://sillycat.iteye.com/blog/2375094
http://sillycat.iteye.com/blog/2375230
http://sillycat.iteye.com/blog/2376670
http://www.ulos.pl/-configure-error-ssl-modules-require-the-openssl-library
https://serverfault.com/questions/657863/nginx-how-to-use-docker-log-collector-when-nginx-is-running-under-supervisord
We plan to use sudo to run the command to start the nginx on port 80, we need to link the command first
>sudo ln -s /opt/openresty/nginx/sbin/nginx /usr/local/sbin/nginx
On MAC it works well, on RaspberryPI, it has this exception while running it
>sudo nginx -p /opt/luaweb/dist/app -c conf/nginx.conf
nginx: [emerg] getgrnam("owner") failed in /opt/luaweb/dist/app/conf/nginx.conf:1
Solution:
I change the nginx.conf and get rid of owner, it works.
After install the things, the URL for luarocks is as follow:
/tool/luarocks/lib/luarocks/rocks
The Makefile will build the binary and prepare the ENV.
IMAGE=sillycat/public
TAG=raspberrypi-openresty
NAME=raspberrypi-openresty
app-init:
rm -fr install
mkdir install
wget https://openresty.org/download/openresty-1.11.2.3.tar.gz -P install/
wget http://luarocks.github.io/luarocks/releases/luarocks-2.4.2.tar.gz -P install/
app-build:
./package.sh
tar -cvzf ./dist/$(NAME)-1.0.tgz ./luaweb-1.0
docker-context:
build: docker-context
docker build -t $(IMAGE):$(TAG) .
run:
docker run -d -p 80:80 --name $(NAME) $(IMAGE):$(TAG)
debug:
docker run -ti -p 80:80 --name $(NAME) $(IMAGE):$(TAG) /bin/bash
clean:
docker stop ${NAME}
docker rm ${NAME}
logs:
docker logs ${NAME}
publish:
docker push ${IMAGE}:${TAG}
fetch:
docker pull ${IMAGE}:${TAG}
And package.sh will help to binary the lua scripts
#!/usr/bin/env bash
rm -rf ./luaweb-1.0
mkdir -p luaweb-1.0/logs
mkdir -p luaweb-1.0/conf
cp -rf conf/nginx-prod.conf luaweb-1.0/conf/nginx.conf
cp -rf html luaweb-1.0
cp -rf lua luaweb-1.0
cp -rf lualib luaweb-1.0
luajit=/opt/openresty/luajit/bin/luajit
function compile() {
for file in $1
do
if test -f $file
then
$luajit -b $file $file
fi
done
}
compile "./luaweb-1.0/lua/web/*"
compile "./luaweb-1.0/lua/*"
Dockerfile will describe all the steps to set up image
#Set up nginx in Docker
#Prepre the OS
FROM resin/rpi-raspbian:jessie
MAINTAINER Carl Luo <luohuazju@gmail.com>
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get -y update
RUN apt-get install -y apt-utils
RUN apt-get -y dist-upgrade
RUN apt-get install -y build-essential gcc make
RUN apt-get install -y libpcre3 libpcre3-dev zlib1g-dev libgcrypt11-dev
RUN apt-get install -y libssl-dev wget unzip
#install
RUN mkdir -p /tool
RUN mkdir -p /install
#install openresty
ADDinstall/openresty-1.11.2.3.tar.gz /install/
WORKDIR /install/openresty-1.11.2.3
RUN./configure --prefix=/tool/openresty
RUN make
RUN make install
#install luarocks
ADDinstall/luarocks-2.4.2.tar.gz /install/
WORKDIR /install/luarocks-2.4.2
RUN./configure --with-lua="/tool/openresty/luajit" --lua-suffix="jit" --with-lua-include="/tool/openresty/luajit/include/luajit-2.1"
RUNmake build
RUNmake install
#install dependencies
RUNluarocks install md5
#install app
RUNmkdir -p /share/
ADDdist/raspberrypi-openresty-1.0.tgz /share/
#start the application
EXPOSE 80
RUN mkdir -p /app/
ADD start.sh /app/
WORKDIR /app/
CMD[ "./start.sh" ]
RUN ln -sf /dev/stdout /share/luaweb-1.0/logs/access.log
RUN ln -sf /dev/stderr /share/luaweb-1.0/logs/error.log
start.sh is the trigger to start the nginx service
#!/bin/sh -ex
cd /share/luaweb-1.0
/tool/openresty/nginx/sbin/nginx -p /share/luaweb-1.0 -c /share/luaweb-1.0/conf/nginx.conf -g "daemon off;"
References:
Previous Note
http://sillycat.iteye.com/blog/2374164
http://sillycat.iteye.com/blog/2374929
http://sillycat.iteye.com/blog/2374930
http://sillycat.iteye.com/blog/2375094
http://sillycat.iteye.com/blog/2375230
http://sillycat.iteye.com/blog/2376670
http://www.ulos.pl/-configure-error-ssl-modules-require-the-openssl-library
https://serverfault.com/questions/657863/nginx-how-to-use-docker-log-collector-when-nginx-is-running-under-supervisord
发表评论
-
Update Site will come soon
2021-06-02 04:10 1679I am still keep notes my tech n ... -
Stop Update Here
2020-04-28 09:00 316I will stop update here, and mo ... -
NodeJS12 and Zlib
2020-04-01 07:44 476NodeJS12 and Zlib It works as ... -
Docker Swarm 2020(2)Docker Swarm and Portainer
2020-03-31 23:18 369Docker Swarm 2020(2)Docker Swar ... -
Docker Swarm 2020(1)Simply Install and Use Swarm
2020-03-31 07:58 370Docker Swarm 2020(1)Simply Inst ... -
Traefik 2020(1)Introduction and Installation
2020-03-29 13:52 337Traefik 2020(1)Introduction and ... -
Portainer 2020(4)Deploy Nginx and Others
2020-03-20 12:06 431Portainer 2020(4)Deploy Nginx a ... -
Private Registry 2020(1)No auth in registry Nginx AUTH for UI
2020-03-18 00:56 436Private Registry 2020(1)No auth ... -
Docker Compose 2020(1)Installation and Basic
2020-03-15 08:10 374Docker Compose 2020(1)Installat ... -
VPN Server 2020(2)Docker on CentOS in Ubuntu
2020-03-02 08:04 456VPN Server 2020(2)Docker on Cen ... -
Buffer in NodeJS 12 and NodeJS 8
2020-02-25 06:43 385Buffer in NodeJS 12 and NodeJS ... -
NodeJS ENV Similar to JENV and PyENV
2020-02-25 05:14 478NodeJS ENV Similar to JENV and ... -
Prometheus HA 2020(3)AlertManager Cluster
2020-02-24 01:47 424Prometheus HA 2020(3)AlertManag ... -
Serverless with NodeJS and TencentCloud 2020(5)CRON and Settings
2020-02-24 01:46 337Serverless with NodeJS and Tenc ... -
GraphQL 2019(3)Connect to MySQL
2020-02-24 01:48 248GraphQL 2019(3)Connect to MySQL ... -
GraphQL 2019(2)GraphQL and Deploy to Tencent Cloud
2020-02-24 01:48 452GraphQL 2019(2)GraphQL and Depl ... -
GraphQL 2019(1)Apollo Basic
2020-02-19 01:36 328GraphQL 2019(1)Apollo Basic Cl ... -
Serverless with NodeJS and TencentCloud 2020(4)Multiple Handlers and Running wit
2020-02-19 01:19 314Serverless with NodeJS and Tenc ... -
Serverless with NodeJS and TencentCloud 2020(3)Build Tree and Traverse Tree
2020-02-19 01:19 319Serverless with NodeJS and Tenc ... -
Serverless with NodeJS and TencentCloud 2020(2)Trigger SCF in SCF
2020-02-19 01:18 294Serverless with NodeJS and Tenc ...
相关推荐
通过config.json(aka rate-limiting.conf)调整规范。 安全问题:确保您的请求缓存文件不能被公众访问。 用法: [1]编辑您的配置: 笔记: 如果“ die_on_rate_limit”为false,则访问者在受限时将被重定向到“ ...
composer require danharrin/livewire-rate-limiting 引入了速率限制改进功能后,此软件包至少需要Laravelv8.x。 用法 将DanHarrin\LivewireRateLimiting\WithRateLimiting特性应用于您的Livewire组件: <?php ...
haproxy-http-based-rate-limiting 基于HTTP头内容和其他具有HAProxy的高级信息的限速请求的以代码为中心的博客文章的示例配置。 有关如何使用它的详细信息,请参见
other will be delayed// note maxRPS is a shorthand for perMilliseconds: 1000, and it takes precedence// if specified both with maxRequests and perMillisecondsconst http = rateLimit ( axios . create ...
在Node.js环境中,速率限制(Rate Limiting)是一种重要的技术,用于控制应用程序接口(API)或服务的访问速度,防止恶意用户滥用系统资源,保护服务器免受DDoS攻击,以及维护服务的稳定性和可用性。"node-rate-...
部署方式为了使部署工作正常... 在第10个运行服务器上,应返回HTTP状态代码429 Too Many Requests饼干基于cookie的用户标识,如果不存在,则在第一次请求时用户将收到一个cookie CookieName: user-limiter CookieValue:
**速率限制(Rate Limiting)** 速率限制是网络服务中常见的策略,用于防止滥用或保护系统资源。在"Amp-rate-limit.zip"中,可能包含了一个实现速率限制的库或组件,它可能使用令牌桶算法、漏桶算法或其他方法来控制...
fastify-rate-limit 您的路线的低开销速率限制器。 支持 Fastify 2.x - 3.x semver 范围。 Fastify 1.x 兼容性请参考及相关版本。 安装 npm i fastify-rate-limit 用法 注册插件,如果需要,传递一些自定义选项。...
在经济学和博弈论的领域内,"供应限制机制"是通过限制可销售商品的数量来调节市场的一种机制。这种机制试图通过拍卖理论来实现最大化的收益,特别是当卖家对竞标者的估值信息知之甚少时。这类机制的核心在于,通过...
藏经阁-In-Flux Limiting for a Multi-Tenant Logging Service 本文档主要介绍了 Symantec 公司的内部云团队在多租户日志记录服务中实现 In-Flux 限制的解决方案。该解决方案主要针对多租户日志记录服务中存在的...
藏经阁-In-Flux Limiting for a Multi-Tenant Logging Service 本文档主要介绍 Symantec 的内部云团队在构建多租户日志记录服务时遇到的挑战和解决方案。该服务使用 InfluxDB 作为时间序数据存储,旨在处理大量的...
克隆项目$ cd rate-limiting -进入项目文件夹入门最快的入门方法是使用 。 $ docker-compose build$ docker-compose up运行测试$ rake spec 终点GET / api / v1 / home Example: ...
随机模拟MATLAB代码天气描述 该存储库提供了与该论文一起的计算实验:Lee,Jonathan T.,Anderson,Sean,Vergara,Claudio和Callaway,Duncan。 “。” 电力系统研究,(印刷中)。 执照 该代码在MIT许可下提供。...
7. **低开销**:在实际测试中,两种设计均表现出极低的额外开销,这对于大规模部署至关重要。 8. **可扩展性**:TCP中心化设计展示了良好的可扩展性,可以支持数百个节点的部署,同时保持稳健性。 #### 技术细节 -...
hapi-rate-limitor建立在以下坚实而hapi-rate-limitor项目之上: 异步速率限制器 伊奥雷迪斯 请求IP 每个程序包都能完美地解决自己的问题。 hapi-rate-limitor将每个问题的解决方案组合成一个针对hapi的固定速率...
3. **速率限制(Rate-Limiting)**:它可以设置不同的限速策略,例如每秒请求数(RPS)、每分钟请求数等,以适应不同的业务需求。 4. **实时测量**:由于 Redis 的高性能,库可以实现实时的速率测量,确保对快速...
CB速率限制器Couchbase API Rate Limiter是一个超级简单PHP软件包,用于限制对公共API的... 安装CB Rate Limiter的最简单和推荐的方法是通过composer: composer require gnikolovski/cb-rate-limiter如何使用它? 使用
简单速率限制用于node.js Express应用程序的简单限速中间件。 限制应用程序的打开请求数以限制资源利用率,例如套接字连接和内存。 一旦打开的请求太多,则返回...//Or - for limiting only specific routesapp.get('/
Rate limiting的基本原理是通过设置一个时间窗口,在这个窗口内只允许执行一定数量的操作。当操作次数达到预设阈值时,新的请求会被暂时阻塞,直到时间窗口重置。这样可以有效地控制程序的执行速度,避免对目标系统...
安装$ npm install --save cov-rate-limit例考阿const Koa = require ( 'koa' )const RateLimit = require ( 'cov-rate-limit' )const app = new Koa ( )const rateLimiter = RateLimit ( { type : 'koa' , max : ...