-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add openresty & lua * debug oprenresty
- Loading branch information
Showing
9 changed files
with
156 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Developer Box | ||
|
||
## Develop and Debug - Single User | ||
|
||
```bash | ||
IMG="qpod/developer" | ||
# IMG="registry.cn-hangzhou.aliyuncs.com/qpod/full-stack-dev" | ||
|
||
docker run -d --restart=always \ | ||
--name=QPod-lab-dev \ | ||
--hostname=QPod \ | ||
-p 18888-18890:8888-8890 \ | ||
-v $(pwd):/root/ \ | ||
-w /root/ \ | ||
$IMG | ||
|
||
sleep 5s && docker logs QPod-lab-dev 2>&1|grep token= | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Distributed under the terms of the Modified BSD License. | ||
|
||
ARG BASE_NAMESPACE | ||
ARG BASE_IMG="base" | ||
FROM ${BASE_NAMESPACE:+$BASE_NAMESPACE/}${BASE_IMG} | ||
|
||
LABEL maintainer="haobibo@gmail.com" | ||
|
||
COPY work /opt/utils/ | ||
|
||
RUN source /opt/utils/script-utils.sh && install_apt /opt/utils/install_list_daemon.apt \ | ||
&& source /opt/utils/script-setup-lua.sh && setup_lua_base && setup_lua_rocks \ | ||
&& source /opt/utils/script-setup-openresty.sh && setup_openresty \ | ||
&& source /opt/utils/script-setup-acme.sh && setup_acme \ | ||
&& pip install certbot \ | ||
&& install__clean |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# OpenResty with Lua and certbot | ||
|
||
## Debug | ||
|
||
```shell | ||
docker run -it --rm qpod/base bash | ||
|
||
docker build -t openresty --build-arg BASE_NAMESPACE=qpod . | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
cron |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
libpcre3-dev | ||
libssl-dev | ||
zlib1g-dev |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
source /opt/utils/script-utils.sh | ||
|
||
setup_acme() { | ||
install_tar_gz https://github.com/acmesh-official/acme.sh/archive/refs/heads/master.tar.gz \ | ||
&& mv /opt/acme.sh-* /tmp/acme.sh && cd /tmp/acme.sh \ | ||
&& export ACME_HOME="/opt/acme.sh" \ | ||
&& ./acme.sh --install --force \ | ||
--home ${ACME_HOME} \ | ||
--config-home ${HOME_DIR}/acme/data \ | ||
--cert-home ${HOME_DIR}/acme/certs \ | ||
--accountkey ${HOME_DIR}/acme/account.key \ | ||
--accountconf ${HOME_DIR}/acme/account.conf \ | ||
--useragent "client acme.sh in docker" \ | ||
&& ln -sf /opt/acme.sh/acme.sh /usr/bin/ \ | ||
&& rm -rf /tmp/acme.sh && cd ${ACME_HOME} \ | ||
&& echo "@ Version info of acme.sh: $(acme.sh -v)" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
source /opt/utils/script-utils.sh | ||
|
||
export LUA_HOME=/opt/lua | ||
|
||
setup_lua_base() { | ||
VERSION_LUA=$(curl -sL https://www.lua.org/download.html | grep "cd lua" | head -1 | grep -Po '(\d[\d|.]+)') \ | ||
&& URL_LUA="http://www.lua.org/ftp/lua-${VERSION_LUA}.tar.gz" \ | ||
&& echo "Downloading LUA ${VERSION_LUA} from ${URL_LUA}" \ | ||
&& install_tar_gz $URL_LUA \ | ||
&& mv /opt/lua-* /tmp/lua && cd /tmp/lua \ | ||
&& make linux test && make install INSTALL_TOP=${LUA_HOME} \ | ||
&& ln -sf ${LUA_HOME}/bin/lua* /usr/bin/ \ | ||
&& rm -rf /tmp/lua \ | ||
&& echo "@ Version of LUA installed: $(lua -v)" | ||
} | ||
|
||
setup_lua_rocks() { | ||
## https://github.com/luarocks/luarocks/wiki/Installation-instructions-for-Unix | ||
VERSION_LUA_ROCKS=$(curl -sL https://luarocks.github.io/luarocks/releases/ | grep "linux-x86_64" | head -1 | grep -Po '(\d[\d|.]+)' | head -1) \ | ||
&& URL_LUA_ROCKS="http://luarocks.github.io/luarocks/releases/luarocks-${VERSION_LUA_ROCKS}.tar.gz" \ | ||
&& echo "Downloading luarocks ${VERSION_LUA_ROCKS} from ${URL_LUA_ROCKS}" \ | ||
&& install_tar_gz $URL_LUA_ROCKS \ | ||
&& mv /opt/luarocks-* /tmp/luarocks && cd /tmp/luarocks \ | ||
&& ./configure --prefix=${LUA_HOME} --with-lua-include=${LUA_HOME}/include && make install \ | ||
&& ln -sf /opt/lua/bin/lua* /usr/bin/ \ | ||
&& rm -rf /tmp/luarocks \ | ||
&& echo "@ Version of luarocks: $(luarocks --version)" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
source /opt/utils/script-utils.sh | ||
|
||
setup_openresty() { | ||
install_apt /opt/utils/install_list_nginx.apt \ | ||
&& VERSION_OR=$(curl -sL https://github.com/openresty/openresty/releases.atom | grep "releases/tag" | head -1 | grep -Po '(\d[\d|.]+)') \ | ||
&& URL_OR="https://openresty.org/download/openresty-${VERSION_OR}.tar.gz" \ | ||
&& echo "Downloading OpenResty ${VERSION_OR} from ${URL_OR}" \ | ||
&& install_tar_gz $URL_OR \ | ||
&& mv /opt/openresty-* /tmp/openresty && cd /tmp/openresty \ | ||
&& export NGINX_HOME=/opt/nginx \ | ||
&& ./configure \ | ||
--prefix=${NGINX_HOME}/etc \ | ||
--sbin-path=${NGINX_HOME}/bin/nginx \ | ||
--modules-path=${NGINX_HOME}/modules \ | ||
--conf-path=${NGINX_HOME}/nginx.conf \ | ||
--error-log-path=/var/log/nginx/error.log \ | ||
--http-log-path=/var/log/nginx/access.log \ | ||
--pid-path=/var/run/nginx.pid \ | ||
--lock-path=/var/run/nginx.lock \ | ||
--http-client-body-temp-path=/var/cache/nginx/client_temp \ | ||
--http-proxy-temp-path=/var/cache/nginx/proxy_temp \ | ||
--http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp \ | ||
--http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp \ | ||
--http-scgi-temp-path=/var/cache/nginx/scgi_temp \ | ||
--user=nginx \ | ||
--group=nginx \ | ||
--with-compat \ | ||
--with-threads \ | ||
--with-http_addition_module \ | ||
--with-http_auth_request_module \ | ||
--with-http_dav_module \ | ||
--with-http_flv_module \ | ||
--with-http_gunzip_module \ | ||
--with-http_gzip_static_module \ | ||
--with-http_mp4_module \ | ||
--with-http_random_index_module \ | ||
--with-http_realip_module \ | ||
--with-http_secure_link_module \ | ||
--with-http_slice_module \ | ||
--with-http_ssl_module \ | ||
--with-http_stub_status_module \ | ||
--with-http_sub_module \ | ||
--with-http_v2_module \ | ||
--with-mail \ | ||
--with-mail_ssl_module \ | ||
--with-stream \ | ||
--with-stream_realip_module \ | ||
--with-stream_ssl_module \ | ||
--with-stream_ssl_preread_module \ | ||
&& make -j8 && make install \ | ||
&& ln -sf ${NGINX_HOME}/bin/nginx /usr/bin/ \ | ||
&& echo "@ Version info of Nginx: $(nginx -version)" | ||
} |