From 622e9e20376a96c483b18c01b2d819099af2fed4 Mon Sep 17 00:00:00 2001 From: mritd Date: Tue, 13 Dec 2016 12:58:39 +0800 Subject: [PATCH 001/190] add mritd.me --- install_gitproxy.sh => install_sshproxy.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename install_gitproxy.sh => install_sshproxy.sh (77%) diff --git a/install_gitproxy.sh b/install_sshproxy.sh similarity index 77% rename from install_gitproxy.sh rename to install_sshproxy.sh index bdcc7c1..d5fa5eb 100755 --- a/install_gitproxy.sh +++ b/install_sshproxy.sh @@ -8,8 +8,8 @@ EOF chmod +x /usr/local/bin/proxy-wrapper tee ~/.ssh/config < Date: Tue, 13 Dec 2016 14:14:03 +0800 Subject: [PATCH 002/190] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=20cdn=20yum=E5=90=8C?= =?UTF-8?q?=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- signature_rpm.sh | 6 ++++++ syncrpm.sh | 9 +++++++++ 2 files changed, 15 insertions(+) create mode 100755 syncrpm.sh diff --git a/signature_rpm.sh b/signature_rpm.sh index 8fc88a8..579d8f8 100755 --- a/signature_rpm.sh +++ b/signature_rpm.sh @@ -1,7 +1,9 @@ #/bin/bash +# clean old files rm -f /data/repo/centos/7/x86_64/{kubelet*,kubeadm*,kubernetes-cni*,kubectl*} +# signature rpms echo %_signature gpg > ~/.rpmmacros echo "%_gpg_name mritd (mritd rpm repository)" >> ~/.rpmmacros @@ -10,4 +12,8 @@ for rpmName in `ls ~/kubeadm_release/rpm/output/x86_64/*.rpm`; do cp -f $rpmName /data/repo/centos/7/x86_64 done +# create repodata docker exec -it mritd_rpm_1 /root/flush.sh + +# sync cdn +syncrpm.sh diff --git a/syncrpm.sh b/syncrpm.sh new file mode 100755 index 0000000..9b7c781 --- /dev/null +++ b/syncrpm.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +# clean old files +upx rm centos/7/x86_64/\* +upx rm centos/7/x86_64/repodata/\* + +# sync rpm +cd /data && upx sync repo + From 8c8bdc4b8edf894ac204772a7ac0969e16c5d8da Mon Sep 17 00:00:00 2001 From: mritd Date: Tue, 13 Dec 2016 15:21:38 +0900 Subject: [PATCH 003/190] update sync rpm script --- signature_rpm.sh | 2 +- syncrpm.sh | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/signature_rpm.sh b/signature_rpm.sh index 579d8f8..27bcf86 100755 --- a/signature_rpm.sh +++ b/signature_rpm.sh @@ -16,4 +16,4 @@ done docker exec -it mritd_rpm_1 /root/flush.sh # sync cdn -syncrpm.sh +`pwd`/syncrpm.sh diff --git a/syncrpm.sh b/syncrpm.sh index 9b7c781..ae97b26 100755 --- a/syncrpm.sh +++ b/syncrpm.sh @@ -4,6 +4,9 @@ upx rm centos/7/x86_64/\* upx rm centos/7/x86_64/repodata/\* +# waiting cdn clean cache +sleep 120 + # sync rpm cd /data && upx sync repo From e6edf1ab456e5e38eb3d4a3673d071e77b848581 Mon Sep 17 00:00:00 2001 From: mritd Date: Tue, 13 Dec 2016 14:53:42 +0800 Subject: [PATCH 004/190] =?UTF-8?q?=E5=8F=96=E6=B6=88=20sync=20=E6=96=B9?= =?UTF-8?q?=E5=BC=8F,=E6=89=8B=E5=8A=A8=20put?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- syncrpm.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/syncrpm.sh b/syncrpm.sh index ae97b26..d05e0e1 100755 --- a/syncrpm.sh +++ b/syncrpm.sh @@ -8,5 +8,6 @@ upx rm centos/7/x86_64/repodata/\* sleep 120 # sync rpm -cd /data && upx sync repo +cd /data/centos/7/x86_64/ && for rpmName in `ls *.rpm`;do upx put $rpmName centos/7/x86_64/;done +cd /data/centos/7/x86_64/repodata/ && for repodata in `ls`;do upx put $repodata centos/7/x86_64/repodata/;done From 0537dd9e291f3949a3a30b2ca9cc50cf2ca2c021 Mon Sep 17 00:00:00 2001 From: mritd Date: Tue, 13 Dec 2016 15:58:10 +0900 Subject: [PATCH 005/190] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=9B=AE=E5=BD=95?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- syncrpm.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/syncrpm.sh b/syncrpm.sh index d05e0e1..454654d 100755 --- a/syncrpm.sh +++ b/syncrpm.sh @@ -8,6 +8,6 @@ upx rm centos/7/x86_64/repodata/\* sleep 120 # sync rpm -cd /data/centos/7/x86_64/ && for rpmName in `ls *.rpm`;do upx put $rpmName centos/7/x86_64/;done -cd /data/centos/7/x86_64/repodata/ && for repodata in `ls`;do upx put $repodata centos/7/x86_64/repodata/;done +cd /data/repo/centos/7/x86_64/ && for rpmName in `ls *.rpm`;do upx put $rpmName centos/7/x86_64/;done +cd /data/repo/centos/7/x86_64/repodata/ && for repodata in `ls`;do upx put $repodata centos/7/x86_64/repodata/;done From e31a02d2ed1fcba3a018ec67079fc4e95dc41f5f Mon Sep 17 00:00:00 2001 From: mritd Date: Wed, 14 Dec 2016 15:22:01 +0800 Subject: [PATCH 006/190] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=20nginx=20build=20?= =?UTF-8?q?=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build_nginx.sh | 112 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 112 insertions(+) create mode 100755 build_nginx.sh diff --git a/build_nginx.sh b/build_nginx.sh new file mode 100755 index 0000000..3e9a1ea --- /dev/null +++ b/build_nginx.sh @@ -0,0 +1,112 @@ +#!/bin/bash + +# Nginx 及模块版本 +NGINX_VERSION="1.11.5" +LUAJIT_VERSION="2.0.4" +LUAJIT_MAIN_VERSION="2.0" +LUAJIT_LIB="/usr/local/lib" +LUAJIT_INC="/usr/local/include/luajit-$LUAJIT_MAIN_VERSION" +NGINX_LUA_MODULE_VERSION="0.10.7" +OPENSSL_VERSION="1.1.0c" +HEADERS_MORE_VERSION="0.32" +UPSTREAM_CHECK_VERSION="0.3.0" +DEVEL_KIT_VERSION="0.3.0" + +GPG_KEYS="B0F4253373F8F6F510D42178520A9993A1C052F8" + +# 编译参数 +NGINX_CONFIG="\ + --prefix=/etc/nginx \ + --sbin-path=/usr/sbin/nginx \ + --modules-path=/usr/lib/nginx/modules \ + --conf-path=/etc/nginx/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-http_ssl_module \ + --with-http_realip_module \ + --with-http_addition_module \ + --with-http_sub_module \ + --with-http_dav_module \ + --with-http_flv_module \ + --with-http_mp4_module \ + --with-http_gunzip_module \ + --with-http_gzip_static_module \ + --with-http_random_index_module \ + --with-http_secure_link_module \ + --with-http_stub_status_module \ + --with-http_auth_request_module \ + --with-http_xslt_module=dynamic \ + --with-http_image_filter_module=dynamic \ + --with-http_geoip_module=dynamic \ + --with-http_perl_module=dynamic \ + --with-threads \ + --with-stream \ + --with-stream_ssl_module \ + --with-stream_ssl_preread_module \ + --with-stream_realip_module \ + --with-stream_geoip_module=dynamic \ + --with-http_slice_module \ + --with-mail \ + --with-mail_ssl_module \ + --with-compat \ + --with-file-aio \ + --with-http_v2_module \ + --with-ld-opt=-Wl,-rpath,${LUAJIT_LIB} \ + --with-openssl=/usr/src/openssl-${OPENSSL_VERSION} \ + --add-module=/usr/src/headers-more-nginx-module-${HEADERS_MORE_VERSION} \ + --add-module=/usr/src/nginx_upstream_check_module-${UPSTREAM_CHECK_VERSION} \ + --add-module=/usr/src/ngx_devel_kit-${DEVEL_KIT_VERSION} \ + --add-module=/usr/src/lua-nginx-module-${NGINX_LUA_MODULE_VERSION} \ + " + +# 安装编译依赖 +function _installdep(){ + yum install gcc glibc glibc-devel make openssl \ + openssl-devel pcre pcre-devel zlib zlib-devel \ + kernel-devel curl gnupg libxslt libxslt-devel \ + gd-devel geoip-devel perl-devel git python -y +} + +# 下载依赖模块 +function _downloadfiles(){ + curl -fSL http://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz -o nginx.tar.gz + curl -fSL http://luajit.org/download/LuaJIT-${LUAJIT_VERSION}.tar.gz -o LuaJIT-${LUAJIT_VERSION}.tar.gz + curl -fSL https://github.com/openresty/lua-nginx-module/archive/v${NGINX_LUA_MODULE_VERSION}.tar.gz -o lua-nginx-module-v${NGINX_LUA_MODULE_VERSION}.tar.gz + curl -fSL https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz -o openssl-${OPENSSL_VERSION}.tar.gz + curl -fSL https://github.com/openresty/headers-more-nginx-module/archive/v${HEADERS_MORE_VERSION}.tar.gz -o headers-more-nginx-module-v${HEADERS_MORE_VERSION}.tar.gz + curl -fSL https://github.com/yaoweibin/nginx_upstream_check_module/archive/v${UPSTREAM_CHECK_VERSION}.tar.gz -o nginx_upstream_check_module-v${UPSTREAM_CHECK_VERSION}.tar.gz + curl -fSL https://github.com/simpl/ngx_devel_kit/archive/v${DEVEL_KIT_VERSION}.tar.gz -o ngx_devel_kit-v${DEVEL_KIT_VERSION}.tar.gz + + tar -zxC /usr/src -f nginx.tar.gz + tar -zxC /usr/src -f LuaJIT-${LUAJIT_VERSION}.tar.gz + tar -zxC /usr/src -f lua-nginx-module-v${NGINX_LUA_MODULE_VERSION}.tar.gz + tar -zxC /usr/src -f openssl-${OPENSSL_VERSION}.tar.gz + tar -zxC /usr/src -f headers-more-nginx-module-v${HEADERS_MORE_VERSION}.tar.gz + tar -zxC /usr/src -f nginx_upstream_check_module-v${UPSTREAM_CHECK_VERSION}.tar.gz + tar -zxC /usr/src -f lua-nginx-module-v$NGINX_LUA_MODULE_VERSION.tar.gz + tar -zxC /usr/src -f ngx_devel_kit-v${DEVEL_KIT_VERSION}.tar.gz + + #rm -f nginx.tar.gz + #rm -f LuaJIT-${LUAJIT_VERSION}.tar.gz + #rm -f lua-nginx-module-v${NGINX_LUA_MODULE_VERSION}.tar.gz + #rm -f openssl-${OPENSSL_VERSION}.tar.gz + #rm -f headers-more-nginx-module-v${HEADERS_MORE_VERSION}.tar.gz + #rm -f nginx_upstream_check_module-v${UPSTREAM_CHECK_VERSION}.tar.gz + #rm -f lua-nginx-module-v$NGINX_LUA_MODULE_VERSION.tar.gz + #rm -f ngx_devel_kit-v${DEVEL_KIT_VERSION}.tar.gz +} + +# 编译 Lua +function _buildLua(){ + +} + From 873d9520308b971e9e3b6676fee72ddc6d8a4e97 Mon Sep 17 00:00:00 2001 From: mritd Date: Wed, 14 Dec 2016 15:47:20 +0800 Subject: [PATCH 007/190] install --- build_nginx.sh | 40 +++++++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/build_nginx.sh b/build_nginx.sh index 3e9a1ea..d0a38cb 100755 --- a/build_nginx.sh +++ b/build_nginx.sh @@ -1,6 +1,6 @@ #!/bin/bash -# Nginx 及模块版本 +# Nginx and module dependencies NGINX_VERSION="1.11.5" LUAJIT_VERSION="2.0.4" LUAJIT_MAIN_VERSION="2.0" @@ -12,9 +12,7 @@ HEADERS_MORE_VERSION="0.32" UPSTREAM_CHECK_VERSION="0.3.0" DEVEL_KIT_VERSION="0.3.0" -GPG_KEYS="B0F4253373F8F6F510D42178520A9993A1C052F8" - -# 编译参数 +# build args NGINX_CONFIG="\ --prefix=/etc/nginx \ --sbin-path=/usr/sbin/nginx \ @@ -68,7 +66,7 @@ NGINX_CONFIG="\ --add-module=/usr/src/lua-nginx-module-${NGINX_LUA_MODULE_VERSION} \ " -# 安装编译依赖 +# install build dependencies function _installdep(){ yum install gcc glibc glibc-devel make openssl \ openssl-devel pcre pcre-devel zlib zlib-devel \ @@ -76,7 +74,7 @@ function _installdep(){ gd-devel geoip-devel perl-devel git python -y } -# 下载依赖模块 +# download module dependencies function _downloadfiles(){ curl -fSL http://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz -o nginx.tar.gz curl -fSL http://luajit.org/download/LuaJIT-${LUAJIT_VERSION}.tar.gz -o LuaJIT-${LUAJIT_VERSION}.tar.gz @@ -95,18 +93,26 @@ function _downloadfiles(){ tar -zxC /usr/src -f lua-nginx-module-v$NGINX_LUA_MODULE_VERSION.tar.gz tar -zxC /usr/src -f ngx_devel_kit-v${DEVEL_KIT_VERSION}.tar.gz - #rm -f nginx.tar.gz - #rm -f LuaJIT-${LUAJIT_VERSION}.tar.gz - #rm -f lua-nginx-module-v${NGINX_LUA_MODULE_VERSION}.tar.gz - #rm -f openssl-${OPENSSL_VERSION}.tar.gz - #rm -f headers-more-nginx-module-v${HEADERS_MORE_VERSION}.tar.gz - #rm -f nginx_upstream_check_module-v${UPSTREAM_CHECK_VERSION}.tar.gz - #rm -f lua-nginx-module-v$NGINX_LUA_MODULE_VERSION.tar.gz - #rm -f ngx_devel_kit-v${DEVEL_KIT_VERSION}.tar.gz + rm -f nginx.tar.gz + rm -f LuaJIT-${LUAJIT_VERSION}.tar.gz + rm -f lua-nginx-module-v${NGINX_LUA_MODULE_VERSION}.tar.gz + rm -f openssl-${OPENSSL_VERSION}.tar.gz + rm -f headers-more-nginx-module-v${HEADERS_MORE_VERSION}.tar.gz + rm -f nginx_upstream_check_module-v${UPSTREAM_CHECK_VERSION}.tar.gz + rm -f lua-nginx-module-v$NGINX_LUA_MODULE_VERSION.tar.gz + rm -f ngx_devel_kit-v${DEVEL_KIT_VERSION}.tar.gz } -# 编译 Lua -function _buildLua(){ - +# build and install +function build_install(){ + cd /usr/src/nginx-$NGINX_VERSION + ./configure $CONFIG --with-debug + make -j$(getconf _NPROCESSORS_ONLN) + make install } +_installdep +_downloadfiles +build_install + + From 6e4ebc4b8d922977ea7512c3aef15281f5d35a1b Mon Sep 17 00:00:00 2001 From: mritd Date: Wed, 14 Dec 2016 15:53:57 +0800 Subject: [PATCH 008/190] clean --- build_nginx.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/build_nginx.sh b/build_nginx.sh index d0a38cb..365a905 100755 --- a/build_nginx.sh +++ b/build_nginx.sh @@ -111,8 +111,14 @@ function build_install(){ make install } +# clean +function _clean(){ + rm -rf /usr/src/* +} + _installdep _downloadfiles build_install +_clean From 22488b5a6b42bf4c93d2b9a6a3e037b3afa8c5f2 Mon Sep 17 00:00:00 2001 From: mritd Date: Wed, 14 Dec 2016 16:04:48 +0800 Subject: [PATCH 009/190] =?UTF-8?q?=E5=8E=BB=E9=99=A4=20LuaJIT?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build_nginx.sh | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/build_nginx.sh b/build_nginx.sh index 365a905..15af9e4 100755 --- a/build_nginx.sh +++ b/build_nginx.sh @@ -2,10 +2,10 @@ # Nginx and module dependencies NGINX_VERSION="1.11.5" -LUAJIT_VERSION="2.0.4" -LUAJIT_MAIN_VERSION="2.0" -LUAJIT_LIB="/usr/local/lib" -LUAJIT_INC="/usr/local/include/luajit-$LUAJIT_MAIN_VERSION" +#LUAJIT_VERSION="2.0.4" +#LUAJIT_MAIN_VERSION="2.0" +#LUAJIT_LIB="/usr/local/lib" +#LUAJIT_INC="/usr/local/include/luajit-$LUAJIT_MAIN_VERSION" NGINX_LUA_MODULE_VERSION="0.10.7" OPENSSL_VERSION="1.1.0c" HEADERS_MORE_VERSION="0.32" @@ -58,7 +58,6 @@ NGINX_CONFIG="\ --with-compat \ --with-file-aio \ --with-http_v2_module \ - --with-ld-opt=-Wl,-rpath,${LUAJIT_LIB} \ --with-openssl=/usr/src/openssl-${OPENSSL_VERSION} \ --add-module=/usr/src/headers-more-nginx-module-${HEADERS_MORE_VERSION} \ --add-module=/usr/src/nginx_upstream_check_module-${UPSTREAM_CHECK_VERSION} \ @@ -77,7 +76,7 @@ function _installdep(){ # download module dependencies function _downloadfiles(){ curl -fSL http://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz -o nginx.tar.gz - curl -fSL http://luajit.org/download/LuaJIT-${LUAJIT_VERSION}.tar.gz -o LuaJIT-${LUAJIT_VERSION}.tar.gz + #curl -fSL http://luajit.org/download/LuaJIT-${LUAJIT_VERSION}.tar.gz -o LuaJIT-${LUAJIT_VERSION}.tar.gz curl -fSL https://github.com/openresty/lua-nginx-module/archive/v${NGINX_LUA_MODULE_VERSION}.tar.gz -o lua-nginx-module-v${NGINX_LUA_MODULE_VERSION}.tar.gz curl -fSL https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz -o openssl-${OPENSSL_VERSION}.tar.gz curl -fSL https://github.com/openresty/headers-more-nginx-module/archive/v${HEADERS_MORE_VERSION}.tar.gz -o headers-more-nginx-module-v${HEADERS_MORE_VERSION}.tar.gz @@ -85,7 +84,7 @@ function _downloadfiles(){ curl -fSL https://github.com/simpl/ngx_devel_kit/archive/v${DEVEL_KIT_VERSION}.tar.gz -o ngx_devel_kit-v${DEVEL_KIT_VERSION}.tar.gz tar -zxC /usr/src -f nginx.tar.gz - tar -zxC /usr/src -f LuaJIT-${LUAJIT_VERSION}.tar.gz + #tar -zxC /usr/src -f LuaJIT-${LUAJIT_VERSION}.tar.gz tar -zxC /usr/src -f lua-nginx-module-v${NGINX_LUA_MODULE_VERSION}.tar.gz tar -zxC /usr/src -f openssl-${OPENSSL_VERSION}.tar.gz tar -zxC /usr/src -f headers-more-nginx-module-v${HEADERS_MORE_VERSION}.tar.gz @@ -94,7 +93,7 @@ function _downloadfiles(){ tar -zxC /usr/src -f ngx_devel_kit-v${DEVEL_KIT_VERSION}.tar.gz rm -f nginx.tar.gz - rm -f LuaJIT-${LUAJIT_VERSION}.tar.gz + #rm -f LuaJIT-${LUAJIT_VERSION}.tar.gz rm -f lua-nginx-module-v${NGINX_LUA_MODULE_VERSION}.tar.gz rm -f openssl-${OPENSSL_VERSION}.tar.gz rm -f headers-more-nginx-module-v${HEADERS_MORE_VERSION}.tar.gz From f2d5ba4917e8085611dc3745bfae87676d7053ca Mon Sep 17 00:00:00 2001 From: mritd Date: Wed, 14 Dec 2016 16:13:46 +0800 Subject: [PATCH 010/190] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E7=BC=96=E8=AF=91?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E5=A4=B1=E6=95=88=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build_nginx.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build_nginx.sh b/build_nginx.sh index 15af9e4..029ec82 100755 --- a/build_nginx.sh +++ b/build_nginx.sh @@ -13,7 +13,7 @@ UPSTREAM_CHECK_VERSION="0.3.0" DEVEL_KIT_VERSION="0.3.0" # build args -NGINX_CONFIG="\ +CONFIG_ARGS="\ --prefix=/etc/nginx \ --sbin-path=/usr/sbin/nginx \ --modules-path=/usr/lib/nginx/modules \ @@ -105,7 +105,7 @@ function _downloadfiles(){ # build and install function build_install(){ cd /usr/src/nginx-$NGINX_VERSION - ./configure $CONFIG --with-debug + ./configure $CONFIG_ARGS --with-debug make -j$(getconf _NPROCESSORS_ONLN) make install } From 12fb5de265765a0c50ac48eb6f4f9c63d74e7761 Mon Sep 17 00:00:00 2001 From: mritd Date: Wed, 14 Dec 2016 16:17:23 +0800 Subject: [PATCH 011/190] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=20Lua=20=E7=BC=BA?= =?UTF-8?q?=E5=A4=B1=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build_nginx.sh | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/build_nginx.sh b/build_nginx.sh index 029ec82..bf05e60 100755 --- a/build_nginx.sh +++ b/build_nginx.sh @@ -2,10 +2,6 @@ # Nginx and module dependencies NGINX_VERSION="1.11.5" -#LUAJIT_VERSION="2.0.4" -#LUAJIT_MAIN_VERSION="2.0" -#LUAJIT_LIB="/usr/local/lib" -#LUAJIT_INC="/usr/local/include/luajit-$LUAJIT_MAIN_VERSION" NGINX_LUA_MODULE_VERSION="0.10.7" OPENSSL_VERSION="1.1.0c" HEADERS_MORE_VERSION="0.32" @@ -70,13 +66,12 @@ function _installdep(){ yum install gcc glibc glibc-devel make openssl \ openssl-devel pcre pcre-devel zlib zlib-devel \ kernel-devel curl gnupg libxslt libxslt-devel \ - gd-devel geoip-devel perl-devel git python -y + gd-devel geoip-devel perl-devel lua lua-devel -y } # download module dependencies function _downloadfiles(){ curl -fSL http://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz -o nginx.tar.gz - #curl -fSL http://luajit.org/download/LuaJIT-${LUAJIT_VERSION}.tar.gz -o LuaJIT-${LUAJIT_VERSION}.tar.gz curl -fSL https://github.com/openresty/lua-nginx-module/archive/v${NGINX_LUA_MODULE_VERSION}.tar.gz -o lua-nginx-module-v${NGINX_LUA_MODULE_VERSION}.tar.gz curl -fSL https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz -o openssl-${OPENSSL_VERSION}.tar.gz curl -fSL https://github.com/openresty/headers-more-nginx-module/archive/v${HEADERS_MORE_VERSION}.tar.gz -o headers-more-nginx-module-v${HEADERS_MORE_VERSION}.tar.gz @@ -84,7 +79,6 @@ function _downloadfiles(){ curl -fSL https://github.com/simpl/ngx_devel_kit/archive/v${DEVEL_KIT_VERSION}.tar.gz -o ngx_devel_kit-v${DEVEL_KIT_VERSION}.tar.gz tar -zxC /usr/src -f nginx.tar.gz - #tar -zxC /usr/src -f LuaJIT-${LUAJIT_VERSION}.tar.gz tar -zxC /usr/src -f lua-nginx-module-v${NGINX_LUA_MODULE_VERSION}.tar.gz tar -zxC /usr/src -f openssl-${OPENSSL_VERSION}.tar.gz tar -zxC /usr/src -f headers-more-nginx-module-v${HEADERS_MORE_VERSION}.tar.gz @@ -93,7 +87,6 @@ function _downloadfiles(){ tar -zxC /usr/src -f ngx_devel_kit-v${DEVEL_KIT_VERSION}.tar.gz rm -f nginx.tar.gz - #rm -f LuaJIT-${LUAJIT_VERSION}.tar.gz rm -f lua-nginx-module-v${NGINX_LUA_MODULE_VERSION}.tar.gz rm -f openssl-${OPENSSL_VERSION}.tar.gz rm -f headers-more-nginx-module-v${HEADERS_MORE_VERSION}.tar.gz From c75e8823b393e7d6965a9ee2d1b55dc5cb5f5690 Mon Sep 17 00:00:00 2001 From: mritd Date: Wed, 14 Dec 2016 16:19:55 +0800 Subject: [PATCH 012/190] =?UTF-8?q?=E8=A7=A3=E5=86=B3=20perl=20=E5=BA=93?= =?UTF-8?q?=E7=BC=BA=E5=A4=B1=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build_nginx.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build_nginx.sh b/build_nginx.sh index bf05e60..be20f12 100755 --- a/build_nginx.sh +++ b/build_nginx.sh @@ -66,7 +66,8 @@ function _installdep(){ yum install gcc glibc glibc-devel make openssl \ openssl-devel pcre pcre-devel zlib zlib-devel \ kernel-devel curl gnupg libxslt libxslt-devel \ - gd-devel geoip-devel perl-devel lua lua-devel -y + gd-devel geoip-devel perl-devel perl-ExtUtils-Embed \ + lua lua-devel -y } # download module dependencies From a046338691684bc9f5dfa0bf4d200b39f07e42dc Mon Sep 17 00:00:00 2001 From: mritd Date: Wed, 14 Dec 2016 16:28:47 +0800 Subject: [PATCH 013/190] =?UTF-8?q?=E8=B0=83=E6=95=B4=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build_nginx.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/build_nginx.sh b/build_nginx.sh index be20f12..7441a27 100755 --- a/build_nginx.sh +++ b/build_nginx.sh @@ -1,12 +1,12 @@ #!/bin/bash # Nginx and module dependencies -NGINX_VERSION="1.11.5" -NGINX_LUA_MODULE_VERSION="0.10.7" -OPENSSL_VERSION="1.1.0c" -HEADERS_MORE_VERSION="0.32" +NGINX_VERSION="1.11.3" +NGINX_LUA_MODULE_VERSION="0.10.6" +OPENSSL_VERSION="1.0.1t" +HEADERS_MORE_VERSION="0.31" UPSTREAM_CHECK_VERSION="0.3.0" -DEVEL_KIT_VERSION="0.3.0" +DEVEL_KIT_VERSION="0.2.19" # build args CONFIG_ARGS="\ From eac67f57941deb2cdafa15a7304b82952ae57b5e Mon Sep 17 00:00:00 2001 From: mritd Date: Wed, 14 Dec 2016 16:35:46 +0800 Subject: [PATCH 014/190] =?UTF-8?q?=E8=B0=83=E6=95=B4=E7=BC=96=E8=AF=91?= =?UTF-8?q?=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build_nginx.sh | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/build_nginx.sh b/build_nginx.sh index 7441a27..97ddf0e 100755 --- a/build_nginx.sh +++ b/build_nginx.sh @@ -11,20 +11,8 @@ DEVEL_KIT_VERSION="0.2.19" # build args CONFIG_ARGS="\ --prefix=/etc/nginx \ - --sbin-path=/usr/sbin/nginx \ - --modules-path=/usr/lib/nginx/modules \ - --conf-path=/etc/nginx/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-http_ssl_module \ --with-http_realip_module \ --with-http_addition_module \ @@ -43,11 +31,6 @@ CONFIG_ARGS="\ --with-http_geoip_module=dynamic \ --with-http_perl_module=dynamic \ --with-threads \ - --with-stream \ - --with-stream_ssl_module \ - --with-stream_ssl_preread_module \ - --with-stream_realip_module \ - --with-stream_geoip_module=dynamic \ --with-http_slice_module \ --with-mail \ --with-mail_ssl_module \ From 4816203290b918b4b4059d0561a37bbc01bc2ba0 Mon Sep 17 00:00:00 2001 From: mritd Date: Wed, 14 Dec 2016 16:36:54 +0800 Subject: [PATCH 015/190] =?UTF-8?q?=E8=B0=83=E6=95=B4=E7=BC=96=E8=AF=91?= =?UTF-8?q?=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build_nginx.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/build_nginx.sh b/build_nginx.sh index 97ddf0e..df9e2cf 100755 --- a/build_nginx.sh +++ b/build_nginx.sh @@ -34,7 +34,6 @@ CONFIG_ARGS="\ --with-http_slice_module \ --with-mail \ --with-mail_ssl_module \ - --with-compat \ --with-file-aio \ --with-http_v2_module \ --with-openssl=/usr/src/openssl-${OPENSSL_VERSION} \ From 7dd456e776841936461e3eb0cdf2f1210ea70d33 Mon Sep 17 00:00:00 2001 From: mritd Date: Wed, 14 Dec 2016 16:46:00 +0800 Subject: [PATCH 016/190] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=20=E5=AE=89=E8=A3=85?= =?UTF-8?q?=E8=B7=AF=E5=BE=84=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build_nginx.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/build_nginx.sh b/build_nginx.sh index df9e2cf..eca5c6e 100755 --- a/build_nginx.sh +++ b/build_nginx.sh @@ -8,9 +8,11 @@ HEADERS_MORE_VERSION="0.31" UPSTREAM_CHECK_VERSION="0.3.0" DEVEL_KIT_VERSION="0.2.19" +PREFIX=$1 + # build args CONFIG_ARGS="\ - --prefix=/etc/nginx \ + --prefix=${PREFIX:-'/usr/local/nginx'} \ --pid-path=/var/run/nginx.pid \ --lock-path=/var/run/nginx.lock \ --with-http_ssl_module \ From a2d7ae67c2d9a46c80b339853a10e00fa5bd1ca8 Mon Sep 17 00:00:00 2001 From: mritd Date: Wed, 14 Dec 2016 17:44:08 +0800 Subject: [PATCH 017/190] =?UTF-8?q?=E8=B0=83=E6=95=B4=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build_nginx.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/build_nginx.sh b/build_nginx.sh index eca5c6e..836d41e 100755 --- a/build_nginx.sh +++ b/build_nginx.sh @@ -1,12 +1,12 @@ #!/bin/bash # Nginx and module dependencies -NGINX_VERSION="1.11.3" -NGINX_LUA_MODULE_VERSION="0.10.6" +NGINX_VERSION="1.11.5" +NGINX_LUA_MODULE_VERSION="0.10.7" OPENSSL_VERSION="1.0.1t" -HEADERS_MORE_VERSION="0.31" +HEADERS_MORE_VERSION="0.32" UPSTREAM_CHECK_VERSION="0.3.0" -DEVEL_KIT_VERSION="0.2.19" +DEVEL_KIT_VERSION="0.3.0" PREFIX=$1 From 5ee9c91b6a1161e15ef2bac1fb66f1c7ff6d9763 Mon Sep 17 00:00:00 2001 From: mritd Date: Thu, 15 Dec 2016 17:59:31 +0800 Subject: [PATCH 018/190] =?UTF-8?q?=E9=87=8D=E6=9E=84+=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E5=9F=BA=E7=A1=80=E5=8C=85=E5=88=B0=20v1.5.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build_rpm_tool.sh | 405 +++++++++++++++++++++++++--------------------- 1 file changed, 220 insertions(+), 185 deletions(-) diff --git a/build_rpm_tool.sh b/build_rpm_tool.sh index d7cdf10..f961b1b 100755 --- a/build_rpm_tool.sh +++ b/build_rpm_tool.sh @@ -7,255 +7,290 @@ targetModel=$1 version=$2 -if [ -z "$targetModel" ] || [ -z "$version" ];then - echo -e "\033[33mtargetModel or version is blank!\033[0m" - echo -e "\033[32mUse ./build_rpm_tool.sh etcd|flannel|kubernetes VSERSION to build rpm\033[0m" - echo -e "\033[32mexample: ./build_rpm_tool.sh etcd 3.0.7\033[0m" - exit 1 -fi +PATH=$PATH:/usr/local/rvm/bin:/usr/local/rvm/rubies/ruby-2.3.0/bin -if [ ! "$targetModel" == "etcd" ] && [ ! "$targetModel" == "flannel" ] && [ ! "$targetModel" == "kubernetes" ] && [ ! "$targetModel" == "k8s" ]; then - echo -e "\033[31mThe script only support etcd|flannel|kubernetes!\033[0m" - echo -e "\033[32mUse build_rpm.sh etcd|flannel|kubernetes VSERSION to build rpm\033[0m" - echo -e "\033[32mexample: ./build_rpm_tool.sh etcd 3.0.7\033[0m" - exit 1 -fi +function _checkInput(){ + if [ -z "$targetModel" ] || [ -z "$version" ];then + echo -e "\033[33mtargetModel or version is blank!\033[0m" + echo -e "\033[32mUse ./build_rpm_tool.sh etcd|flannel|kubernetes VSERSION to build rpm\033[0m" + echo -e "\033[32mexample: ./build_rpm_tool.sh etcd 3.0.7\033[0m" + exit 1 + fi + + if [ ! "$targetModel" == "etcd" ] && [ ! "$targetModel" == "flannel" ] && [ ! "$targetModel" == "kubernetes" ] && [ ! "$targetModel" == "k8s" ]; then + echo -e "\033[31mThe script only support etcd|flannel|kubernetes!\033[0m" + echo -e "\033[32mUse build_rpm.sh etcd|flannel|kubernetes VSERSION to build rpm\033[0m" + echo -e "\033[32mexample: ./build_rpm_tool.sh etcd 3.0.7\033[0m" + exit 1 + fi +} -echo -e "\033[32mbuild $targetModel rpm!\033[0m" -echo -e "\033[32mtarget version: $version\033[0m" -echo -e "\033[33mclean old files!\033[0m" -rm -rf build_tmp -echo -e "\033[32mcreate tmp dir...\033[0m" -if [ ! -d build_rpms ]; then - mkdir build_rpms -fi -mkdir build_tmp && cd build_tmp +function _prebuild(){ + echo -e "\033[33mclean old files!\033[0m" + rm -rf build_tmp + echo -e "\033[32mbuild $targetModel rpm!\033[0m" + echo -e "\033[32mtarget version: $version\033[0m" + echo -e "\033[32mcreate tmp dir...\033[0m" + if [ ! -d build_rpms ]; then + mkdir build_rpms + fi + mkdir build_tmp && cd build_tmp + + _update_installdep + _install_ruby_fpm +} + + +function _update_installdep(){ + # update + echo -e "\033[32msystem updating...\033[0m" + yum update -y + yum upgrade -y + + echo -e "\033[32minstall build tools...\033[0m" + yum install wget which zlib zlib-devel curl git rpm-build \ + epel-release yum-utils libyaml-devel glibc-headers autoconf \ + gcc-c++ glibc-devel readline-devel libffi-devel openssl-devel \ + make automake libtool bison sqlite-devel -y +} + +function _install_ruby_fpm(){ + # install rvm and ruby + echo -e "\033[32minstall rvm...\033[0m" + # wget http://upyun.mritd.me/keys/rvm.key -O rvm.key + # gpg2 --import rvm.key + curl -sSL https://get.rvm.io | bash -s stable + echo "ruby_url=https://cache.ruby-china.org/pub/ruby" >> /usr/local/rvm/user/db + rvm requirements + + echo -e "\033[32minstall ruby...\033[0m" + rvm install 2.3.0 + rvm use 2.3.0 --default + + echo -e "\033[32minstall bundler...\033[0m" + gem install bundler + + echo -e "\033[32minstall fpm...\033[0m" + gem install fpm +} + + +function unpackagerpm(){ + echo -e "\033[32munpackage rpm...\033[0m" + rpm2cpio *.rpm | cpio -idmv + rm -f *.rpm +} + +function build_etcd(){ + echo -e "\033[32mdownload etcd release package...\033[0m" + wget https://github.com/coreos/etcd/releases/download/v$version/etcd-v$version-linux-amd64.tar.gz + tar -zxvf etcd-v$version-linux-amd64.tar.gz + if [ ! -f etcd-v$version-linux-amd64.tar.gz ]; then + echo -e "\033[31merror: download etcd release package failed!\033[0m" + exit 1 + fi -# update -echo -e "\033[32msystem updating...\033[0m" -yum update -y -yum upgrade -y + echo -e "\033[32mdownload etcd old rpm...\033[0m" + yumdownloader etcd -echo -e "\033[32minstall build tools...\033[0m" -yum install wget which zlib zlib-devel curl git rpm-build \ - epel-release yum-utils libyaml-devel glibc-headers autoconf \ - gcc-c++ glibc-devel readline-devel libffi-devel openssl-devel \ - make automake libtool bison sqlite-devel -y + unpackagerpm -# install rvm and ruby -echo -e "\033[32minstall rvm...\033[0m" -PATH=$PATH:/usr/local/rvm/bin:/usr/local/rvm/rubies/ruby-2.3.0/bin -wget http://upyun.mritd.me/keys/rvm.key -O rvm.key -gpg2 --import rvm.key -curl -sSL https://get.rvm.io | bash -s stable -echo "ruby_url=https://cache.ruby-china.org/pub/ruby" >> /usr/local/rvm/user/db -rvm requirements - -echo -e "\033[32minstall ruby...\033[0m" -rvm install 2.3.0 -rvm use 2.3.0 --default - -echo -e "\033[32minstall bundler...\033[0m" -gem install bundler - -echo -e "\033[32minstall fpm...\033[0m" -gem install fpm - -# download target package and make package -if [ "$targetModel" == "etcd" ];then - echo -e "\033[32mdownload etcd release package...\033[0m" - wget https://github.com/coreos/etcd/releases/download/v$version/etcd-v$version-linux-amd64.tar.gz - tar -zxvf etcd-v$version-linux-amd64.tar.gz - if [ ! -f etcd-v$version-linux-amd64.tar.gz ]; then - echo -e "\033[31merror: download etcd release package failed!\033[0m" - exit 1 - fi - - echo -e "\033[32mdownload etcd old rpm...\033[0m" - yumdownloader etcd - - echo -e "\033[32munpackage rpm...\033[0m" - rpm2cpio *.rpm | cpio -idmv - rm -f *.rpm - - echo -e "\033[32mreplace new files...\033[0m" - rm -f usr/bin/* - cp etcd-v$version-linux-amd64/{etcd,etcdctl} usr/bin - - echo -e "\033[32mmake rpm scripts...\033[0m" - tee preinstall.sh </dev/null || groupadd -r etcd getent passwd etcd >/dev/null || useradd -r -g etcd -d /var/lib/etcd \\ - -s /sbin/nologin -c "etcd user" etcd + -s /sbin/nologin -c "etcd user" etcd EOF - tee postinstall.sh </dev/null 2>&1 || : + # Initial installation + systemctl preset etcd.service >/dev/null 2>&1 || : fi chown -R etcd.etcd /var/lib/etcd EOF - tee preuninstall.sh </dev/null 2>&1 || : EOF - echo -e "\033[32mmake new rpm...\033[0m" - fpm -s dir -t rpm -n "etcd" -v $version --pre-install preinstall.sh --post-install postinstall.sh --pre-uninstall preuninstall.sh --post-uninstall postuninstall.sh etc usr var - + echo -e "\033[32mmake new rpm...\033[0m" + fpm -s dir -t rpm -n "etcd" -v $version --pre-install preinstall.sh --post-install postinstall.sh --pre-uninstall preuninstall.sh --post-uninstall postuninstall.sh etc usr var +} -elif [ "$targetModel" == "flannel" ];then - echo -e "\033[32mdownload flannel release package...\033[0m" - wget https://github.com/coreos/flannel/releases/download/v$version/flannel-v$version-linux-amd64.tar.gz - tar -zxvf flannel-v$version-linux-amd64.tar.gz - if [ ! -f flannel-v$version-linux-amd64.tar.gz ]; then - echo -e "\033[31merror: download flannel release package failed!\033[0m" - exit 1 - fi +function build_flannel(){ + echo -e "\033[32mdownload flannel release package...\033[0m" + wget https://github.com/coreos/flannel/releases/download/v$version/flannel-v$version-linux-amd64.tar.gz + tar -zxvf flannel-v$version-linux-amd64.tar.gz + if [ ! -f flannel-v$version-linux-amd64.tar.gz ]; then + echo -e "\033[31merror: download flannel release package failed!\033[0m" + exit 1 + fi - echo -e "\033[32mdownload flannel old rpm...\033[0m" - yumdownloader flannel + echo -e "\033[32mdownload flannel old rpm...\033[0m" + yumdownloader flannel - echo -e "\033[32munpackage rpm...\033[0m" - rpm2cpio *.rpm | cpio -idmv - rm -f *.rpm + unpackagerpm - echo -e "\033[32mreplace new files...\033[0m" - rm -f usr/bin/flanneld - cp flanneld usr/bin/flanneld + echo -e "\033[32mreplace new files...\033[0m" + rm -f usr/bin/flanneld + cp flanneld usr/bin/flanneld - rm -f usr/libexec/flannel/mk-docker-opts.sh - cp mk-docker-opts.sh usr/libexec/flannel/mk-docker-opts.sh + rm -f usr/libexec/flannel/mk-docker-opts.sh + cp mk-docker-opts.sh usr/libexec/flannel/mk-docker-opts.sh - echo -e "\033[32mmake rpm scripts...\033[0m" - tee postinstall.sh </dev/null 2>&1 || : + # Initial installation + systemctl preset flanneld.service >/dev/null 2>&1 || : fi EOF - tee preuninstall.sh </dev/null 2>&1 || : if [ \$1 -ge 1 ] ; then - # Package upgrade, not uninstall - systemctl try-restart flanneld.service >/dev/null 2>&1 || : + # Package upgrade, not uninstall + systemctl try-restart flanneld.service >/dev/null 2>&1 || : fi EOF - echo -e "\033[32mmake new rpm...\033[0m" - fpm -s dir -t rpm -n "flannel" -v $version --post-install postinstall.sh --pre-uninstall preuninstall.sh --post-uninstall postuninstall.sh etc run usr + echo -e "\033[32mmake new rpm...\033[0m" + fpm -s dir -t rpm -n "flannel" -v $version --post-install postinstall.sh --pre-uninstall preuninstall.sh --post-uninstall postuninstall.sh etc run usr + +} + +function build_k8s(){ -elif [ "$targetModel" == "k8s" ] || [ "$targetModel" == "kubernetes" ]; then + BASEPACKAGE=kubernetes-1.5.1-git82450d0.el7.centos.x86_64.rpm - BASEPACKAGE=kubernetes-1.4.5-git5a0a696.el7.centos.x86_64.rpm + echo -e "\033[32mdownload k8s release package...\033[0m" + + allBins=(hyperkube kube-apiserver kube-controller-manager kubectl kube-dns kubelet kubemark kube-proxy kube-scheduler) + for binName in ${allBins[@]};do + echo -e "\033[32mdownload $binName...\033[0m" + wget https://storage.googleapis.com/kubernetes-release/release/v$version/bin/linux/amd64/$binName -O $binName + if [ ! -f $binName ]; then + echo -e "\033[31merrot: download $binName failed!\033[0m" + exit 1 + fi + chmod +x $binName + echo -e "\033[32m$binName download success...\033[0m" + done - echo -e "\033[32mdownload k8s release package...\033[0m" - allBins=(hyperkube kube-apiserver kube-controller-manager kubectl kube-dns kubelet kubemark kube-proxy kube-scheduler) - for binName in ${allBins[@]};do - echo -e "\033[32mdownload $binName...\033[0m" - wget https://storage.googleapis.com/kubernetes-release/release/v$version/bin/linux/amd64/$binName -O $binName - if [ ! -f $binName ]; then - echo -e "\033[31merrot: download $binName failed!\033[0m" - exit 1 + echo -e "\033[32mdownload old kubernetes...\033[0m" + wget http://upyun.mritd.me/rpms/$BASEPACKAGE + if [ ! -f $BASEPACKAGE ]; then + echo -e "\033[31merror: download kubernetes old rpm failed!\033[0m" + exit 1 fi - chmod +x $binName - echo -e "\033[32m$binName download success...\033[0m" - done - - echo -e "\033[32mdownload old kubernetes...\033[0m" - wget http://upyun.mritd.me/kubernetes/$BASEPACKAGE - if [ ! -f $BASEPACKAGE ]; then - echo -e "\033[31merror: download kubernetes old rpm failed!\033[0m" - exit 1 - fi - - echo -e "\033[32munpackage rpm...\033[0m" - rpm2cpio *.rpm | cpio -idmv - rm -f *.rpm - - echo -e "\033[32mreplace new files...\033[0m" - rm -f usr/bin/* - cp hyperkube kube-apiserver kube-controller-manager kubectl kube-dns kubelet kubemark kube-proxy kube-scheduler usr/bin/ - - echo -e "\033[32mmake rpm scripts...\033[0m" - tee preinstall.sh </dev/null || groupadd -r kube getent passwd kube >/dev/null || useradd -r -g kube -d / -s /sbin/nologin \\ - -c "Kubernetes user" kube + -c "Kubernetes user" kube EOF - tee postinstall.sh </dev/null 2>&1 || : + # Initial installation + systemctl preset kube-apiserver kube-scheduler kube-controller-manager kubelet kube-proxy >/dev/null 2>&1 || : fi EOF - tee preuninstall.sh </dev/null 2>&1 || : EOF - echo -e "\033[32mmake new rpm...\033[0m" - fpm -s dir -t rpm -n "kubernetes" -v $version --pre-install preinstall.sh --post-install postinstall.sh --pre-uninstall preuninstall.sh --post-uninstall postuninstall.sh etc usr var + echo -e "\033[32mmake new rpm...\033[0m" + fpm -s dir -t rpm -n "kubernetes" -v $version --pre-install preinstall.sh --post-install postinstall.sh --pre-uninstall preuninstall.sh --post-uninstall postuninstall.sh etc usr var -fi +} +function build(){ -echo -e "\033[32mmove rpms and remove tmp dir...\033[0m" -mv *.rpm ../build_rpms && cd ../ && rm -rf build_tmp - -echo -e "\033[32mbuild seccess!\033[0m" - - -# 谦(zhuang)虚(bi) -# 88 88 -# "" ,d 88 -# 88 88 -# 88,dPYba,,adPYba, 8b,dPPYba, 88 MM88MMM ,adPPYb,88 -# 88P' "88" "8a 88P' "Y8 88 88 a8" `Y88 -# 88 88 88 88 88 88 8b 88 -# 88 88 88 88 88 88, "8a, ,d88 -# 88 88 88 88 88 "Y888 `"8bbdP"Y8 - -echo -e "" -echo -e "\033[32m 88 88\033[0m" -echo -e "\033[32m \"\" ,d 88 \033[0m" -echo -e "\033[32m 88 88\033[0m" -echo -e "\033[32m88,dPYba,,adPYba, 8b,dPPYba, 88 MM88MMM ,adPPYb,88\033[0m" -echo -e "\033[32m88P' \"88\" \"8a 88P' \"Y8 88 88 a8\" \`Y88\033[0m" -echo -e "\033[32m88 88 88 88 88 88 8b 88 \033[0m" -echo -e "\033[32m88 88 88 88 88 88, \"8a, ,d88\033[0m" -echo -e "\033[32m88 88 88 88 88 \"Y888 \`\"8bbdP\"Y8\033[0m" -echo -e "" -echo -e "" + if [ "$targetModel" == "etcd" ];then + build_etcd + elif [ "$targetModel" == "flannel" ];then + build_flannel + elif [ "$targetModel" == "k8s" ] || [ "$targetModel" == "kubernetes" ]; then + build_k8s + fi +} + +function success_zhaungbi(){ + + echo -e "\033[32mmove rpms and remove tmp dir...\033[0m" + mv *.rpm ../build_rpms && cd ../ && rm -rf build_tmp + echo -e "\033[32mbuild seccess!\033[0m" + + + # 谦(zhuang)虚(bi) + # 88 88 + # "" ,d 88 + # 88 88 + # 88,dPYba,,adPYba, 8b,dPPYba, 88 MM88MMM ,adPPYb,88 + # 88P' "88" "8a 88P' "Y8 88 88 a8" `Y88 + # 88 88 88 88 88 88 8b 88 + # 88 88 88 88 88 88, "8a, ,d88 + # 88 88 88 88 88 "Y888 `"8bbdP"Y8 + + echo -e "" + echo -e "\033[32m 88 88\033[0m" + echo -e "\033[32m \"\" ,d 88 \033[0m" + echo -e "\033[32m 88 88\033[0m" + echo -e "\033[32m88,dPYba,,adPYba, 8b,dPPYba, 88 MM88MMM ,adPPYb,88\033[0m" + echo -e "\033[32m88P' \"88\" \"8a 88P' \"Y8 88 88 a8\" \`Y88\033[0m" + echo -e "\033[32m88 88 88 88 88 88 8b 88 \033[0m" + echo -e "\033[32m88 88 88 88 88 88, \"8a, ,d88\033[0m" + echo -e "\033[32m88 88 88 88 88 \"Y888 \`\"8bbdP\"Y8\033[0m" + echo -e "" + echo -e "" +} + + + +_checkInput +_prebuild +build +success_zhaungbi \ No newline at end of file From 85fc516d7807bff83766591fc118278e4220945b Mon Sep 17 00:00:00 2001 From: mritd Date: Thu, 15 Dec 2016 18:09:33 +0800 Subject: [PATCH 019/190] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=9B=AE=E5=BD=95?= =?UTF-8?q?=E9=94=99=E8=AF=AF=20fpm=20=E6=9C=AA=E6=89=BE=E5=88=B0=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build_rpm_tool.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/build_rpm_tool.sh b/build_rpm_tool.sh index f961b1b..315bfe2 100755 --- a/build_rpm_tool.sh +++ b/build_rpm_tool.sh @@ -7,8 +7,6 @@ targetModel=$1 version=$2 -PATH=$PATH:/usr/local/rvm/bin:/usr/local/rvm/rubies/ruby-2.3.0/bin - function _checkInput(){ if [ -z "$targetModel" ] || [ -z "$version" ];then echo -e "\033[33mtargetModel or version is blank!\033[0m" @@ -56,6 +54,8 @@ function _update_installdep(){ } function _install_ruby_fpm(){ + + PATH=$PATH:/usr/local/rvm/bin:/usr/local/rvm/rubies/ruby-2.3.0/bin # install rvm and ruby echo -e "\033[32minstall rvm...\033[0m" # wget http://upyun.mritd.me/keys/rvm.key -O rvm.key @@ -249,6 +249,7 @@ EOF function build(){ + cd build_tmp if [ "$targetModel" == "etcd" ];then build_etcd elif [ "$targetModel" == "flannel" ];then From 3adaf094c1749d363cae0d91a762a83d4c8381be Mon Sep 17 00:00:00 2001 From: mritd Date: Thu, 15 Dec 2016 18:10:20 +0800 Subject: [PATCH 020/190] =?UTF-8?q?=E5=88=A0=E9=99=A4=20=E5=A4=9A=E4=BD=99?= =?UTF-8?q?=E5=91=BD=E4=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build_rpm_tool.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/build_rpm_tool.sh b/build_rpm_tool.sh index 315bfe2..d8cb0c0 100755 --- a/build_rpm_tool.sh +++ b/build_rpm_tool.sh @@ -54,7 +54,7 @@ function _update_installdep(){ } function _install_ruby_fpm(){ - + PATH=$PATH:/usr/local/rvm/bin:/usr/local/rvm/rubies/ruby-2.3.0/bin # install rvm and ruby echo -e "\033[32minstall rvm...\033[0m" @@ -249,7 +249,6 @@ EOF function build(){ - cd build_tmp if [ "$targetModel" == "etcd" ];then build_etcd elif [ "$targetModel" == "flannel" ];then From 82f90fd8cb519fead972c60742ac3ac74749314b Mon Sep 17 00:00:00 2001 From: mritd Date: Thu, 15 Dec 2016 18:20:15 +0800 Subject: [PATCH 021/190] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=20gpg=20=E5=AF=BC?= =?UTF-8?q?=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build_rpm_tool.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/build_rpm_tool.sh b/build_rpm_tool.sh index d8cb0c0..6ec9e1d 100755 --- a/build_rpm_tool.sh +++ b/build_rpm_tool.sh @@ -58,8 +58,7 @@ function _install_ruby_fpm(){ PATH=$PATH:/usr/local/rvm/bin:/usr/local/rvm/rubies/ruby-2.3.0/bin # install rvm and ruby echo -e "\033[32minstall rvm...\033[0m" - # wget http://upyun.mritd.me/keys/rvm.key -O rvm.key - # gpg2 --import rvm.key + curl -sSL https://rvm.io/mpapis.asc | gpg2 --import - curl -sSL https://get.rvm.io | bash -s stable echo "ruby_url=https://cache.ruby-china.org/pub/ruby" >> /usr/local/rvm/user/db rvm requirements From 8c8884bcccd0ce6e74312cd41e631ea93bec504e Mon Sep 17 00:00:00 2001 From: mritd Date: Fri, 16 Dec 2016 09:58:28 +0900 Subject: [PATCH 022/190] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=20kube=20=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- download_kube_image.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/download_kube_image.sh b/download_kube_image.sh index f5fc4dd..40e20da 100755 --- a/download_kube_image.sh +++ b/download_kube_image.sh @@ -2,7 +2,9 @@ # This script is used to download some images and packaged kubernetes used -images=(kube-proxy-amd64:v1.4.6 kube-discovery-amd64:1.0 kubedns-amd64:1.7 kube-scheduler-amd64:v1.4.6 kube-controller-manager-amd64:v1.4.6 kube-apiserver-amd64:v1.4.6 etcd-amd64:2.2.5 kube-dnsmasq-amd64:1.3 exechealthz-amd64:1.1 pause-amd64:3.0 kubernetes-dashboard-amd64:v1.4.2) +KUBEVERSION=$1 + +images=(kube-proxy-amd64:$KUBEVERSION kube-discovery-amd64:1.0 kubedns-amd64:1.7 kube-scheduler-amd64:$KUBEVERSION kube-controller-manager-amd64:$KUBEVERSION kube-apiserver-amd64:$KUBEVERSION etcd-amd64:3.0.14-kubeadm kube-dnsmasq-amd64:1.3 exechealthz-amd64:1.1 pause-amd64:3.0 kubernetes-dashboard-amd64:v1.5.0) echo -e "\033[33mclean old files!\033[0m" rm -rf ~/kube_images > /dev/null 2>&1 From 2e2d12c6367c36c8313e3af0c4e21958858856b9 Mon Sep 17 00:00:00 2001 From: mritd Date: Fri, 16 Dec 2016 10:06:47 +0900 Subject: [PATCH 023/190] =?UTF-8?q?=E6=89=93=E5=8C=85=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- download_kube_image.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/download_kube_image.sh b/download_kube_image.sh index 40e20da..3203412 100755 --- a/download_kube_image.sh +++ b/download_kube_image.sh @@ -8,7 +8,7 @@ images=(kube-proxy-amd64:$KUBEVERSION kube-discovery-amd64:1.0 kubedns-amd64:1.7 echo -e "\033[33mclean old files!\033[0m" rm -rf ~/kube_images > /dev/null 2>&1 -rm -f ~/kube_images.tar.gz > /dev/null 2>&1 +rm -f ~/kube_images-$KUBEVERSION.tar.gz > /dev/null 2>&1 echo -e "\033[32mcreate download directory...\033[0m" mkdir ~/kube_images @@ -32,9 +32,9 @@ for imageName in ${images[@]} ; do done echo -e "\033[32mcreate images package...\033[0m" -(cd ~/kube_images && tar -zcvf ~/kube_images.tar.gz *.tar) +(cd ~/kube_images && tar -zcvf ~/kube_images-$KUBEVERSION.tar.gz *.tar) -if [ -f ~/kube_images.tar.gz ]; then +if [ -f ~/kube_images-$KUBEVERSION.tar.gz ]; then echo -e "\033[32mcreate images package success!\033[0m" echo -e "\033[32mclean temp files...\033[0m" rm -rf ~/kube_images From a6144fcbcb8297b1e742c49135740daef3f6c90f Mon Sep 17 00:00:00 2001 From: mritd Date: Sat, 17 Dec 2016 23:28:15 +0900 Subject: [PATCH 024/190] =?UTF-8?q?=E4=BD=BF=E7=94=A8=E7=A8=B3=E5=AE=9A?= =?UTF-8?q?=E7=89=88=E5=86=85=E6=A0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kernel_update.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel_update.sh b/kernel_update.sh index 1e679ea..94dae1f 100755 --- a/kernel_update.sh +++ b/kernel_update.sh @@ -7,7 +7,7 @@ rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm # install kernel -yum --enablerepo=elrepo-kernel install kernel-ml-devel kernel-ml -y +yum --enablerepo=elrepo-kernel install kernel-lt-devel kernel-lt -y # modify grub grub2-set-default 0 From 9ff27006442ba1b3fbc15a7df9ae7d2771b9c2aa Mon Sep 17 00:00:00 2001 From: mritd Date: Mon, 19 Dec 2016 14:00:22 +0900 Subject: [PATCH 025/190] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=A4=87=E4=BB=BD?= =?UTF-8?q?=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backup.sh | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100755 backup.sh diff --git a/backup.sh b/backup.sh new file mode 100755 index 0000000..77a79ee --- /dev/null +++ b/backup.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +rm -rf /backup >& /dev/null && mkdir /backup + +cd / && tar -zcvf root.tar.gz root && mv root.tar.gz /backup +cd / && tar -zcvf data.tar.gz data && mv data.tar.gz /backup +cd /etc && tar -zcvf nginx.tar.gz nginx && mv nginx.tar.gz /backup From 46c3f06b8dc7d197dcfe2306695505046d351f5f Mon Sep 17 00:00:00 2001 From: mritd Date: Thu, 22 Dec 2016 16:01:07 +0900 Subject: [PATCH 026/190] =?UTF-8?q?=E8=B0=83=E6=95=B4=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build_nginx.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_nginx.sh b/build_nginx.sh index 836d41e..cbb90bb 100755 --- a/build_nginx.sh +++ b/build_nginx.sh @@ -1,7 +1,7 @@ #!/bin/bash # Nginx and module dependencies -NGINX_VERSION="1.11.5" +NGINX_VERSION="1.11.6" NGINX_LUA_MODULE_VERSION="0.10.7" OPENSSL_VERSION="1.0.1t" HEADERS_MORE_VERSION="0.32" From 163bfcecd1a8eb6fa96c89619d85a4282655d538 Mon Sep 17 00:00:00 2001 From: mritd Date: Thu, 22 Dec 2016 16:21:20 +0800 Subject: [PATCH 027/190] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E5=89=8D=E7=BC=80?= =?UTF-8?q?=E8=B7=AF=E5=BE=84=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build_nginx.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_nginx.sh b/build_nginx.sh index cbb90bb..94020dd 100755 --- a/build_nginx.sh +++ b/build_nginx.sh @@ -12,7 +12,7 @@ PREFIX=$1 # build args CONFIG_ARGS="\ - --prefix=${PREFIX:-'/usr/local/nginx'} \ + --prefix=${PREFIX:-/usr/local/nginx} \ --pid-path=/var/run/nginx.pid \ --lock-path=/var/run/nginx.lock \ --with-http_ssl_module \ From 6c140b1a569670feb510a0c08b83f8a2cca036c1 Mon Sep 17 00:00:00 2001 From: mritd Date: Mon, 26 Dec 2016 08:16:47 +0800 Subject: [PATCH 028/190] add Lua install --- build_nginx.sh | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/build_nginx.sh b/build_nginx.sh index 94020dd..03c39c5 100755 --- a/build_nginx.sh +++ b/build_nginx.sh @@ -7,6 +7,9 @@ OPENSSL_VERSION="1.0.1t" HEADERS_MORE_VERSION="0.32" UPSTREAM_CHECK_VERSION="0.3.0" DEVEL_KIT_VERSION="0.3.0" +LUAJIT_MAIN_VERSION="2.0" +LUAJIT_LIB="/usr/local/lib" +LUAJIT_INC="/usr/local/include/luajit-$LUAJIT_MAIN_VERSION" PREFIX=$1 @@ -62,6 +65,7 @@ function _downloadfiles(){ curl -fSL https://github.com/openresty/headers-more-nginx-module/archive/v${HEADERS_MORE_VERSION}.tar.gz -o headers-more-nginx-module-v${HEADERS_MORE_VERSION}.tar.gz curl -fSL https://github.com/yaoweibin/nginx_upstream_check_module/archive/v${UPSTREAM_CHECK_VERSION}.tar.gz -o nginx_upstream_check_module-v${UPSTREAM_CHECK_VERSION}.tar.gz curl -fSL https://github.com/simpl/ngx_devel_kit/archive/v${DEVEL_KIT_VERSION}.tar.gz -o ngx_devel_kit-v${DEVEL_KIT_VERSION}.tar.gz + curl -fSL http://luajit.org/download/LuaJIT-$LUAJIT_VERSION.tar.gz -o LuaJIT-$LUAJIT_VERSION.tar.gz tar -zxC /usr/src -f nginx.tar.gz tar -zxC /usr/src -f lua-nginx-module-v${NGINX_LUA_MODULE_VERSION}.tar.gz @@ -70,6 +74,7 @@ function _downloadfiles(){ tar -zxC /usr/src -f nginx_upstream_check_module-v${UPSTREAM_CHECK_VERSION}.tar.gz tar -zxC /usr/src -f lua-nginx-module-v$NGINX_LUA_MODULE_VERSION.tar.gz tar -zxC /usr/src -f ngx_devel_kit-v${DEVEL_KIT_VERSION}.tar.gz + tar -zxC /usr/src -f LuaJIT-$LUAJIT_VERSION.tar.gz rm -f nginx.tar.gz rm -f lua-nginx-module-v${NGINX_LUA_MODULE_VERSION}.tar.gz @@ -78,10 +83,18 @@ function _downloadfiles(){ rm -f nginx_upstream_check_module-v${UPSTREAM_CHECK_VERSION}.tar.gz rm -f lua-nginx-module-v$NGINX_LUA_MODULE_VERSION.tar.gz rm -f ngx_devel_kit-v${DEVEL_KIT_VERSION}.tar.gz + rm -f LuaJIT-$LUAJIT_VERSION.tar.gz } -# build and install -function build_install(){ +# install Lua +function install_lua(){ + cd /usr/src/LuaJIT-$LUAJIT_VERSION + make -j$(getconf _NPROCESSORS_ONLN) + make install +} + +# install nginx +function install_nginx(){ cd /usr/src/nginx-$NGINX_VERSION ./configure $CONFIG_ARGS --with-debug make -j$(getconf _NPROCESSORS_ONLN) @@ -95,7 +108,8 @@ function _clean(){ _installdep _downloadfiles -build_install +install_lua +install_nginx _clean From 7d76865e265e642e7e5c1e70684c095f4e0a2839 Mon Sep 17 00:00:00 2001 From: mritd Date: Mon, 26 Dec 2016 08:20:25 +0800 Subject: [PATCH 029/190] fix Lua Version missing --- build_nginx.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/build_nginx.sh b/build_nginx.sh index 03c39c5..3b077c5 100755 --- a/build_nginx.sh +++ b/build_nginx.sh @@ -7,6 +7,7 @@ OPENSSL_VERSION="1.0.1t" HEADERS_MORE_VERSION="0.32" UPSTREAM_CHECK_VERSION="0.3.0" DEVEL_KIT_VERSION="0.3.0" +LUAJIT_VERSION="2.0.4" LUAJIT_MAIN_VERSION="2.0" LUAJIT_LIB="/usr/local/lib" LUAJIT_INC="/usr/local/include/luajit-$LUAJIT_MAIN_VERSION" From 11e27e0bb64b6ee1edd76d8291a315494ea8f59a Mon Sep 17 00:00:00 2001 From: mritd Date: Mon, 26 Dec 2016 08:28:16 +0800 Subject: [PATCH 030/190] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=AE=89=E8=A3=85?= =?UTF-8?q?=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build_nginx.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/build_nginx.sh b/build_nginx.sh index 3b077c5..269eda4 100755 --- a/build_nginx.sh +++ b/build_nginx.sh @@ -51,6 +51,7 @@ CONFIG_ARGS="\ # install build dependencies function _installdep(){ + echo -e "\033[32minstall build dependencies...\033[0m" yum install gcc glibc glibc-devel make openssl \ openssl-devel pcre pcre-devel zlib zlib-devel \ kernel-devel curl gnupg libxslt libxslt-devel \ @@ -60,6 +61,7 @@ function _installdep(){ # download module dependencies function _downloadfiles(){ + echo -e "\033[32mdownload module dependencies...\033[0m" curl -fSL http://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz -o nginx.tar.gz curl -fSL https://github.com/openresty/lua-nginx-module/archive/v${NGINX_LUA_MODULE_VERSION}.tar.gz -o lua-nginx-module-v${NGINX_LUA_MODULE_VERSION}.tar.gz curl -fSL https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz -o openssl-${OPENSSL_VERSION}.tar.gz @@ -89,6 +91,7 @@ function _downloadfiles(){ # install Lua function install_lua(){ + echo -e "\033[32minstall Lua $LUAJIT_VERSION ...\033[0m" cd /usr/src/LuaJIT-$LUAJIT_VERSION make -j$(getconf _NPROCESSORS_ONLN) make install @@ -96,6 +99,7 @@ function install_lua(){ # install nginx function install_nginx(){ + echo -e "\033[32minstall nginx $NGINX_VERSION ...\033[0m" cd /usr/src/nginx-$NGINX_VERSION ./configure $CONFIG_ARGS --with-debug make -j$(getconf _NPROCESSORS_ONLN) @@ -104,6 +108,7 @@ function install_nginx(){ # clean function _clean(){ + echo -e "\033[32mcleaning files...\033[0m" rm -rf /usr/src/* } From 38a2639e53892372c33963bfd86518f39bd955bd Mon Sep 17 00:00:00 2001 From: mritd Date: Mon, 26 Dec 2016 09:53:15 +0800 Subject: [PATCH 031/190] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=BC=93=E5=AD=98?= =?UTF-8?q?=E7=9B=AE=E5=BD=95=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build_nginx.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/build_nginx.sh b/build_nginx.sh index 269eda4..811b185 100755 --- a/build_nginx.sh +++ b/build_nginx.sh @@ -47,6 +47,11 @@ CONFIG_ARGS="\ --add-module=/usr/src/nginx_upstream_check_module-${UPSTREAM_CHECK_VERSION} \ --add-module=/usr/src/ngx_devel_kit-${DEVEL_KIT_VERSION} \ --add-module=/usr/src/lua-nginx-module-${NGINX_LUA_MODULE_VERSION} \ + --http-client-body-temp-path=/tmp/nginx/client_body_temp \ + --http-proxy-temp-path=/tmp/nginx/proxy_temp \ + --http-fastcgi-temp-path=/tmp/nginx/fastcgi_temp \ + --http-uwsgi-temp-path=/tmp/nginx/uwsgi_temp \ + --http-scgi-temp-path=/tmp/nginx/scgi_temp \ " # install build dependencies From 950fbf65995e6817729eb4041d16cc53892a85a1 Mon Sep 17 00:00:00 2001 From: mritd Date: Mon, 26 Dec 2016 10:14:57 +0800 Subject: [PATCH 032/190] =?UTF-8?q?=E5=88=A0=E9=99=A4=20tab?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build_nginx.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_nginx.sh b/build_nginx.sh index 811b185..708097a 100755 --- a/build_nginx.sh +++ b/build_nginx.sh @@ -47,7 +47,7 @@ CONFIG_ARGS="\ --add-module=/usr/src/nginx_upstream_check_module-${UPSTREAM_CHECK_VERSION} \ --add-module=/usr/src/ngx_devel_kit-${DEVEL_KIT_VERSION} \ --add-module=/usr/src/lua-nginx-module-${NGINX_LUA_MODULE_VERSION} \ - --http-client-body-temp-path=/tmp/nginx/client_body_temp \ + --http-client-body-temp-path=/tmp/nginx/client_body_temp \ --http-proxy-temp-path=/tmp/nginx/proxy_temp \ --http-fastcgi-temp-path=/tmp/nginx/fastcgi_temp \ --http-uwsgi-temp-path=/tmp/nginx/uwsgi_temp \ From add1ebe5ed0bec7cfd5e6d4ac731c027143224d9 Mon Sep 17 00:00:00 2001 From: mritd Date: Mon, 26 Dec 2016 10:25:09 +0800 Subject: [PATCH 033/190] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=BC=93=E5=AD=98?= =?UTF-8?q?=E7=9B=AE=E5=BD=95=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build_nginx.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/build_nginx.sh b/build_nginx.sh index 708097a..c77ff6e 100755 --- a/build_nginx.sh +++ b/build_nginx.sh @@ -47,11 +47,11 @@ CONFIG_ARGS="\ --add-module=/usr/src/nginx_upstream_check_module-${UPSTREAM_CHECK_VERSION} \ --add-module=/usr/src/ngx_devel_kit-${DEVEL_KIT_VERSION} \ --add-module=/usr/src/lua-nginx-module-${NGINX_LUA_MODULE_VERSION} \ - --http-client-body-temp-path=/tmp/nginx/client_body_temp \ - --http-proxy-temp-path=/tmp/nginx/proxy_temp \ - --http-fastcgi-temp-path=/tmp/nginx/fastcgi_temp \ - --http-uwsgi-temp-path=/tmp/nginx/uwsgi_temp \ - --http-scgi-temp-path=/tmp/nginx/scgi_temp \ + --http-client-body-temp-path=/tmp/client_body_temp \ + --http-proxy-temp-path=/tmp/proxy_temp \ + --http-fastcgi-temp-path=/tmp/fastcgi_temp \ + --http-uwsgi-temp-path=/tmp/uwsgi_temp \ + --http-scgi-temp-path=/tmp/scgi_temp \ " # install build dependencies From 1e1be988dc30eaf29a368e3590bcdcbd09a60fb4 Mon Sep 17 00:00:00 2001 From: mritd Date: Mon, 26 Dec 2016 14:59:32 +0800 Subject: [PATCH 034/190] =?UTF-8?q?=E5=8D=87=E7=BA=A7=20openssl=20?= =?UTF-8?q?=E4=BB=A5=E6=94=AF=E6=8C=81=20http2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build_nginx.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_nginx.sh b/build_nginx.sh index c77ff6e..f64d6e8 100755 --- a/build_nginx.sh +++ b/build_nginx.sh @@ -3,7 +3,7 @@ # Nginx and module dependencies NGINX_VERSION="1.11.6" NGINX_LUA_MODULE_VERSION="0.10.7" -OPENSSL_VERSION="1.0.1t" +OPENSSL_VERSION="1.0.2j" HEADERS_MORE_VERSION="0.32" UPSTREAM_CHECK_VERSION="0.3.0" DEVEL_KIT_VERSION="0.3.0" From 6da4c20d9d6d44bb32be7d90f5e943679c0ee73b Mon Sep 17 00:00:00 2001 From: mritd Date: Mon, 26 Dec 2016 21:03:24 +0800 Subject: [PATCH 035/190] =?UTF-8?q?=E5=8E=BB=E9=99=A4=20openssl=20?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build_nginx.sh | 5 ----- 1 file changed, 5 deletions(-) diff --git a/build_nginx.sh b/build_nginx.sh index f64d6e8..f80522d 100755 --- a/build_nginx.sh +++ b/build_nginx.sh @@ -3,7 +3,6 @@ # Nginx and module dependencies NGINX_VERSION="1.11.6" NGINX_LUA_MODULE_VERSION="0.10.7" -OPENSSL_VERSION="1.0.2j" HEADERS_MORE_VERSION="0.32" UPSTREAM_CHECK_VERSION="0.3.0" DEVEL_KIT_VERSION="0.3.0" @@ -42,7 +41,6 @@ CONFIG_ARGS="\ --with-mail_ssl_module \ --with-file-aio \ --with-http_v2_module \ - --with-openssl=/usr/src/openssl-${OPENSSL_VERSION} \ --add-module=/usr/src/headers-more-nginx-module-${HEADERS_MORE_VERSION} \ --add-module=/usr/src/nginx_upstream_check_module-${UPSTREAM_CHECK_VERSION} \ --add-module=/usr/src/ngx_devel_kit-${DEVEL_KIT_VERSION} \ @@ -69,7 +67,6 @@ function _downloadfiles(){ echo -e "\033[32mdownload module dependencies...\033[0m" curl -fSL http://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz -o nginx.tar.gz curl -fSL https://github.com/openresty/lua-nginx-module/archive/v${NGINX_LUA_MODULE_VERSION}.tar.gz -o lua-nginx-module-v${NGINX_LUA_MODULE_VERSION}.tar.gz - curl -fSL https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz -o openssl-${OPENSSL_VERSION}.tar.gz curl -fSL https://github.com/openresty/headers-more-nginx-module/archive/v${HEADERS_MORE_VERSION}.tar.gz -o headers-more-nginx-module-v${HEADERS_MORE_VERSION}.tar.gz curl -fSL https://github.com/yaoweibin/nginx_upstream_check_module/archive/v${UPSTREAM_CHECK_VERSION}.tar.gz -o nginx_upstream_check_module-v${UPSTREAM_CHECK_VERSION}.tar.gz curl -fSL https://github.com/simpl/ngx_devel_kit/archive/v${DEVEL_KIT_VERSION}.tar.gz -o ngx_devel_kit-v${DEVEL_KIT_VERSION}.tar.gz @@ -77,7 +74,6 @@ function _downloadfiles(){ tar -zxC /usr/src -f nginx.tar.gz tar -zxC /usr/src -f lua-nginx-module-v${NGINX_LUA_MODULE_VERSION}.tar.gz - tar -zxC /usr/src -f openssl-${OPENSSL_VERSION}.tar.gz tar -zxC /usr/src -f headers-more-nginx-module-v${HEADERS_MORE_VERSION}.tar.gz tar -zxC /usr/src -f nginx_upstream_check_module-v${UPSTREAM_CHECK_VERSION}.tar.gz tar -zxC /usr/src -f lua-nginx-module-v$NGINX_LUA_MODULE_VERSION.tar.gz @@ -86,7 +82,6 @@ function _downloadfiles(){ rm -f nginx.tar.gz rm -f lua-nginx-module-v${NGINX_LUA_MODULE_VERSION}.tar.gz - rm -f openssl-${OPENSSL_VERSION}.tar.gz rm -f headers-more-nginx-module-v${HEADERS_MORE_VERSION}.tar.gz rm -f nginx_upstream_check_module-v${UPSTREAM_CHECK_VERSION}.tar.gz rm -f lua-nginx-module-v$NGINX_LUA_MODULE_VERSION.tar.gz From a4589576ddf027241524e674ed05072fd84dc417 Mon Sep 17 00:00:00 2001 From: mritd Date: Mon, 26 Dec 2016 21:12:03 +0800 Subject: [PATCH 036/190] =?UTF-8?q?=E5=90=8C=E5=AE=89=E8=A3=85=20openssl-d?= =?UTF-8?q?evel=20=E7=9B=B8=E6=AF=94=E6=84=9F=E8=A7=89=E8=BF=98=E6=98=AF?= =?UTF-8?q?=E6=8C=87=E5=AE=9A=E4=B8=8B=E7=89=88=E6=9C=AC=E6=AF=94=E8=BE=83?= =?UTF-8?q?=E5=A5=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build_nginx.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/build_nginx.sh b/build_nginx.sh index f80522d..869ccad 100755 --- a/build_nginx.sh +++ b/build_nginx.sh @@ -3,6 +3,7 @@ # Nginx and module dependencies NGINX_VERSION="1.11.6" NGINX_LUA_MODULE_VERSION="0.10.7" +OPENSSL_VERSION="1.0.2j" HEADERS_MORE_VERSION="0.32" UPSTREAM_CHECK_VERSION="0.3.0" DEVEL_KIT_VERSION="0.3.0" @@ -41,6 +42,7 @@ CONFIG_ARGS="\ --with-mail_ssl_module \ --with-file-aio \ --with-http_v2_module \ + --with-openssl=/usr/src/openssl-${OPENSSL_VERSION} \ --add-module=/usr/src/headers-more-nginx-module-${HEADERS_MORE_VERSION} \ --add-module=/usr/src/nginx_upstream_check_module-${UPSTREAM_CHECK_VERSION} \ --add-module=/usr/src/ngx_devel_kit-${DEVEL_KIT_VERSION} \ @@ -66,6 +68,7 @@ function _installdep(){ function _downloadfiles(){ echo -e "\033[32mdownload module dependencies...\033[0m" curl -fSL http://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz -o nginx.tar.gz + curl -fSL https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz -o openssl-${OPENSSL_VERSION}.tar.gz curl -fSL https://github.com/openresty/lua-nginx-module/archive/v${NGINX_LUA_MODULE_VERSION}.tar.gz -o lua-nginx-module-v${NGINX_LUA_MODULE_VERSION}.tar.gz curl -fSL https://github.com/openresty/headers-more-nginx-module/archive/v${HEADERS_MORE_VERSION}.tar.gz -o headers-more-nginx-module-v${HEADERS_MORE_VERSION}.tar.gz curl -fSL https://github.com/yaoweibin/nginx_upstream_check_module/archive/v${UPSTREAM_CHECK_VERSION}.tar.gz -o nginx_upstream_check_module-v${UPSTREAM_CHECK_VERSION}.tar.gz @@ -73,6 +76,7 @@ function _downloadfiles(){ curl -fSL http://luajit.org/download/LuaJIT-$LUAJIT_VERSION.tar.gz -o LuaJIT-$LUAJIT_VERSION.tar.gz tar -zxC /usr/src -f nginx.tar.gz + tar -zxC /usr/src -f openssl-${OPENSSL_VERSION}.tar.gz tar -zxC /usr/src -f lua-nginx-module-v${NGINX_LUA_MODULE_VERSION}.tar.gz tar -zxC /usr/src -f headers-more-nginx-module-v${HEADERS_MORE_VERSION}.tar.gz tar -zxC /usr/src -f nginx_upstream_check_module-v${UPSTREAM_CHECK_VERSION}.tar.gz @@ -81,6 +85,7 @@ function _downloadfiles(){ tar -zxC /usr/src -f LuaJIT-$LUAJIT_VERSION.tar.gz rm -f nginx.tar.gz + rm -f openssl-${OPENSSL_VERSION}.tar.gz rm -f lua-nginx-module-v${NGINX_LUA_MODULE_VERSION}.tar.gz rm -f headers-more-nginx-module-v${HEADERS_MORE_VERSION}.tar.gz rm -f nginx_upstream_check_module-v${UPSTREAM_CHECK_VERSION}.tar.gz From bdb77da3db25154118340efc34672e6f972bca30 Mon Sep 17 00:00:00 2001 From: mritd Date: Mon, 26 Dec 2016 22:35:37 +0800 Subject: [PATCH 037/190] =?UTF-8?q?=E5=88=87=E6=8D=A2=20openssl=20?= =?UTF-8?q?=E5=88=B0=201.0.1t?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build_nginx.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_nginx.sh b/build_nginx.sh index 869ccad..be3cb1c 100755 --- a/build_nginx.sh +++ b/build_nginx.sh @@ -3,7 +3,7 @@ # Nginx and module dependencies NGINX_VERSION="1.11.6" NGINX_LUA_MODULE_VERSION="0.10.7" -OPENSSL_VERSION="1.0.2j" +OPENSSL_VERSION="1.0.1t" HEADERS_MORE_VERSION="0.32" UPSTREAM_CHECK_VERSION="0.3.0" DEVEL_KIT_VERSION="0.3.0" From a187322e0e1e1287770e9fda42d439a7b72581f7 Mon Sep 17 00:00:00 2001 From: mritd Date: Tue, 27 Dec 2016 22:29:04 +0800 Subject: [PATCH 038/190] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=A1=A5=E4=B8=81?= =?UTF-8?q?=E4=BB=A5=E6=94=AF=E6=8C=81=20=E5=8A=A8=E6=80=81=20tls=20?= =?UTF-8?q?=E5=92=8C=20http2=20spdy?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build_nginx.sh | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/build_nginx.sh b/build_nginx.sh index be3cb1c..5b97708 100755 --- a/build_nginx.sh +++ b/build_nginx.sh @@ -57,10 +57,10 @@ CONFIG_ARGS="\ # install build dependencies function _installdep(){ echo -e "\033[32minstall build dependencies...\033[0m" - yum install gcc glibc glibc-devel make openssl \ - openssl-devel pcre pcre-devel zlib zlib-devel \ - kernel-devel curl gnupg libxslt libxslt-devel \ - gd-devel geoip-devel perl-devel perl-ExtUtils-Embed \ + yum install gcc glibc glibc-devel make pcre \ + pcre-devel zlib zlib-devel kernel-devel \ + curl gnupg libxslt libxslt-devel gd-devel \ + geoip-devel perl-devel perl-ExtUtils-Embed \ lua lua-devel -y } @@ -74,6 +74,9 @@ function _downloadfiles(){ curl -fSL https://github.com/yaoweibin/nginx_upstream_check_module/archive/v${UPSTREAM_CHECK_VERSION}.tar.gz -o nginx_upstream_check_module-v${UPSTREAM_CHECK_VERSION}.tar.gz curl -fSL https://github.com/simpl/ngx_devel_kit/archive/v${DEVEL_KIT_VERSION}.tar.gz -o ngx_devel_kit-v${DEVEL_KIT_VERSION}.tar.gz curl -fSL http://luajit.org/download/LuaJIT-$LUAJIT_VERSION.tar.gz -o LuaJIT-$LUAJIT_VERSION.tar.gz + #curl -fSL https://raw.githubusercontent.com/cloudflare/sslconfig/master/patches/openssl__chacha20_poly1305_draft_and_rfc_ossl102j.patch -o openssl__chacha20_poly1305_draft_and_rfc_ossl102j.patch + curl -fSL https://raw.githubusercontent.com/cloudflare/sslconfig/master/patches/nginx__dynamic_tls_records.patch -o nginx__dynamic_tls_records.patch + curl -fSL https://raw.githubusercontent.com/cloudflare/sslconfig/master/patches/nginx__http2_spdy.patch -o nginx__http2_spdy.patch tar -zxC /usr/src -f nginx.tar.gz tar -zxC /usr/src -f openssl-${OPENSSL_VERSION}.tar.gz @@ -92,6 +95,17 @@ function _downloadfiles(){ rm -f lua-nginx-module-v$NGINX_LUA_MODULE_VERSION.tar.gz rm -f ngx_devel_kit-v${DEVEL_KIT_VERSION}.tar.gz rm -f LuaJIT-$LUAJIT_VERSION.tar.gz + + mv nginx__dynamic_tls_records.patch /usr/src/nginx-${NGINX_VERSION} + mv nginx__http2_spdy.patch /usr/src/nginx-${NGINX_VERSION} +} + +# patch to nginx +function _patch_nginx(){ + echo -e "\033[32mpatch to nginx...\033[0m" + cd /usr/src/nginx-$NGINX_VERSION + patch -p1 < nginx__dynamic_tls_records.patch + patch -p1 < nginx__http2_spdy.patch } # install Lua @@ -119,6 +133,7 @@ function _clean(){ _installdep _downloadfiles +_patch_nginx install_lua install_nginx _clean From 06e339e9da0e5e916915ee6566d6a8a658a7db4d Mon Sep 17 00:00:00 2001 From: mritd Date: Tue, 27 Dec 2016 23:07:42 +0800 Subject: [PATCH 039/190] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=BC=96=E8=AF=91?= =?UTF-8?q?=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build_nginx.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/build_nginx.sh b/build_nginx.sh index 5b97708..4a486b6 100755 --- a/build_nginx.sh +++ b/build_nginx.sh @@ -37,6 +37,11 @@ CONFIG_ARGS="\ --with-http_geoip_module=dynamic \ --with-http_perl_module=dynamic \ --with-threads \ + --with-stream \ + --with-stream_ssl_module \ + --with-stream_ssl_preread_module \ + --with-stream_realip_module \ + --with-stream_geoip_module=dynamic \ --with-http_slice_module \ --with-mail \ --with-mail_ssl_module \ From 5f9aa23efdb66ef06b52691db9eea9e603d34236 Mon Sep 17 00:00:00 2001 From: mritd Date: Tue, 10 Jan 2017 17:40:38 +0800 Subject: [PATCH 040/190] =?UTF-8?q?=E5=A2=9E=E5=8A=A0openssl=E5=8D=87?= =?UTF-8?q?=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build_nginx.sh | 76 ++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 67 insertions(+), 9 deletions(-) diff --git a/build_nginx.sh b/build_nginx.sh index f64d6e8..fe5ff8d 100755 --- a/build_nginx.sh +++ b/build_nginx.sh @@ -1,12 +1,13 @@ #!/bin/bash # Nginx and module dependencies -NGINX_VERSION="1.11.6" +NGINX_VERSION="1.11.7" NGINX_LUA_MODULE_VERSION="0.10.7" OPENSSL_VERSION="1.0.2j" HEADERS_MORE_VERSION="0.32" UPSTREAM_CHECK_VERSION="0.3.0" DEVEL_KIT_VERSION="0.3.0" +NGINX_CT_VERSION="1.3.2" LUAJIT_VERSION="2.0.4" LUAJIT_MAIN_VERSION="2.0" LUAJIT_LIB="/usr/local/lib" @@ -37,6 +38,11 @@ CONFIG_ARGS="\ --with-http_geoip_module=dynamic \ --with-http_perl_module=dynamic \ --with-threads \ + --with-stream \ + --with-stream_ssl_module \ + --with-stream_ssl_preread_module \ + --with-stream_realip_module \ + --with-stream_geoip_module=dynamic \ --with-http_slice_module \ --with-mail \ --with-mail_ssl_module \ @@ -47,6 +53,7 @@ CONFIG_ARGS="\ --add-module=/usr/src/nginx_upstream_check_module-${UPSTREAM_CHECK_VERSION} \ --add-module=/usr/src/ngx_devel_kit-${DEVEL_KIT_VERSION} \ --add-module=/usr/src/lua-nginx-module-${NGINX_LUA_MODULE_VERSION} \ + --add-module=/usr/src/nginx-ct-${NGINX_CT_VERSION} \ --http-client-body-temp-path=/tmp/client_body_temp \ --http-proxy-temp-path=/tmp/proxy_temp \ --http-fastcgi-temp-path=/tmp/fastcgi_temp \ @@ -57,10 +64,10 @@ CONFIG_ARGS="\ # install build dependencies function _installdep(){ echo -e "\033[32minstall build dependencies...\033[0m" - yum install gcc glibc glibc-devel make openssl \ - openssl-devel pcre pcre-devel zlib zlib-devel \ - kernel-devel curl gnupg libxslt libxslt-devel \ - gd-devel geoip-devel perl-devel perl-ExtUtils-Embed \ + yum install gcc glibc glibc-devel make pcre \ + pcre-devel zlib zlib-devel kernel-devel \ + curl gnupg libxslt libxslt-devel gd-devel \ + geoip-devel perl-devel perl-ExtUtils-Embed \ lua lua-devel -y } @@ -68,30 +75,78 @@ function _installdep(){ function _downloadfiles(){ echo -e "\033[32mdownload module dependencies...\033[0m" curl -fSL http://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz -o nginx.tar.gz - curl -fSL https://github.com/openresty/lua-nginx-module/archive/v${NGINX_LUA_MODULE_VERSION}.tar.gz -o lua-nginx-module-v${NGINX_LUA_MODULE_VERSION}.tar.gz curl -fSL https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz -o openssl-${OPENSSL_VERSION}.tar.gz + curl -fSL https://github.com/openresty/lua-nginx-module/archive/v${NGINX_LUA_MODULE_VERSION}.tar.gz -o lua-nginx-module-v${NGINX_LUA_MODULE_VERSION}.tar.gz curl -fSL https://github.com/openresty/headers-more-nginx-module/archive/v${HEADERS_MORE_VERSION}.tar.gz -o headers-more-nginx-module-v${HEADERS_MORE_VERSION}.tar.gz curl -fSL https://github.com/yaoweibin/nginx_upstream_check_module/archive/v${UPSTREAM_CHECK_VERSION}.tar.gz -o nginx_upstream_check_module-v${UPSTREAM_CHECK_VERSION}.tar.gz curl -fSL https://github.com/simpl/ngx_devel_kit/archive/v${DEVEL_KIT_VERSION}.tar.gz -o ngx_devel_kit-v${DEVEL_KIT_VERSION}.tar.gz curl -fSL http://luajit.org/download/LuaJIT-$LUAJIT_VERSION.tar.gz -o LuaJIT-$LUAJIT_VERSION.tar.gz + curl -fSL https://raw.githubusercontent.com/cloudflare/sslconfig/master/patches/openssl__chacha20_poly1305_draft_and_rfc_ossl102j.patch -o openssl__chacha20_poly1305_draft_and_rfc_ossl102j.patch + #curl -fSL https://raw.githubusercontent.com/cloudflare/sslconfig/master/patches/nginx__dynamic_tls_records.patch -o nginx__dynamic_tls_records.patch + #curl -fSL https://raw.githubusercontent.com/cloudflare/sslconfig/master/patches/nginx__http2_spdy.patch -o nginx__http2_spdy.patch + curl -fSL https://github.com/grahamedgecombe/nginx-ct/archive/v${NGINX_CT_VERSION}.tar.gz -o nginx-ct-v${NGINX_CT_VERSION}.tar.gz tar -zxC /usr/src -f nginx.tar.gz - tar -zxC /usr/src -f lua-nginx-module-v${NGINX_LUA_MODULE_VERSION}.tar.gz tar -zxC /usr/src -f openssl-${OPENSSL_VERSION}.tar.gz + tar -zxC /usr/src -f lua-nginx-module-v${NGINX_LUA_MODULE_VERSION}.tar.gz tar -zxC /usr/src -f headers-more-nginx-module-v${HEADERS_MORE_VERSION}.tar.gz tar -zxC /usr/src -f nginx_upstream_check_module-v${UPSTREAM_CHECK_VERSION}.tar.gz tar -zxC /usr/src -f lua-nginx-module-v$NGINX_LUA_MODULE_VERSION.tar.gz tar -zxC /usr/src -f ngx_devel_kit-v${DEVEL_KIT_VERSION}.tar.gz tar -zxC /usr/src -f LuaJIT-$LUAJIT_VERSION.tar.gz + tar -zxC /usr/src -f nginx-ct-v${NGINX_CT_VERSION}.tar.gz rm -f nginx.tar.gz - rm -f lua-nginx-module-v${NGINX_LUA_MODULE_VERSION}.tar.gz rm -f openssl-${OPENSSL_VERSION}.tar.gz + rm -f lua-nginx-module-v${NGINX_LUA_MODULE_VERSION}.tar.gz rm -f headers-more-nginx-module-v${HEADERS_MORE_VERSION}.tar.gz rm -f nginx_upstream_check_module-v${UPSTREAM_CHECK_VERSION}.tar.gz - rm -f lua-nginx-module-v$NGINX_LUA_MODULE_VERSION.tar.gz rm -f ngx_devel_kit-v${DEVEL_KIT_VERSION}.tar.gz rm -f LuaJIT-$LUAJIT_VERSION.tar.gz + rm -f nginx-ct-v${NGINX_CT_VERSION}.tar.gz + + #mv nginx__dynamic_tls_records.patch /usr/src/nginx-${NGINX_VERSION} + #mv nginx__http2_spdy.patch /usr/src/nginx-${NGINX_VERSION} + mv openssl__chacha20_poly1305_draft_and_rfc_ossl102j.patch /usr/src/openssl-${OPENSSL_VERSION} + +} + +# patch to nginx +function _patch_nginx(){ + echo -e "\033[32mpatch to nginx...\033[0m" + cd /usr/src/nginx-$NGINX_VERSION + patch -p1 < nginx__dynamic_tls_records.patch + patch -p1 < nginx__http2_spdy.patch +} + +# patch to openssl +function _patch_openssl(){ + echo -e "\033[32mpatch to openssl...\033[0m" + cd /usr/src/openssl-${OPENSSL_VERSION} + patch -p1 < openssl__chacha20_poly1305_draft_and_rfc_ossl102j.patch +} + + +# install openssl +function install_openssl(){ + echo -e "\033[32minstall openssl $OPENSSL_VERSION ...\033[0m" + cd /usr/src/openssl-${OPENSSL_VERSION} + ./config shared zlib-dynamic + make && make install + + echo -e "\033[32mbackup old files...\033[0m" + mv /usr/bin/openssl /usr/bin/openssl.old + mv /usr/include/openssl /usr/include/openssl.old + + # link new file + ln -s /usr/local/ssl/bin/openssl /usr/bin/openssl + ln -s /usr/local/ssl/include/openssl /usr/include/openssl + ln -s /usr/local/ssl/lib/libssl.so /usr/lib/libssl.so + ln -s /usr/local/ssl/lib/libssl.so /usr/local/lib64/libssl.so + + # reload lib + echo "/usr/local/ssl/lib" >> /etc/ld.so.conf + ldconfig -v } # install Lua @@ -119,6 +174,9 @@ function _clean(){ _installdep _downloadfiles +#_patch_nginx +_patch_openssl +install_openssl install_lua install_nginx _clean From f62a9fb25820c8591371ba40d526094d10533428 Mon Sep 17 00:00:00 2001 From: mritd Date: Tue, 10 Jan 2017 17:47:04 +0800 Subject: [PATCH 041/190] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=20patch=20=E5=91=BD?= =?UTF-8?q?=E4=BB=A4=E5=AE=89=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build_nginx.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_nginx.sh b/build_nginx.sh index fe5ff8d..dc3ba9c 100755 --- a/build_nginx.sh +++ b/build_nginx.sh @@ -68,7 +68,7 @@ function _installdep(){ pcre-devel zlib zlib-devel kernel-devel \ curl gnupg libxslt libxslt-devel gd-devel \ geoip-devel perl-devel perl-ExtUtils-Embed \ - lua lua-devel -y + lua lua-devel patch -y } # download module dependencies From 6847d53c6254cebd79a57de6509f11fbc4e8af86 Mon Sep 17 00:00:00 2001 From: mritd Date: Tue, 10 Jan 2017 17:48:41 +0800 Subject: [PATCH 042/190] =?UTF-8?q?=E9=94=99=E8=AF=AF=E5=88=99=E6=8E=A8?= =?UTF-8?q?=E5=87=BA=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build_nginx.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/build_nginx.sh b/build_nginx.sh index dc3ba9c..4ce966a 100755 --- a/build_nginx.sh +++ b/build_nginx.sh @@ -1,5 +1,7 @@ #!/bin/bash +set -e + # Nginx and module dependencies NGINX_VERSION="1.11.7" NGINX_LUA_MODULE_VERSION="0.10.7" From e098c3be199dc71f1753a8224a2b434912283342 Mon Sep 17 00:00:00 2001 From: mritd Date: Tue, 10 Jan 2017 17:55:33 +0800 Subject: [PATCH 043/190] =?UTF-8?q?=E5=BF=BD=E7=95=A5=E5=A4=87=E4=BB=BD?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build_nginx.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build_nginx.sh b/build_nginx.sh index 4ce966a..bd28de8 100755 --- a/build_nginx.sh +++ b/build_nginx.sh @@ -137,8 +137,8 @@ function install_openssl(){ make && make install echo -e "\033[32mbackup old files...\033[0m" - mv /usr/bin/openssl /usr/bin/openssl.old - mv /usr/include/openssl /usr/include/openssl.old + mv /usr/bin/openssl /usr/bin/openssl.old || true + mv /usr/include/openssl /usr/include/openssl.old || true # link new file ln -s /usr/local/ssl/bin/openssl /usr/bin/openssl From 03e4a3e9d5f043fa88b8fae8829252ba8fb8c711 Mon Sep 17 00:00:00 2001 From: mritd Date: Tue, 10 Jan 2017 18:15:31 +0800 Subject: [PATCH 044/190] =?UTF-8?q?=E5=87=86=E5=A4=87=E6=94=AF=E6=8C=81=20?= =?UTF-8?q?tengine?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build_nginx.sh | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/build_nginx.sh b/build_nginx.sh index bd28de8..da03b3f 100755 --- a/build_nginx.sh +++ b/build_nginx.sh @@ -15,7 +15,19 @@ LUAJIT_MAIN_VERSION="2.0" LUAJIT_LIB="/usr/local/lib" LUAJIT_INC="/usr/local/include/luajit-$LUAJIT_MAIN_VERSION" -PREFIX=$1 +HOME_DIR="/usr/local" +INSTALL_TARGET="nginx" + +while getopts "hx" OPT; do + case $OPT in + h) + HOME_DIR=$OPTARG;; + x) + INSTALL_TARGET=$OPTARG;; + + esac +done + # build args CONFIG_ARGS="\ From 0be3603c4b46bf6aadcdcb391f59b009bdbcfe8e Mon Sep 17 00:00:00 2001 From: mritd Date: Tue, 10 Jan 2017 18:17:36 +0800 Subject: [PATCH 045/190] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=20tengine=20?= =?UTF-8?q?=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build_nginx.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/build_nginx.sh b/build_nginx.sh index da03b3f..1d41b2b 100755 --- a/build_nginx.sh +++ b/build_nginx.sh @@ -4,6 +4,7 @@ set -e # Nginx and module dependencies NGINX_VERSION="1.11.7" +TENGINE_VERSION="2.2.0" NGINX_LUA_MODULE_VERSION="0.10.7" OPENSSL_VERSION="1.0.2j" HEADERS_MORE_VERSION="0.32" From 115e46a0be425b9d20f30260f26cdaf5aa0d4cc1 Mon Sep 17 00:00:00 2001 From: mritd Date: Wed, 11 Jan 2017 08:17:56 +0800 Subject: [PATCH 046/190] =?UTF-8?q?=E5=88=87=E6=8D=A2=E5=88=B0=20socks5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docker_proxy.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker_proxy.sh b/docker_proxy.sh index cff872d..5feedc1 100755 --- a/docker_proxy.sh +++ b/docker_proxy.sh @@ -4,7 +4,7 @@ mkdir /etc/systemd/system/docker.service.d tee /etc/systemd/system/docker.service.d/http-proxy.conf < Date: Wed, 11 Jan 2017 10:22:23 +0800 Subject: [PATCH 047/190] =?UTF-8?q?=E8=BF=98=E5=8E=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build_nginx.sh | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/build_nginx.sh b/build_nginx.sh index 1d41b2b..77d99fb 100755 --- a/build_nginx.sh +++ b/build_nginx.sh @@ -4,7 +4,6 @@ set -e # Nginx and module dependencies NGINX_VERSION="1.11.7" -TENGINE_VERSION="2.2.0" NGINX_LUA_MODULE_VERSION="0.10.7" OPENSSL_VERSION="1.0.2j" HEADERS_MORE_VERSION="0.32" @@ -16,19 +15,7 @@ LUAJIT_MAIN_VERSION="2.0" LUAJIT_LIB="/usr/local/lib" LUAJIT_INC="/usr/local/include/luajit-$LUAJIT_MAIN_VERSION" -HOME_DIR="/usr/local" -INSTALL_TARGET="nginx" - -while getopts "hx" OPT; do - case $OPT in - h) - HOME_DIR=$OPTARG;; - x) - INSTALL_TARGET=$OPTARG;; - - esac -done - +PREFIX=$1 # build args CONFIG_ARGS="\ @@ -195,5 +182,3 @@ install_openssl install_lua install_nginx _clean - - From 8cd452e74254401e9ab07606d73452c15576c2d1 Mon Sep 17 00:00:00 2001 From: mritd Date: Wed, 11 Jan 2017 10:26:49 +0800 Subject: [PATCH 048/190] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=20tengine=20?= =?UTF-8?q?=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build_tengine.sh | 184 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 184 insertions(+) create mode 100755 build_tengine.sh diff --git a/build_tengine.sh b/build_tengine.sh new file mode 100755 index 0000000..7852c96 --- /dev/null +++ b/build_tengine.sh @@ -0,0 +1,184 @@ +#!/bin/bash + +set -e + +# Tengine and module dependencies +TENGINE_VERSION="2.2.0" +NGINX_LUA_MODULE_VERSION="0.10.7" +OPENSSL_VERSION="1.0.2j" +HEADERS_MORE_VERSION="0.32" +UPSTREAM_CHECK_VERSION="0.3.0" +DEVEL_KIT_VERSION="0.3.0" +NGINX_CT_VERSION="1.3.2" +LUAJIT_VERSION="2.0.4" +LUAJIT_MAIN_VERSION="2.0" +LUAJIT_LIB="/usr/local/lib" +LUAJIT_INC="/usr/local/include/luajit-$LUAJIT_MAIN_VERSION" + +PREFIX=$1 + +# build args +CONFIG_ARGS="\ + --prefix=${PREFIX:-/usr/local/tengine} \ + --pid-path=/var/run/nginx.pid \ + --lock-path=/var/run/nginx.lock \ + --with-http_ssl_module \ + --with-http_realip_module \ + --with-http_addition_module \ + --with-http_sub_module \ + --with-http_dav_module \ + --with-http_flv_module \ + --with-http_mp4_module \ + --with-http_gunzip_module \ + --with-http_gzip_static_module \ + --with-http_random_index_module \ + --with-http_secure_link_module \ + --with-http_stub_status_module \ + --with-http_auth_request_module \ + --with-http_xslt_module=dynamic \ + --with-http_image_filter_module=dynamic \ + --with-http_geoip_module=dynamic \ + --with-http_perl_module=dynamic \ + --with-threads \ + --with-stream \ + --with-stream_ssl_module \ + --with-stream_ssl_preread_module \ + --with-stream_realip_module \ + --with-stream_geoip_module=dynamic \ + --with-http_slice_module \ + --with-mail \ + --with-mail_ssl_module \ + --with-file-aio \ + --with-http_v2_module \ + --with-openssl=/usr/src/openssl-${OPENSSL_VERSION} \ + --add-module=/usr/src/headers-more-nginx-module-${HEADERS_MORE_VERSION} \ + --add-module=/usr/src/nginx_upstream_check_module-${UPSTREAM_CHECK_VERSION} \ + --add-module=/usr/src/ngx_devel_kit-${DEVEL_KIT_VERSION} \ + --add-module=/usr/src/lua-nginx-module-${NGINX_LUA_MODULE_VERSION} \ + --add-module=/usr/src/nginx-ct-${NGINX_CT_VERSION} \ + --http-client-body-temp-path=/tmp/client_body_temp \ + --http-proxy-temp-path=/tmp/proxy_temp \ + --http-fastcgi-temp-path=/tmp/fastcgi_temp \ + --http-uwsgi-temp-path=/tmp/uwsgi_temp \ + --http-scgi-temp-path=/tmp/scgi_temp \ + " + +# install build dependencies +function _installdep(){ + echo -e "\033[32minstall build dependencies...\033[0m" + yum install gcc glibc glibc-devel make pcre \ + pcre-devel zlib zlib-devel kernel-devel \ + curl gnupg libxslt libxslt-devel gd-devel \ + geoip-devel perl-devel perl-ExtUtils-Embed \ + lua lua-devel patch -y +} + +# download module dependencies +function _downloadfiles(){ + echo -e "\033[32mdownload module dependencies...\033[0m" + curl -fSL http://tengine.taobao.org/download/tengine-${TENGINE_VERSION}.tar.gz -o tengine.tar.gz + curl -fSL https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz -o openssl-${OPENSSL_VERSION}.tar.gz + curl -fSL https://github.com/openresty/lua-nginx-module/archive/v${NGINX_LUA_MODULE_VERSION}.tar.gz -o lua-nginx-module-v${NGINX_LUA_MODULE_VERSION}.tar.gz + curl -fSL https://github.com/openresty/headers-more-nginx-module/archive/v${HEADERS_MORE_VERSION}.tar.gz -o headers-more-nginx-module-v${HEADERS_MORE_VERSION}.tar.gz + curl -fSL https://github.com/yaoweibin/nginx_upstream_check_module/archive/v${UPSTREAM_CHECK_VERSION}.tar.gz -o nginx_upstream_check_module-v${UPSTREAM_CHECK_VERSION}.tar.gz + curl -fSL https://github.com/simpl/ngx_devel_kit/archive/v${DEVEL_KIT_VERSION}.tar.gz -o ngx_devel_kit-v${DEVEL_KIT_VERSION}.tar.gz + curl -fSL http://luajit.org/download/LuaJIT-$LUAJIT_VERSION.tar.gz -o LuaJIT-$LUAJIT_VERSION.tar.gz + curl -fSL https://raw.githubusercontent.com/cloudflare/sslconfig/master/patches/openssl__chacha20_poly1305_draft_and_rfc_ossl102j.patch -o openssl__chacha20_poly1305_draft_and_rfc_ossl102j.patch + #curl -fSL https://raw.githubusercontent.com/cloudflare/sslconfig/master/patches/nginx__dynamic_tls_records.patch -o nginx__dynamic_tls_records.patch + #curl -fSL https://raw.githubusercontent.com/cloudflare/sslconfig/master/patches/nginx__http2_spdy.patch -o nginx__http2_spdy.patch + curl -fSL https://github.com/grahamedgecombe/nginx-ct/archive/v${NGINX_CT_VERSION}.tar.gz -o nginx-ct-v${NGINX_CT_VERSION}.tar.gz + + tar -zxC /usr/src -f tengine.tar.gz + tar -zxC /usr/src -f openssl-${OPENSSL_VERSION}.tar.gz + tar -zxC /usr/src -f lua-nginx-module-v${NGINX_LUA_MODULE_VERSION}.tar.gz + tar -zxC /usr/src -f headers-more-nginx-module-v${HEADERS_MORE_VERSION}.tar.gz + tar -zxC /usr/src -f nginx_upstream_check_module-v${UPSTREAM_CHECK_VERSION}.tar.gz + tar -zxC /usr/src -f lua-nginx-module-v$NGINX_LUA_MODULE_VERSION.tar.gz + tar -zxC /usr/src -f ngx_devel_kit-v${DEVEL_KIT_VERSION}.tar.gz + tar -zxC /usr/src -f LuaJIT-$LUAJIT_VERSION.tar.gz + tar -zxC /usr/src -f nginx-ct-v${NGINX_CT_VERSION}.tar.gz + + rm -f tengine.tar.gz + rm -f openssl-${OPENSSL_VERSION}.tar.gz + rm -f lua-nginx-module-v${NGINX_LUA_MODULE_VERSION}.tar.gz + rm -f headers-more-nginx-module-v${HEADERS_MORE_VERSION}.tar.gz + rm -f nginx_upstream_check_module-v${UPSTREAM_CHECK_VERSION}.tar.gz + rm -f ngx_devel_kit-v${DEVEL_KIT_VERSION}.tar.gz + rm -f LuaJIT-$LUAJIT_VERSION.tar.gz + rm -f nginx-ct-v${NGINX_CT_VERSION}.tar.gz + + #mv nginx__dynamic_tls_records.patch /usr/src/nginx-${NGINX_VERSION} + #mv nginx__http2_spdy.patch /usr/src/nginx-${NGINX_VERSION} + mv openssl__chacha20_poly1305_draft_and_rfc_ossl102j.patch /usr/src/openssl-${OPENSSL_VERSION} + +} + +# patch to nginx +function _patch_nginx(){ + echo -e "\033[32mpatch to nginx...\033[0m" + cd /usr/src/nginx-$NGINX_VERSION + patch -p1 < nginx__dynamic_tls_records.patch + patch -p1 < nginx__http2_spdy.patch +} + +# patch to openssl +function _patch_openssl(){ + echo -e "\033[32mpatch to openssl...\033[0m" + cd /usr/src/openssl-${OPENSSL_VERSION} + patch -p1 < openssl__chacha20_poly1305_draft_and_rfc_ossl102j.patch +} + + +# install openssl +function install_openssl(){ + echo -e "\033[32minstall openssl $OPENSSL_VERSION ...\033[0m" + cd /usr/src/openssl-${OPENSSL_VERSION} + ./config shared zlib-dynamic + make && make install + + echo -e "\033[32mbackup old files...\033[0m" + mv /usr/bin/openssl /usr/bin/openssl.old || true + mv /usr/include/openssl /usr/include/openssl.old || true + + # link new file + ln -s /usr/local/ssl/bin/openssl /usr/bin/openssl + ln -s /usr/local/ssl/include/openssl /usr/include/openssl + ln -s /usr/local/ssl/lib/libssl.so /usr/lib/libssl.so + ln -s /usr/local/ssl/lib/libssl.so /usr/local/lib64/libssl.so + + # reload lib + echo "/usr/local/ssl/lib" >> /etc/ld.so.conf + ldconfig -v +} + +# install Lua +function install_lua(){ + echo -e "\033[32minstall Lua $LUAJIT_VERSION ...\033[0m" + cd /usr/src/LuaJIT-$LUAJIT_VERSION + make -j$(getconf _NPROCESSORS_ONLN) + make install +} + +# install nginx +function install_nginx(){ + echo -e "\033[32minstall nginx $NGINX_VERSION ...\033[0m" + cd /usr/src/nginx-$NGINX_VERSION + ./configure $CONFIG_ARGS --with-debug + make -j$(getconf _NPROCESSORS_ONLN) + make install +} + +# clean +function _clean(){ + echo -e "\033[32mcleaning files...\033[0m" + rm -rf /usr/src/* +} + +_installdep +_downloadfiles +#_patch_nginx +_patch_openssl +install_openssl +install_lua +install_nginx +_clean From a2c275d6ec3749b5706a2e25d66371e25b73087a Mon Sep 17 00:00:00 2001 From: mritd Date: Wed, 11 Jan 2017 10:32:31 +0800 Subject: [PATCH 049/190] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E7=9B=AE=E5=BD=95?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build_tengine.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_tengine.sh b/build_tengine.sh index 7852c96..317a497 100755 --- a/build_tengine.sh +++ b/build_tengine.sh @@ -162,7 +162,7 @@ function install_lua(){ # install nginx function install_nginx(){ echo -e "\033[32minstall nginx $NGINX_VERSION ...\033[0m" - cd /usr/src/nginx-$NGINX_VERSION + cd /usr/src/tengine-$NGINX_VERSION ./configure $CONFIG_ARGS --with-debug make -j$(getconf _NPROCESSORS_ONLN) make install From 6e26150098908342dcb5647b3f63c4e0aae20daa Mon Sep 17 00:00:00 2001 From: mritd Date: Wed, 11 Jan 2017 10:39:13 +0800 Subject: [PATCH 050/190] =?UTF-8?q?=E5=85=88=E5=A4=87=E4=BB=BD=E5=8E=9F?= =?UTF-8?q?=E6=9C=89=20lib?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build_tengine.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/build_tengine.sh b/build_tengine.sh index 317a497..bf37f29 100755 --- a/build_tengine.sh +++ b/build_tengine.sh @@ -143,6 +143,11 @@ function install_openssl(){ # link new file ln -s /usr/local/ssl/bin/openssl /usr/bin/openssl ln -s /usr/local/ssl/include/openssl /usr/include/openssl + + mv /usr/lib/libssl.so /usr/lib/libssl.so.old + mv /usr/local/lib64/libssl.so /usr/local/lib64/libssl.so.old + + # link new lib ln -s /usr/local/ssl/lib/libssl.so /usr/lib/libssl.so ln -s /usr/local/ssl/lib/libssl.so /usr/local/lib64/libssl.so From d633b0718e0e73587168686c0d0ad6b86697a33c Mon Sep 17 00:00:00 2001 From: mritd Date: Wed, 11 Jan 2017 10:42:03 +0800 Subject: [PATCH 051/190] =?UTF-8?q?=E5=A4=87=E4=BB=BD=E5=8E=9F=E5=85=B1?= =?UTF-8?q?=E4=BA=AB=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build_nginx.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/build_nginx.sh b/build_nginx.sh index 77d99fb..e9f10e8 100755 --- a/build_nginx.sh +++ b/build_nginx.sh @@ -143,6 +143,11 @@ function install_openssl(){ # link new file ln -s /usr/local/ssl/bin/openssl /usr/bin/openssl ln -s /usr/local/ssl/include/openssl /usr/include/openssl + + mv /usr/lib/libssl.so /usr/lib/libssl.so.old || true + mv /usr/local/lib64/libssl.so /usr/local/lib64/libssl.so.old || true + + # link new lib ln -s /usr/local/ssl/lib/libssl.so /usr/lib/libssl.so ln -s /usr/local/ssl/lib/libssl.so /usr/local/lib64/libssl.so From 810dda1ada401dea4c2ee840e36ab48ae96f5d78 Mon Sep 17 00:00:00 2001 From: mritd Date: Wed, 11 Jan 2017 10:43:11 +0800 Subject: [PATCH 052/190] =?UTF-8?q?=E5=BF=BD=E7=95=A5=E5=A4=87=E4=BB=BD?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build_tengine.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build_tengine.sh b/build_tengine.sh index bf37f29..bb13cfa 100755 --- a/build_tengine.sh +++ b/build_tengine.sh @@ -144,8 +144,8 @@ function install_openssl(){ ln -s /usr/local/ssl/bin/openssl /usr/bin/openssl ln -s /usr/local/ssl/include/openssl /usr/include/openssl - mv /usr/lib/libssl.so /usr/lib/libssl.so.old - mv /usr/local/lib64/libssl.so /usr/local/lib64/libssl.so.old + mv /usr/lib/libssl.so /usr/lib/libssl.so.old || true + mv /usr/local/lib64/libssl.so /usr/local/lib64/libssl.so.old || true # link new lib ln -s /usr/local/ssl/lib/libssl.so /usr/lib/libssl.so From e2d8c027bfe5bc0397e435067bb504612185d681 Mon Sep 17 00:00:00 2001 From: mritd Date: Wed, 11 Jan 2017 10:44:13 +0800 Subject: [PATCH 053/190] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20tengine=20?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=8F=B7=E9=94=99=E8=AF=AF=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build_tengine.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_tengine.sh b/build_tengine.sh index bb13cfa..a1f9cf7 100755 --- a/build_tengine.sh +++ b/build_tengine.sh @@ -167,7 +167,7 @@ function install_lua(){ # install nginx function install_nginx(){ echo -e "\033[32minstall nginx $NGINX_VERSION ...\033[0m" - cd /usr/src/tengine-$NGINX_VERSION + cd /usr/src/tengine-$TENGINE_VERSION ./configure $CONFIG_ARGS --with-debug make -j$(getconf _NPROCESSORS_ONLN) make install From dd3ea1287037d3ccb9a9440684dd0f39de7e6d19 Mon Sep 17 00:00:00 2001 From: mritd Date: Wed, 11 Jan 2017 11:12:03 +0800 Subject: [PATCH 054/190] =?UTF-8?q?=E5=8E=BB=E9=99=A4=E4=B8=8D=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E7=9A=84=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build_tengine.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/build_tengine.sh b/build_tengine.sh index a1f9cf7..8d5bb87 100755 --- a/build_tengine.sh +++ b/build_tengine.sh @@ -35,7 +35,6 @@ CONFIG_ARGS="\ --with-http_secure_link_module \ --with-http_stub_status_module \ --with-http_auth_request_module \ - --with-http_xslt_module=dynamic \ --with-http_image_filter_module=dynamic \ --with-http_geoip_module=dynamic \ --with-http_perl_module=dynamic \ From 5d5c45e287b3420a7f80499de5887d4e89cb989d Mon Sep 17 00:00:00 2001 From: mritd Date: Wed, 11 Jan 2017 11:28:34 +0800 Subject: [PATCH 055/190] =?UTF-8?q?=E5=8E=BB=E9=99=A4=E4=B8=8D=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E7=9A=84=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build_tengine.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/build_tengine.sh b/build_tengine.sh index 8d5bb87..13b7b24 100755 --- a/build_tengine.sh +++ b/build_tengine.sh @@ -35,7 +35,6 @@ CONFIG_ARGS="\ --with-http_secure_link_module \ --with-http_stub_status_module \ --with-http_auth_request_module \ - --with-http_image_filter_module=dynamic \ --with-http_geoip_module=dynamic \ --with-http_perl_module=dynamic \ --with-threads \ From f73a3795892d046b69c3dc0d72d7f7143c698879 Mon Sep 17 00:00:00 2001 From: mritd Date: Wed, 11 Jan 2017 12:11:21 +0800 Subject: [PATCH 056/190] =?UTF-8?q?=E5=8E=BB=E9=99=A4=E4=B8=8D=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E7=9A=84=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build_tengine.sh | 3 --- 1 file changed, 3 deletions(-) diff --git a/build_tengine.sh b/build_tengine.sh index 13b7b24..367ebc1 100755 --- a/build_tengine.sh +++ b/build_tengine.sh @@ -35,14 +35,11 @@ CONFIG_ARGS="\ --with-http_secure_link_module \ --with-http_stub_status_module \ --with-http_auth_request_module \ - --with-http_geoip_module=dynamic \ - --with-http_perl_module=dynamic \ --with-threads \ --with-stream \ --with-stream_ssl_module \ --with-stream_ssl_preread_module \ --with-stream_realip_module \ - --with-stream_geoip_module=dynamic \ --with-http_slice_module \ --with-mail \ --with-mail_ssl_module \ From 42b9fad71d3fc6915028746321d3374b887c2a65 Mon Sep 17 00:00:00 2001 From: mritd Date: Wed, 11 Jan 2017 12:43:02 +0800 Subject: [PATCH 057/190] =?UTF-8?q?=E5=8E=BB=E9=99=A4=E4=B8=8D=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E7=9A=84=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build_tengine.sh | 4 ---- 1 file changed, 4 deletions(-) diff --git a/build_tengine.sh b/build_tengine.sh index 367ebc1..f428ec7 100755 --- a/build_tengine.sh +++ b/build_tengine.sh @@ -36,10 +36,6 @@ CONFIG_ARGS="\ --with-http_stub_status_module \ --with-http_auth_request_module \ --with-threads \ - --with-stream \ - --with-stream_ssl_module \ - --with-stream_ssl_preread_module \ - --with-stream_realip_module \ --with-http_slice_module \ --with-mail \ --with-mail_ssl_module \ From 72f120616a65b01eac72eff2a16fe99cc54cd59e Mon Sep 17 00:00:00 2001 From: mritd Date: Wed, 11 Jan 2017 12:52:07 +0800 Subject: [PATCH 058/190] =?UTF-8?q?=E9=99=8D=E4=BD=8E=20lua=20=E6=A8=A1?= =?UTF-8?q?=E5=9D=97=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build_tengine.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_tengine.sh b/build_tengine.sh index f428ec7..da2100f 100755 --- a/build_tengine.sh +++ b/build_tengine.sh @@ -4,7 +4,7 @@ set -e # Tengine and module dependencies TENGINE_VERSION="2.2.0" -NGINX_LUA_MODULE_VERSION="0.10.7" +NGINX_LUA_MODULE_VERSION="0.7.19" OPENSSL_VERSION="1.0.2j" HEADERS_MORE_VERSION="0.32" UPSTREAM_CHECK_VERSION="0.3.0" From 0d99cbd7bb5b1693236c3d72c240d50c0ac363d8 Mon Sep 17 00:00:00 2001 From: mritd Date: Wed, 11 Jan 2017 13:01:42 +0800 Subject: [PATCH 059/190] =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=85=B6=E4=BB=96?= =?UTF-8?q?=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build_tengine.sh | 4 ---- 1 file changed, 4 deletions(-) diff --git a/build_tengine.sh b/build_tengine.sh index da2100f..0bd7970 100755 --- a/build_tengine.sh +++ b/build_tengine.sh @@ -42,11 +42,7 @@ CONFIG_ARGS="\ --with-file-aio \ --with-http_v2_module \ --with-openssl=/usr/src/openssl-${OPENSSL_VERSION} \ - --add-module=/usr/src/headers-more-nginx-module-${HEADERS_MORE_VERSION} \ - --add-module=/usr/src/nginx_upstream_check_module-${UPSTREAM_CHECK_VERSION} \ - --add-module=/usr/src/ngx_devel_kit-${DEVEL_KIT_VERSION} \ --add-module=/usr/src/lua-nginx-module-${NGINX_LUA_MODULE_VERSION} \ - --add-module=/usr/src/nginx-ct-${NGINX_CT_VERSION} \ --http-client-body-temp-path=/tmp/client_body_temp \ --http-proxy-temp-path=/tmp/proxy_temp \ --http-fastcgi-temp-path=/tmp/fastcgi_temp \ From c1bb49ca570767bf92e510ae5bae400cf096008c Mon Sep 17 00:00:00 2001 From: mritd Date: Wed, 11 Jan 2017 13:55:19 +0800 Subject: [PATCH 060/190] =?UTF-8?q?=E6=9B=B4=E6=94=B9=20lua=20module=20?= =?UTF-8?q?=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build_tengine.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_tengine.sh b/build_tengine.sh index 0bd7970..928ee1c 100755 --- a/build_tengine.sh +++ b/build_tengine.sh @@ -4,7 +4,7 @@ set -e # Tengine and module dependencies TENGINE_VERSION="2.2.0" -NGINX_LUA_MODULE_VERSION="0.7.19" +NGINX_LUA_MODULE_VERSION="0.2.0" OPENSSL_VERSION="1.0.2j" HEADERS_MORE_VERSION="0.32" UPSTREAM_CHECK_VERSION="0.3.0" From be46e8177807a0cd104644da1d465223bca4cf24 Mon Sep 17 00:00:00 2001 From: mritd Date: Fri, 13 Jan 2017 17:28:52 +0900 Subject: [PATCH 061/190] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20rpm=20=E4=BD=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- signature_rpm.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/signature_rpm.sh b/signature_rpm.sh index 27bcf86..c6b3474 100755 --- a/signature_rpm.sh +++ b/signature_rpm.sh @@ -1,5 +1,7 @@ #/bin/bash +yum install rpm-sign -y + # clean old files rm -f /data/repo/centos/7/x86_64/{kubelet*,kubeadm*,kubernetes-cni*,kubectl*} @@ -7,7 +9,7 @@ rm -f /data/repo/centos/7/x86_64/{kubelet*,kubeadm*,kubernetes-cni*,kubectl*} echo %_signature gpg > ~/.rpmmacros echo "%_gpg_name mritd (mritd rpm repository)" >> ~/.rpmmacros -for rpmName in `ls ~/kubeadm_release/rpm/output/x86_64/*.rpm`; do +for rpmName in `ls ~/git_projects/adm_release/rpm/output/x86_64/*.rpm`; do rpm --addsign $rpmName cp -f $rpmName /data/repo/centos/7/x86_64 done From 42d1a61874241c7495aedaca95f4e9c79050375a Mon Sep 17 00:00:00 2001 From: mritd Date: Fri, 13 Jan 2017 17:51:04 +0900 Subject: [PATCH 062/190] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=80=92=E8=AE=A1?= =?UTF-8?q?=E6=97=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- syncrpm.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/syncrpm.sh b/syncrpm.sh index 454654d..d6347b6 100755 --- a/syncrpm.sh +++ b/syncrpm.sh @@ -5,7 +5,11 @@ upx rm centos/7/x86_64/\* upx rm centos/7/x86_64/repodata/\* # waiting cdn clean cache -sleep 120 +echo "Wating cdn sync:" +for i in `seq -w 120 -1 1`;do + echo -ne "\033[1;31;32m\b\b\b$i\033[0m"; + sleep 1; +done # sync rpm cd /data/repo/centos/7/x86_64/ && for rpmName in `ls *.rpm`;do upx put $rpmName centos/7/x86_64/;done From 17367f29f6d5913076704420a84a29bfc56a2841 Mon Sep 17 00:00:00 2001 From: mritd Date: Fri, 13 Jan 2017 19:07:05 +0900 Subject: [PATCH 063/190] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=20rvm=20=E5=88=A4?= =?UTF-8?q?=E6=96=AD=EF=BC=8C=E5=88=A0=E9=99=A4=20kubemark?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build_rpm_tool.sh | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/build_rpm_tool.sh b/build_rpm_tool.sh index 6ec9e1d..88ce1c0 100755 --- a/build_rpm_tool.sh +++ b/build_rpm_tool.sh @@ -4,6 +4,8 @@ # You can use the "./build_rpm_tool.sh etcd VERSION" to create a etcd RPM # Kubernetes and flannel use the same command to create the RPM +set -e + targetModel=$1 version=$2 @@ -25,6 +27,9 @@ function _checkInput(){ function _prebuild(){ + + PATH=$PATH:/usr/local/rvm/bin:/usr/local/rvm/rubies/ruby-2.3.0/bin + echo -e "\033[33mclean old files!\033[0m" rm -rf build_tmp echo -e "\033[32mbuild $targetModel rpm!\033[0m" @@ -36,7 +41,11 @@ function _prebuild(){ mkdir build_tmp && cd build_tmp _update_installdep - _install_ruby_fpm + if [ -n `which fpm`]; then + _install_ruby_fpm + else + echo -e "\033[33mfpm exist!\033[0m" + fi } @@ -55,7 +64,6 @@ function _update_installdep(){ function _install_ruby_fpm(){ - PATH=$PATH:/usr/local/rvm/bin:/usr/local/rvm/rubies/ruby-2.3.0/bin # install rvm and ruby echo -e "\033[32minstall rvm...\033[0m" curl -sSL https://rvm.io/mpapis.asc | gpg2 --import - @@ -190,7 +198,7 @@ function build_k8s(){ echo -e "\033[32mdownload k8s release package...\033[0m" - allBins=(hyperkube kube-apiserver kube-controller-manager kubectl kube-dns kubelet kubemark kube-proxy kube-scheduler) + allBins=(hyperkube kube-apiserver kube-controller-manager kubectl kube-dns kubelet kube-proxy kube-scheduler) for binName in ${allBins[@]};do echo -e "\033[32mdownload $binName...\033[0m" wget https://storage.googleapis.com/kubernetes-release/release/v$version/bin/linux/amd64/$binName -O $binName @@ -213,7 +221,7 @@ function build_k8s(){ echo -e "\033[32mreplace new files...\033[0m" rm -f usr/bin/* - cp hyperkube kube-apiserver kube-controller-manager kubectl kube-dns kubelet kubemark kube-proxy kube-scheduler usr/bin/ + cp hyperkube kube-apiserver kube-controller-manager kubectl kube-dns kubelet kube-proxy kube-scheduler usr/bin/ echo -e "\033[32mmake rpm scripts...\033[0m" tee preinstall.sh < Date: Mon, 6 Feb 2017 10:40:15 +0800 Subject: [PATCH 064/190] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=B3=BB=E7=BB=9F?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docker_proxy.sh | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/docker_proxy.sh b/docker_proxy.sh index 5feedc1..63032f2 100755 --- a/docker_proxy.sh +++ b/docker_proxy.sh @@ -1,13 +1,27 @@ #!/bin/bash -mkdir /etc/systemd/system/docker.service.d +set -e -tee /etc/systemd/system/docker.service.d/http-proxy.conf < Date: Tue, 14 Feb 2017 21:10:00 +0800 Subject: [PATCH 065/190] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docker_devicemapper.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker_devicemapper.sh b/docker_devicemapper.sh index 0445f43..713215a 100755 --- a/docker_devicemapper.sh +++ b/docker_devicemapper.sh @@ -71,7 +71,7 @@ rm -rf /var/lib/docker/* echo -e "\033[32mConfigure the Docker daemon with specific devicemapper options.\033[0m" if ! grep "\-\-storage-driver=devicemapper" /usr/lib/systemd/system/docker.service 2>&1 > /dev/null ;then - sed -i "s@ExecStart=/usr/bin/dockerd@ExecStart=/usr/bin/dockerd --storage-driver=devicemapper --storage-opt=dm.thinpooldev=/dev/mapper/docker-thinpool --storage-opt dm.use_deferred_removal=true @g" /usr/lib/systemd/system/docker.service + sed -i "s@ExecStart=/usr/bin/dockerd@ExecStart=/usr/bin/dockerd --storage-driver=devicemapper --storage-opt=dm.thinpooldev=/dev/mapper/docker-thinpool --storage-opt dm.use_deferred_removal=true --storage-opt=dm.use_deferred_deletion=true @g" /usr/lib/systemd/system/docker.service systemctl daemon-reload else echo -e "\033[33mFound '--storage-driver=devicemapper' option,not to replace!" From 558b4b74beea3079ec9d661907963e7e570266b5 Mon Sep 17 00:00:00 2001 From: mritd Date: Wed, 15 Feb 2017 11:52:26 +0900 Subject: [PATCH 066/190] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E7=A9=BA=E6=A0=BC?= =?UTF-8?q?=E7=BC=BA=E5=A4=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build_rpm_tool.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_rpm_tool.sh b/build_rpm_tool.sh index 88ce1c0..b5086c0 100755 --- a/build_rpm_tool.sh +++ b/build_rpm_tool.sh @@ -41,7 +41,7 @@ function _prebuild(){ mkdir build_tmp && cd build_tmp _update_installdep - if [ -n `which fpm`]; then + if [ -n `which fpm` ]; then _install_ruby_fpm else echo -e "\033[33mfpm exist!\033[0m" From 06d142507197e399ee792383eb4d8dc475adcf12 Mon Sep 17 00:00:00 2001 From: mritd Date: Thu, 16 Feb 2017 10:00:06 +0800 Subject: [PATCH 067/190] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20cdn=20=E5=9C=B0?= =?UTF-8?q?=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build_rpm_tool.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_rpm_tool.sh b/build_rpm_tool.sh index b5086c0..e8c7814 100755 --- a/build_rpm_tool.sh +++ b/build_rpm_tool.sh @@ -211,7 +211,7 @@ function build_k8s(){ done echo -e "\033[32mdownload old kubernetes...\033[0m" - wget http://upyun.mritd.me/rpms/$BASEPACKAGE + wget http://mritdftp.b0.upaiyun.com/rpms/$BASEPACKAGE if [ ! -f $BASEPACKAGE ]; then echo -e "\033[31merror: download kubernetes old rpm failed!\033[0m" exit 1 From 6f3c2957202245798c16fb4c50fb358fb9033b6a Mon Sep 17 00:00:00 2001 From: mritd Date: Thu, 16 Feb 2017 12:51:21 +0900 Subject: [PATCH 068/190] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=88=B7=E6=96=B0?= =?UTF-8?q?=E4=BB=93=E5=BA=93=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- flush_repo.sh | 2 ++ 1 file changed, 2 insertions(+) create mode 100755 flush_repo.sh diff --git a/flush_repo.sh b/flush_repo.sh new file mode 100755 index 0000000..40dcb3f --- /dev/null +++ b/flush_repo.sh @@ -0,0 +1,2 @@ +#!/bin/bash +cd /data/repo/centos/7/ && ls | xargs -i createrepo --update {} From 24a3074eabd654e6915cf0ab587151899536139c Mon Sep 17 00:00:00 2001 From: mritd Date: Sun, 19 Feb 2017 12:54:01 +0900 Subject: [PATCH 069/190] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E9=A6=96=E8=A1=8C?= =?UTF-8?q?=E7=A9=BA=E6=A0=BC=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docker_proxy.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docker_proxy.sh b/docker_proxy.sh index 63032f2..8719130 100755 --- a/docker_proxy.sh +++ b/docker_proxy.sh @@ -11,14 +11,14 @@ if [ "$OS_TYPE" == "" ];then elif [ "$OS_TYPE" == "centos" ];then mkdir /etc/systemd/system/docker.service.d || true tee /etc/systemd/system/docker.service.d/socks5-proxy.conf <<-EOF - [Service] - Environment="ALL_PROXY=socks5://192.168.1.120:1083" +[Service] +Environment="ALL_PROXY=socks5://192.168.1.105:1080" EOF elif [ "$OS_TYPE" == "ubuntu" ];then mkdir /lib/systemd/system/docker.service.d || true tee /lib/systemd/system/docker.service.d/socks5-proxy.conf <<-EOF - [Service] - Environment="ALL_PROXY=socks5://192.168.1.120:1083" +[Service] +Environment="ALL_PROXY=socks5://192.168.1.120:1083" EOF fi From d581395ce85b4e61d9bdbb69dfc051347c29160d Mon Sep 17 00:00:00 2001 From: mritd Date: Thu, 23 Feb 2017 21:28:00 +0800 Subject: [PATCH 070/190] =?UTF-8?q?=E5=88=87=E6=8D=A2=20git=20=E4=BB=A3?= =?UTF-8?q?=E7=90=86=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- install_sshproxy.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install_sshproxy.sh b/install_sshproxy.sh index d5fa5eb..15d0020 100755 --- a/install_sshproxy.sh +++ b/install_sshproxy.sh @@ -2,7 +2,7 @@ tee /usr/local/bin/proxy-wrapper < Date: Sun, 26 Feb 2017 11:35:20 +0000 Subject: [PATCH 071/190] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=88=9D=E5=A7=8B?= =?UTF-8?q?=E5=8C=96=E5=AE=89=E8=A3=85=E5=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- init.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.sh b/init.sh index 88b6914..9023165 100755 --- a/init.sh +++ b/init.sh @@ -1,5 +1,5 @@ #!/bin/bash yum update -y -yum install tmux wget lrzsz vim net-tools zsh bind-utils -y +yum install tmux wget lrzsz vim net-tools zsh bind-utils yum-utils catgs -y sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)" From 5b964c8a3bee37e1cb68f4d2d16cbeca9dd54d79 Mon Sep 17 00:00:00 2001 From: mritd Date: Sun, 26 Feb 2017 11:40:01 +0000 Subject: [PATCH 072/190] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E5=8C=85=E5=90=8D?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- init.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.sh b/init.sh index 9023165..6452647 100755 --- a/init.sh +++ b/init.sh @@ -1,5 +1,5 @@ #!/bin/bash yum update -y -yum install tmux wget lrzsz vim net-tools zsh bind-utils yum-utils catgs -y +yum install tmux wget lrzsz vim net-tools zsh bind-utils yum-utils ctags -y sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)" From 4aa967f54e555fd828649a8f8d94cac3a3fb021b Mon Sep 17 00:00:00 2001 From: mritd Date: Sat, 4 Mar 2017 18:26:57 +0800 Subject: [PATCH 073/190] =?UTF-8?q?=E6=8E=92=E9=99=A4=E6=A0=87=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docker_clean.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker_clean.sh b/docker_clean.sh index 84f8929..f2bce2c 100755 --- a/docker_clean.sh +++ b/docker_clean.sh @@ -2,4 +2,4 @@ docker ps -a | grep "Exited" | awk '{print $1 }'|xargs docker stop docker ps -a | grep "Exited" | awk '{print $1 }'|xargs docker rm -docker images|grep none|awk '{print $3 }'|xargs docker rmi +docker images | grep none | grep -v REPOSITORY | awk '{print $3 }' | xargs docker rmi From 758c5cecc02250c1269260731442c0ea2d0faef2 Mon Sep 17 00:00:00 2001 From: mritd Date: Fri, 10 Mar 2017 12:03:45 +0800 Subject: [PATCH 074/190] =?UTF-8?q?=E5=88=A0=E9=99=A4=20adm=20=E8=84=9A?= =?UTF-8?q?=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kubeadm_install.sh | 111 --------------------------------------------- 1 file changed, 111 deletions(-) delete mode 100755 kubeadm_install.sh diff --git a/kubeadm_install.sh b/kubeadm_install.sh deleted file mode 100755 index 6474c19..0000000 --- a/kubeadm_install.sh +++ /dev/null @@ -1,111 +0,0 @@ -#!/bin/bash - -# This script is used to automatically install the Kubernetes 1.4 cluster using the kubeadm command - -NODENAME=$1 -KUBEVERSION=$2 - -if [ "$NODENAME" != "master" ] && [ "$NODENAME" != "node" ]; then - echo -e "\033[31mError: Enter master or node to create a Kubernetes cluster!\033[0m" - echo -e "\033[33mExample: ./$0 master | node v1.4.1\033[0m" - exit 1 -fi - -if [ "$KUBEVERSION" == "" ]; then - echo -e "\033[31mError: Please enter the version of kubernetes image to use!\033[0m]" - echo -e "\033[33mExample: ./$0 master | node v1.4.1\033[0m" - exit 1 -fi - -# Clean up related files -echo -e "\033[32mStop kubelet...\033[0m" -systemctl stop kubelet - -/usr/bin/read -p "Do you want to clean up the Docker Container?(y/n): " cleanContainer - -if [ "$cleanContainer"=="y" ]; then - echo -e "\033[33mStart Deleting all Docker Containers...\033[0m" - docker rm -f -v $(docker ps -q) - echo -e "\033[32mClean up the Docker Container successfully...\033[0m" -fi - -echo -e "\033[32mClean up Kubernetes residual files...\033[0m" - -if [ -d /var/lib/kubelet ]; then - find /var/lib/kubelet | xargs -n 1 findmnt -n -t tmpfs -o TARGET -T | uniq | xargs -r umount -v -fi -rm -r -f /etc/kubernetes /var/lib/kubelet /var/lib/etcd - -# Install the Kubernetes rpm package -tee /etc/yum.repos.d/mritd.repo </dev/null 1>&2 - -systemctl enable docker -systemctl enable kubelet -systemctl start docker -systemctl start kubelet - -# Desable SELinux -setenforce 0 - -# Download adn Load the Kubernetes image -images=(kube-proxy-amd64:$KUBEVERSION \ - kube-discovery-amd64:1.0 \ - kubedns-amd64:1.7 \ - kube-scheduler-amd64:$KUBEVERSION \ - kube-controller-manager-amd64:$KUBEVERSION \ - kube-apiserver-amd64:$KUBEVERSION \ - etcd-amd64:2.2.5 \ - kube-dnsmasq-amd64:1.3 \ - exechealthz-amd64:1.1 \ - pause-amd64:3.0 \ - kubernetes-dashboard-amd64:v1.4.1) -for imageName in ${images[@]} ; do - docker pull mritd/$imageName - docker tag mritd/$imageName gcr.io/google_containers/$imageName - docker rmi mritd/$imageName -done - -# Processes the host name -/usr/bin/read -p "Please enter a hostname(Example: 192-168-1-100.node): " hostName - -if [ "$hostName"!="" ]; then - echo "$hostName" > /etc/hostname - echo "127.0.0.1 $hostName" >> /etc/hosts -else - echo -e "\033[31mError: hostname is blank!\033[0m" - exit 1 -fi - -if [ "$NODENAME"=="master" ]; then - - /usr/bin/read -p "Please enter the IP to bind(The Kubernetes API listens for this address): " bindIP - - if [ "bindIP"!="" ]; then - kubeadm init --api-advertise-addresses=$bindIP - else - kubeadm init - fi -elif [ "$NODENAME"=="node" ]; then - - /usr/bin/read -p "Enter the connection master token: " kubeMasterToken - /usr/bin/read -p "Please enter the master IP address: " kubeMasterIP - - if [ "$kubeMasterToken"!="" ] || [ "$kubeMasterIP"!="" ]; then - kubeadm join --token $kubeMasterToken $kubeMasterIP - else - echo -e "\033[0mError: kubeMasterToken or kubeMasterIP is blank!\033[0m" - exit - fi -fi From 617240b1b6e3d44828ead233aa27719d4f9e21f4 Mon Sep 17 00:00:00 2001 From: mritd Date: Fri, 10 Mar 2017 07:12:33 +0000 Subject: [PATCH 075/190] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=AD=BE=E5=90=8D?= =?UTF-8?q?=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- signature_rpm.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/signature_rpm.sh b/signature_rpm.sh index c6b3474..69d3b9a 100755 --- a/signature_rpm.sh +++ b/signature_rpm.sh @@ -3,7 +3,7 @@ yum install rpm-sign -y # clean old files -rm -f /data/repo/centos/7/x86_64/{kubelet*,kubeadm*,kubernetes-cni*,kubectl*} +#rm -f /data/repo/centos/7/x86_64/{kubelet*,kubeadm*,kubernetes-cni*,kubectl*} # signature rpms echo %_signature gpg > ~/.rpmmacros @@ -15,7 +15,7 @@ for rpmName in `ls ~/git_projects/adm_release/rpm/output/x86_64/*.rpm`; do done # create repodata -docker exec -it mritd_rpm_1 /root/flush.sh +`pwd`/flush_repo.sh # sync cdn `pwd`/syncrpm.sh From ed05f18bd297417c75b7fe376bcda9df54b233c1 Mon Sep 17 00:00:00 2001 From: mritd Date: Sun, 12 Mar 2017 17:46:14 +0800 Subject: [PATCH 076/190] init --- generate_kubectl_config.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100755 generate_kubectl_config.sh diff --git a/generate_kubectl_config.sh b/generate_kubectl_config.sh new file mode 100755 index 0000000..e69de29 From 3f99f06c2726763608a865d72867f06341f2272a Mon Sep 17 00:00:00 2001 From: mritd Date: Sun, 12 Mar 2017 18:02:04 +0800 Subject: [PATCH 077/190] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=20kubectl=20?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E7=94=9F=E6=88=90=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- generate_kubectl_config.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/generate_kubectl_config.sh b/generate_kubectl_config.sh index e69de29..3567d14 100755 --- a/generate_kubectl_config.sh +++ b/generate_kubectl_config.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +KUBE_API_SERVER=$1 +CERT_DIR=${CERT_DIR-"."} + +kubectl config set-cluster default-cluster --server=https:/${KUBE_API_SERVER} \ + --certificate-authority=${CERT_DIR}/ca.pem + +kubectl config set-credentials default-admin \ + --certificate-authority=${CERT_DIR}/ca.pem \ + --client-key=${CERT_DIR}/admin-key.pem \ + --client-certificate=${CERT_DIR}/admin.pem + +kubectl config set-context default-system --cluster=default-cluster --user=default-admin +kubectl config use-context default-system From d7cf2da1dfe5adb1dfc3f477f63f43f3c085b298 Mon Sep 17 00:00:00 2001 From: mritd Date: Thu, 16 Mar 2017 18:26:16 +0800 Subject: [PATCH 078/190] =?UTF-8?q?=E5=8E=BB=E9=99=A4=20https=20=E5=89=8D?= =?UTF-8?q?=E7=BC=80=EF=BC=8C=E7=9B=B4=E6=8E=A5=E6=89=8B=E5=8A=A8=E8=BE=93?= =?UTF-8?q?=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- generate_kubectl_config.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generate_kubectl_config.sh b/generate_kubectl_config.sh index 3567d14..65e6fd7 100755 --- a/generate_kubectl_config.sh +++ b/generate_kubectl_config.sh @@ -3,7 +3,7 @@ KUBE_API_SERVER=$1 CERT_DIR=${CERT_DIR-"."} -kubectl config set-cluster default-cluster --server=https:/${KUBE_API_SERVER} \ +kubectl config set-cluster default-cluster --server=${KUBE_API_SERVER} \ --certificate-authority=${CERT_DIR}/ca.pem kubectl config set-credentials default-admin \ From d0e58e68896cb3a3e95babe179dac6edc3d5c668 Mon Sep 17 00:00:00 2001 From: mritd Date: Sun, 19 Mar 2017 05:22:38 -0400 Subject: [PATCH 079/190] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=BB=A3=E7=90=86?= =?UTF-8?q?=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- install_proxy.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install_proxy.sh b/install_proxy.sh index ed4070f..688ca9d 100755 --- a/install_proxy.sh +++ b/install_proxy.sh @@ -1,7 +1,7 @@ #!/bin/bash tee /usr/local/bin/proxy < Date: Sun, 19 Mar 2017 05:23:04 -0400 Subject: [PATCH 080/190] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=BB=A3=E7=90=86?= =?UTF-8?q?=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- install_sshproxy.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install_sshproxy.sh b/install_sshproxy.sh index 15d0020..04718e9 100755 --- a/install_sshproxy.sh +++ b/install_sshproxy.sh @@ -2,7 +2,7 @@ tee /usr/local/bin/proxy-wrapper < Date: Mon, 20 Mar 2017 15:44:45 +0800 Subject: [PATCH 081/190] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=20docker=20=E9=95=9C?= =?UTF-8?q?=E5=83=8F=E5=AF=BC=E5=87=BA=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- export_docker_images.sh | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 export_docker_images.sh diff --git a/export_docker_images.sh b/export_docker_images.sh new file mode 100644 index 0000000..019691c --- /dev/null +++ b/export_docker_images.sh @@ -0,0 +1,2 @@ +#!/bin/bash +for imageName in `docker images | grep -v "REPOSITORY" | awk '{print $1":"$2}'`;do docker save $imageName > `echo $imageName | tr '/' '_' | tr ':' '_'`.tar ; done From c1833f93ca639f5842d0b49322ffdaf345181dd8 Mon Sep 17 00:00:00 2001 From: mritd Date: Tue, 21 Mar 2017 08:18:42 +0800 Subject: [PATCH 082/190] add wol --- wol.py | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100755 wol.py diff --git a/wol.py b/wol.py new file mode 100755 index 0000000..ae78a09 --- /dev/null +++ b/wol.py @@ -0,0 +1,46 @@ +#!/usr/bin/env python +#coding=utf-8 + +import socket, sys +import struct +def to_hex_int(s): + return int(s.upper(), 16) + +dest = ('192.168.1.255', 9) + +if len(sys.argv) < 2: + print("usage: %s " % sys.argv[0]) + sys.exit() + +mac = sys.argv[1] + +spliter = "" +if mac.count(":") == 5: spliter = ":" +if mac.count("-") == 5: spliter = "-" + +if spliter == "": + print("MAC address should be like XX:XX:XX:XX:XX:XX / XX-XX-XX-XX-XX-XX") + sys.exit() + +parts = mac.split(spliter) +a1 = to_hex_int(parts[0]) +a2 = to_hex_int(parts[1]) +a3 = to_hex_int(parts[2]) +a4 = to_hex_int(parts[3]) +a5 = to_hex_int(parts[4]) +a6 = to_hex_int(parts[5]) +addr = [a1, a2, a3, a4, a5, a6] + +packet = chr(255) + chr(255) + chr(255) + chr(255) + chr(255) + chr(255) + +for n in range(0,16): + for a in addr: + packet = packet + chr(a) + +packet = packet + chr(0) + chr(0) + chr(0) + chr(0) + chr(0) + chr(0) + +s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) +s.setsockopt(socket.SOL_SOCKET,socket.SO_BROADCAST,1) +s.sendto(packet,dest) + +print("WOL packet %d bytes sent !" % len(packet)) From 97b0352a6c08bd6ef06fd1ca25a9d564f0b581e9 Mon Sep 17 00:00:00 2001 From: mritd Date: Tue, 28 Mar 2017 00:08:53 +0900 Subject: [PATCH 083/190] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=20git=20=E5=AE=89?= =?UTF-8?q?=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- init.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.sh b/init.sh index 6452647..a853e56 100755 --- a/init.sh +++ b/init.sh @@ -1,5 +1,5 @@ #!/bin/bash yum update -y -yum install tmux wget lrzsz vim net-tools zsh bind-utils yum-utils ctags -y +yum install tmux wget lrzsz vim net-tools zsh bind-utils yum-utils ctags git -y sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)" From e68fd76d276fb8d125499cef019c0d89ec56fb5c Mon Sep 17 00:00:00 2001 From: mritd Date: Thu, 30 Mar 2017 04:11:25 -0400 Subject: [PATCH 084/190] =?UTF-8?q?=E7=95=99=E7=9D=80=E5=A4=87=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- color.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 color.sh diff --git a/color.sh b/color.sh new file mode 100644 index 0000000..c3fbabe --- /dev/null +++ b/color.sh @@ -0,0 +1,19 @@ +#/bin/bash + +echo -e "\033[30m 黑色字 \033[0m" +echo -e "\033[31m 红色字 \033[0m" +echo -e "\033[32m 绿色字 \033[0m" +echo -e "\033[33m ***字 \033[0m" +echo -e "\033[34m 蓝色字 \033[0m" +echo -e "\033[35m 紫色字 \033[0m" +echo -e "\033[36m 天蓝字 \033[0m" +echo -e "\033[37m 白色字 \033[0m" + +echo -e "\033[40;37m 黑底白字 \033[0m" +echo -e "\033[41;37m 红底白字 \033[0m" +echo -e "\033[42;37m 绿底白字 \033[0m" +echo -e "\033[43;37m 黄底白字 \033[0m" +echo -e "\033[44;37m 蓝底白字 \033[0m" +echo -e "\033[45;37m 紫底白字 \033[0m" +echo -e "\033[46;37m 天蓝底白字 \033[0m" +echo -e "\033[47;30m 白底黑字 \033[0m" From a3d60e1e277966a742d813d670d3b64d7f913447 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 7 Apr 2017 14:59:51 +0800 Subject: [PATCH 085/190] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=20docker=20=E5=AE=89?= =?UTF-8?q?=E8=A3=85=E6=A3=80=E6=9F=A5=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- color.sh | 0 docker-check-config.sh | 360 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 360 insertions(+) mode change 100644 => 100755 color.sh create mode 100755 docker-check-config.sh diff --git a/color.sh b/color.sh old mode 100644 new mode 100755 diff --git a/docker-check-config.sh b/docker-check-config.sh new file mode 100755 index 0000000..88eb8aa --- /dev/null +++ b/docker-check-config.sh @@ -0,0 +1,360 @@ +#!/usr/bin/env bash +set -e + +EXITCODE=0 + +# bits of this were adapted from lxc-checkconfig +# see also https://github.com/lxc/lxc/blob/lxc-1.0.2/src/lxc/lxc-checkconfig.in + +possibleConfigs=( + '/proc/config.gz' + "/boot/config-$(uname -r)" + "/usr/src/linux-$(uname -r)/.config" + '/usr/src/linux/.config' +) + +if [ $# -gt 0 ]; then + CONFIG="$1" +else + : ${CONFIG:="${possibleConfigs[0]}"} +fi + +if ! command -v zgrep &> /dev/null; then + zgrep() { + zcat "$2" | grep "$1" + } +fi + +kernelVersion="$(uname -r)" +kernelMajor="${kernelVersion%%.*}" +kernelMinor="${kernelVersion#$kernelMajor.}" +kernelMinor="${kernelMinor%%.*}" + +is_set() { + zgrep "CONFIG_$1=[y|m]" "$CONFIG" > /dev/null +} +is_set_in_kernel() { + zgrep "CONFIG_$1=y" "$CONFIG" > /dev/null +} +is_set_as_module() { + zgrep "CONFIG_$1=m" "$CONFIG" > /dev/null +} + +color() { + local codes=() + if [ "$1" = 'bold' ]; then + codes=( "${codes[@]}" '1' ) + shift + fi + if [ "$#" -gt 0 ]; then + local code= + case "$1" in + # see https://en.wikipedia.org/wiki/ANSI_escape_code#Colors + black) code=30 ;; + red) code=31 ;; + green) code=32 ;; + yellow) code=33 ;; + blue) code=34 ;; + magenta) code=35 ;; + cyan) code=36 ;; + white) code=37 ;; + esac + if [ "$code" ]; then + codes=( "${codes[@]}" "$code" ) + fi + fi + local IFS=';' + echo -en '\033['"${codes[*]}"'m' +} +wrap_color() { + text="$1" + shift + color "$@" + echo -n "$text" + color reset + echo +} + +wrap_good() { + echo "$(wrap_color "$1" white): $(wrap_color "$2" green)" +} +wrap_bad() { + echo "$(wrap_color "$1" bold): $(wrap_color "$2" bold red)" +} +wrap_warning() { + wrap_color >&2 "$*" red +} + +check_flag() { + if is_set_in_kernel "$1"; then + wrap_good "CONFIG_$1" 'enabled' + elif is_set_as_module "$1"; then + wrap_good "CONFIG_$1" 'enabled (as module)' + else + wrap_bad "CONFIG_$1" 'missing' + EXITCODE=1 + fi +} + +check_flags() { + for flag in "$@"; do + echo -n "- "; check_flag "$flag" + done +} + +check_command() { + if command -v "$1" >/dev/null 2>&1; then + wrap_good "$1 command" 'available' + else + wrap_bad "$1 command" 'missing' + EXITCODE=1 + fi +} + +check_device() { + if [ -c "$1" ]; then + wrap_good "$1" 'present' + else + wrap_bad "$1" 'missing' + EXITCODE=1 + fi +} + +check_distro_userns() { + source /etc/os-release 2>/dev/null || /bin/true + if [[ "${ID}" =~ ^(centos|rhel)$ && "${VERSION_ID}" =~ ^7 ]]; then + # this is a CentOS7 or RHEL7 system + grep -q "user_namespace.enable=1" /proc/cmdline || { + # no user namespace support enabled + wrap_bad " (RHEL7/CentOS7" "User namespaces disabled; add 'user_namespace.enable=1' to boot command line)" + EXITCODE=1 + } + fi +} + +if [ ! -e "$CONFIG" ]; then + wrap_warning "warning: $CONFIG does not exist, searching other paths for kernel config ..." + for tryConfig in "${possibleConfigs[@]}"; do + if [ -e "$tryConfig" ]; then + CONFIG="$tryConfig" + break + fi + done + if [ ! -e "$CONFIG" ]; then + wrap_warning "error: cannot find kernel config" + wrap_warning " try running this script again, specifying the kernel config:" + wrap_warning " CONFIG=/path/to/kernel/.config $0 or $0 /path/to/kernel/.config" + exit 1 + fi +fi + +wrap_color "info: reading kernel config from $CONFIG ..." white +echo + +echo 'Generally Necessary:' + +echo -n '- ' +cgroupSubsystemDir="$(awk '/[, ](cpu|cpuacct|cpuset|devices|freezer|memory)[, ]/ && $3 == "cgroup" { print $2 }' /proc/mounts | head -n1)" +cgroupDir="$(dirname "$cgroupSubsystemDir")" +if [ -d "$cgroupDir/cpu" -o -d "$cgroupDir/cpuacct" -o -d "$cgroupDir/cpuset" -o -d "$cgroupDir/devices" -o -d "$cgroupDir/freezer" -o -d "$cgroupDir/memory" ]; then + echo "$(wrap_good 'cgroup hierarchy' 'properly mounted') [$cgroupDir]" +else + if [ "$cgroupSubsystemDir" ]; then + echo "$(wrap_bad 'cgroup hierarchy' 'single mountpoint!') [$cgroupSubsystemDir]" + else + echo "$(wrap_bad 'cgroup hierarchy' 'nonexistent??')" + fi + EXITCODE=1 + echo " $(wrap_color '(see https://github.com/tianon/cgroupfs-mount)' yellow)" +fi + +if [ "$(cat /sys/module/apparmor/parameters/enabled 2>/dev/null)" = 'Y' ]; then + echo -n '- ' + if command -v apparmor_parser &> /dev/null; then + echo "$(wrap_good 'apparmor' 'enabled and tools installed')" + else + echo "$(wrap_bad 'apparmor' 'enabled, but apparmor_parser missing')" + echo -n ' ' + if command -v apt-get &> /dev/null; then + echo "$(wrap_color '(use "apt-get install apparmor" to fix this)')" + elif command -v yum &> /dev/null; then + echo "$(wrap_color '(your best bet is "yum install apparmor-parser")')" + else + echo "$(wrap_color '(look for an "apparmor" package for your distribution)')" + fi + EXITCODE=1 + fi +fi + +flags=( + NAMESPACES {NET,PID,IPC,UTS}_NS + CGROUPS CGROUP_CPUACCT CGROUP_DEVICE CGROUP_FREEZER CGROUP_SCHED CPUSETS MEMCG + KEYS + VETH BRIDGE BRIDGE_NETFILTER + NF_NAT_IPV4 IP_NF_FILTER IP_NF_TARGET_MASQUERADE + NETFILTER_XT_MATCH_{ADDRTYPE,CONNTRACK,IPVS} + IP_NF_NAT NF_NAT NF_NAT_NEEDED + + # required for bind-mounting /dev/mqueue into containers + POSIX_MQUEUE +) +check_flags "${flags[@]}" +if [ "$kernelMajor" -lt 4 ] || [ "$kernelMajor" -eq 4 -a "$kernelMinor" -lt 8 ]; then + check_flags DEVPTS_MULTIPLE_INSTANCES +fi + +echo + +echo 'Optional Features:' +{ + check_flags USER_NS + check_distro_userns +} +{ + check_flags SECCOMP +} +{ + check_flags CGROUP_PIDS +} +{ + CODE=${EXITCODE} + check_flags MEMCG_SWAP MEMCG_SWAP_ENABLED + if [ -e /sys/fs/cgroup/memory/memory.memsw.limit_in_bytes ]; then + echo " $(wrap_color '(cgroup swap accounting is currently enabled)' bold black)" + EXITCODE=${CODE} + elif is_set MEMCG_SWAP && ! is_set MEMCG_SWAP_ENABLED; then + echo " $(wrap_color '(cgroup swap accounting is currently not enabled, you can enable it by setting boot option "swapaccount=1")' bold black)" + fi +} +{ + if is_set LEGACY_VSYSCALL_NATIVE; then + echo -n "- "; wrap_bad "CONFIG_LEGACY_VSYSCALL_NATIVE" 'enabled' + echo " $(wrap_color '(dangerous, provides an ASLR-bypassing target with usable ROP gadgets.)' bold black)" + elif is_set LEGACY_VSYSCALL_EMULATE; then + echo -n "- "; wrap_good "CONFIG_LEGACY_VSYSCALL_EMULATE" 'enabled' + elif is_set LEGACY_VSYSCALL_NONE; then + echo -n "- "; wrap_bad "CONFIG_LEGACY_VSYSCALL_NONE" 'enabled' + echo " $(wrap_color '(containers using eglibc <= 2.13 will not work. Switch to' bold black)" + echo " $(wrap_color ' "CONFIG_VSYSCALL_[NATIVE|EMULATE]" or use "vsyscall=[native|emulate]"' bold black)" + echo " $(wrap_color ' on kernel command line. Note that this will disable ASLR for the,' bold black)" + echo " $(wrap_color ' VDSO which may assist in exploiting security vulnerabilities.)' bold black)" + # else Older kernels (prior to 3dc33bd30f3e, released in v4.40-rc1) do + # not have these LEGACY_VSYSCALL options and are effectively + # LEGACY_VSYSCALL_EMULATE. Even older kernels are presumably + # effectively LEGACY_VSYSCALL_NATIVE. + fi +} + +if [ "$kernelMajor" -lt 4 ] || [ "$kernelMajor" -eq 4 -a "$kernelMinor" -le 5 ]; then + check_flags MEMCG_KMEM +fi + +if [ "$kernelMajor" -lt 3 ] || [ "$kernelMajor" -eq 3 -a "$kernelMinor" -le 18 ]; then + check_flags RESOURCE_COUNTERS +fi + +if [ "$kernelMajor" -lt 3 ] || [ "$kernelMajor" -eq 3 -a "$kernelMinor" -le 13 ]; then + netprio=NETPRIO_CGROUP +else + netprio=CGROUP_NET_PRIO +fi + +flags=( + BLK_CGROUP BLK_DEV_THROTTLING IOSCHED_CFQ CFQ_GROUP_IOSCHED + CGROUP_PERF + CGROUP_HUGETLB + NET_CLS_CGROUP $netprio + CFS_BANDWIDTH FAIR_GROUP_SCHED RT_GROUP_SCHED + IP_VS + IP_VS_NFCT + IP_VS_RR +) +check_flags "${flags[@]}" + +if ! is_set EXT4_USE_FOR_EXT2; then + check_flags EXT3_FS EXT3_FS_XATTR EXT3_FS_POSIX_ACL EXT3_FS_SECURITY + if ! is_set EXT3_FS || ! is_set EXT3_FS_XATTR || ! is_set EXT3_FS_POSIX_ACL || ! is_set EXT3_FS_SECURITY; then + echo " $(wrap_color '(enable these ext3 configs if you are using ext3 as backing filesystem)' bold black)" + fi +fi + +check_flags EXT4_FS EXT4_FS_POSIX_ACL EXT4_FS_SECURITY +if ! is_set EXT4_FS || ! is_set EXT4_FS_POSIX_ACL || ! is_set EXT4_FS_SECURITY; then + if is_set EXT4_USE_FOR_EXT2; then + echo " $(wrap_color 'enable these ext4 configs if you are using ext3 or ext4 as backing filesystem' bold black)" + else + echo " $(wrap_color 'enable these ext4 configs if you are using ext4 as backing filesystem' bold black)" + fi +fi + +echo '- Network Drivers:' +echo ' - "'$(wrap_color 'overlay' blue)'":' +check_flags VXLAN | sed 's/^/ /' +echo ' Optional (for encrypted networks):' +check_flags CRYPTO CRYPTO_AEAD CRYPTO_GCM CRYPTO_SEQIV CRYPTO_GHASH \ + XFRM XFRM_USER XFRM_ALGO INET_ESP INET_XFRM_MODE_TRANSPORT | sed 's/^/ /' +echo ' - "'$(wrap_color 'ipvlan' blue)'":' +check_flags IPVLAN | sed 's/^/ /' +echo ' - "'$(wrap_color 'macvlan' blue)'":' +check_flags MACVLAN DUMMY | sed 's/^/ /' +echo ' - "'$(wrap_color 'ftp,tftp client in container' blue)'":' +check_flags NF_NAT_FTP NF_CONNTRACK_FTP NF_NAT_TFTP NF_CONNTRACK_TFTP | sed 's/^/ /' + +# only fail if no storage drivers available +CODE=${EXITCODE} +EXITCODE=0 +STORAGE=1 + +echo '- Storage Drivers:' +echo ' - "'$(wrap_color 'aufs' blue)'":' +check_flags AUFS_FS | sed 's/^/ /' +if ! is_set AUFS_FS && grep -q aufs /proc/filesystems; then + echo " $(wrap_color '(note that some kernels include AUFS patches but not the AUFS_FS flag)' bold black)" +fi +[ "$EXITCODE" = 0 ] && STORAGE=0 +EXITCODE=0 + +echo ' - "'$(wrap_color 'btrfs' blue)'":' +check_flags BTRFS_FS | sed 's/^/ /' +check_flags BTRFS_FS_POSIX_ACL | sed 's/^/ /' +[ "$EXITCODE" = 0 ] && STORAGE=0 +EXITCODE=0 + +echo ' - "'$(wrap_color 'devicemapper' blue)'":' +check_flags BLK_DEV_DM DM_THIN_PROVISIONING | sed 's/^/ /' +[ "$EXITCODE" = 0 ] && STORAGE=0 +EXITCODE=0 + +echo ' - "'$(wrap_color 'overlay' blue)'":' +check_flags OVERLAY_FS | sed 's/^/ /' +[ "$EXITCODE" = 0 ] && STORAGE=0 +EXITCODE=0 + +echo ' - "'$(wrap_color 'zfs' blue)'":' +echo -n " - "; check_device /dev/zfs +echo -n " - "; check_command zfs +echo -n " - "; check_command zpool +[ "$EXITCODE" = 0 ] && STORAGE=0 +EXITCODE=0 + +EXITCODE=$CODE +[ "$STORAGE" = 1 ] && EXITCODE=1 + +echo + +check_limit_over() +{ + if [ $(cat "$1") -le "$2" ]; then + wrap_bad "- $1" "$(cat $1)" + wrap_color " This should be set to at least $2, for example set: sysctl -w kernel/keys/root_maxkeys=1000000" bold black + EXITCODE=1 + else + wrap_good "- $1" "$(cat $1)" + fi +} + +echo 'Limits:' +check_limit_over /proc/sys/kernel/keys/root_maxkeys 10000 +echo + +exit $EXITCODE From de9d88cb31ddabf614ad5cb819cd5b814509e2a0 Mon Sep 17 00:00:00 2001 From: root Date: Sat, 8 Apr 2017 12:09:49 +0800 Subject: [PATCH 086/190] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=8F=AF=E6=89=A7?= =?UTF-8?q?=E8=A1=8C=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- export_docker_images.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 export_docker_images.sh diff --git a/export_docker_images.sh b/export_docker_images.sh old mode 100644 new mode 100755 From bce57909e01c03a98d74ca3f43881812f9b4854e Mon Sep 17 00:00:00 2001 From: mritd Date: Sat, 8 Apr 2017 14:13:02 +0800 Subject: [PATCH 087/190] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=BB=A3=E7=90=86?= =?UTF-8?q?=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docker_proxy.sh | 4 ++-- install_proxy.sh | 2 +- install_sshproxy.sh | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docker_proxy.sh b/docker_proxy.sh index 8719130..63de4f4 100755 --- a/docker_proxy.sh +++ b/docker_proxy.sh @@ -12,13 +12,13 @@ elif [ "$OS_TYPE" == "centos" ];then mkdir /etc/systemd/system/docker.service.d || true tee /etc/systemd/system/docker.service.d/socks5-proxy.conf <<-EOF [Service] -Environment="ALL_PROXY=socks5://192.168.1.105:1080" +Environment="ALL_PROXY=socks5://192.168.1.21:1080" EOF elif [ "$OS_TYPE" == "ubuntu" ];then mkdir /lib/systemd/system/docker.service.d || true tee /lib/systemd/system/docker.service.d/socks5-proxy.conf <<-EOF [Service] -Environment="ALL_PROXY=socks5://192.168.1.120:1083" +Environment="ALL_PROXY=socks5://192.168.1.21:1083" EOF fi diff --git a/install_proxy.sh b/install_proxy.sh index 688ca9d..5724aae 100755 --- a/install_proxy.sh +++ b/install_proxy.sh @@ -1,7 +1,7 @@ #!/bin/bash tee /usr/local/bin/proxy < Date: Sat, 8 Apr 2017 14:16:10 +0800 Subject: [PATCH 088/190] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=BB=A3=E7=90=86?= =?UTF-8?q?=E5=91=BD=E4=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- install_sshproxy.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/install_sshproxy.sh b/install_sshproxy.sh index aa44a24..19f7459 100755 --- a/install_sshproxy.sh +++ b/install_sshproxy.sh @@ -2,7 +2,8 @@ tee /usr/local/bin/proxy-wrapper < Date: Sat, 8 Apr 2017 18:09:09 +0900 Subject: [PATCH 089/190] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=90=8C=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- syncrpm.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/syncrpm.sh b/syncrpm.sh index d6347b6..03801ff 100755 --- a/syncrpm.sh +++ b/syncrpm.sh @@ -1,5 +1,7 @@ #!/bin/bash +set -e + # clean old files upx rm centos/7/x86_64/\* upx rm centos/7/x86_64/repodata/\* From cdc3e54b4b65dc8adcef648596c921098f8ee702 Mon Sep 17 00:00:00 2001 From: mritd Date: Tue, 16 May 2017 12:50:58 +0800 Subject: [PATCH 090/190] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=20=20kernel-lt-heade?= =?UTF-8?q?rs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kernel_update.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel_update.sh b/kernel_update.sh index 94dae1f..45403d4 100755 --- a/kernel_update.sh +++ b/kernel_update.sh @@ -7,7 +7,7 @@ rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm # install kernel -yum --enablerepo=elrepo-kernel install kernel-lt-devel kernel-lt -y +yum --enablerepo=elrepo-kernel install kernel-lt kernel-lt-headers kernel-lt-devel -y # modify grub grub2-set-default 0 From afaf72c1c22111f662b71d5176d99f82ddc5bd30 Mon Sep 17 00:00:00 2001 From: mritd Date: Thu, 29 Jun 2017 20:33:00 +0800 Subject: [PATCH 091/190] =?UTF-8?q?=E6=9B=B4=E6=8D=A2=E8=AF=81=E4=B9=A6?= =?UTF-8?q?=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- generate_kubectl_config.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/generate_kubectl_config.sh b/generate_kubectl_config.sh index 65e6fd7..ffa57c1 100755 --- a/generate_kubectl_config.sh +++ b/generate_kubectl_config.sh @@ -8,8 +8,8 @@ kubectl config set-cluster default-cluster --server=${KUBE_API_SERVER} \ kubectl config set-credentials default-admin \ --certificate-authority=${CERT_DIR}/ca.pem \ - --client-key=${CERT_DIR}/admin-key.pem \ - --client-certificate=${CERT_DIR}/admin.pem + --client-key=${CERT_DIR}/apiserver-key.pem \ + --client-certificate=${CERT_DIR}/apiserver.pem kubectl config set-context default-system --cluster=default-cluster --user=default-admin kubectl config use-context default-system From 04d5d38e44a36452dd0194c7c6515f25c57d6c47 Mon Sep 17 00:00:00 2001 From: mritd Date: Thu, 13 Jul 2017 00:21:10 +0900 Subject: [PATCH 092/190] =?UTF-8?q?=E5=90=8C=E6=AD=A5=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- signature_rpm.sh | 12 ++++++++++-- syncrpm.sh | 12 ++++++++---- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/signature_rpm.sh b/signature_rpm.sh index 69d3b9a..df8bfd5 100755 --- a/signature_rpm.sh +++ b/signature_rpm.sh @@ -1,6 +1,14 @@ #/bin/bash -yum install rpm-sign -y +set -e + +RPM_DIR=$1 + +if [ "$RPM_DIR" == "" ];then + echo -e "\033[31mError: RPM_DIR is blank!\033[0m" + exit 1 +fi +#yum install rpm-sign -y # clean old files #rm -f /data/repo/centos/7/x86_64/{kubelet*,kubeadm*,kubernetes-cni*,kubectl*} @@ -9,7 +17,7 @@ yum install rpm-sign -y echo %_signature gpg > ~/.rpmmacros echo "%_gpg_name mritd (mritd rpm repository)" >> ~/.rpmmacros -for rpmName in `ls ~/git_projects/adm_release/rpm/output/x86_64/*.rpm`; do +for rpmName in `ls ${RPM_DIR}/*.rpm`; do rpm --addsign $rpmName cp -f $rpmName /data/repo/centos/7/x86_64 done diff --git a/syncrpm.sh b/syncrpm.sh index 03801ff..4114166 100755 --- a/syncrpm.sh +++ b/syncrpm.sh @@ -2,16 +2,20 @@ set -e +FORCEPUSH=$1 + # clean old files upx rm centos/7/x86_64/\* upx rm centos/7/x86_64/repodata/\* # waiting cdn clean cache echo "Wating cdn sync:" -for i in `seq -w 120 -1 1`;do - echo -ne "\033[1;31;32m\b\b\b$i\033[0m"; - sleep 1; -done +if ! [ "$FORCEPUSH" == "-f" ];then + for i in `seq -w 120 -1 1`;do + echo -ne "\033[1;31;32m\b\b\b$i\033[0m"; + sleep 1; + done +fi # sync rpm cd /data/repo/centos/7/x86_64/ && for rpmName in `ls *.rpm`;do upx put $rpmName centos/7/x86_64/;done From 3fc57b6cfc029a93665478fe1e24a47315470bbb Mon Sep 17 00:00:00 2001 From: mritd Date: Wed, 9 Aug 2017 12:58:15 +0800 Subject: [PATCH 093/190] =?UTF-8?q?=E8=B0=83=E6=95=B4=E7=AD=BE=E5=90=8D?= =?UTF-8?q?=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- signature_rpm.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/signature_rpm.sh b/signature_rpm.sh index df8bfd5..b6e5f66 100755 --- a/signature_rpm.sh +++ b/signature_rpm.sh @@ -11,7 +11,7 @@ fi #yum install rpm-sign -y # clean old files -#rm -f /data/repo/centos/7/x86_64/{kubelet*,kubeadm*,kubernetes-cni*,kubectl*} +rm -f /data/repo/centos/7/x86_64/kubernetes-* # signature rpms echo %_signature gpg > ~/.rpmmacros From 0bc8bd6a0fb2cff0a5d8a0258aa2df968fc9fe12 Mon Sep 17 00:00:00 2001 From: mritd Date: Fri, 18 Aug 2017 15:14:07 +0800 Subject: [PATCH 094/190] =?UTF-8?q?=E5=88=87=E6=8D=A2=E8=AF=81=E4=B9=A6?= =?UTF-8?q?=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- generate_kubectl_config.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/generate_kubectl_config.sh b/generate_kubectl_config.sh index ffa57c1..74bed35 100755 --- a/generate_kubectl_config.sh +++ b/generate_kubectl_config.sh @@ -4,12 +4,12 @@ KUBE_API_SERVER=$1 CERT_DIR=${CERT_DIR-"."} kubectl config set-cluster default-cluster --server=${KUBE_API_SERVER} \ - --certificate-authority=${CERT_DIR}/ca.pem + --certificate-authority=${CERT_DIR}/k8s-roor-ca.pem.pem kubectl config set-credentials default-admin \ - --certificate-authority=${CERT_DIR}/ca.pem \ - --client-key=${CERT_DIR}/apiserver-key.pem \ - --client-certificate=${CERT_DIR}/apiserver.pem + --certificate-authority=${CERT_DIR}/k8s-roor-ca.pem \ + --client-key=${CERT_DIR}/admin-key.pem \ + --client-certificate=${CERT_DIR}/admin.pem kubectl config set-context default-system --cluster=default-cluster --user=default-admin kubectl config use-context default-system From 69927788d71b7dc1b541d23ced7c72ce741feada Mon Sep 17 00:00:00 2001 From: mritd Date: Fri, 18 Aug 2017 15:14:48 +0800 Subject: [PATCH 095/190] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=20=E8=AF=81=E4=B9=A6?= =?UTF-8?q?=E5=90=8D=E7=A7=B0=E9=94=99=E8=AF=AF=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- generate_kubectl_config.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generate_kubectl_config.sh b/generate_kubectl_config.sh index 74bed35..d2085a7 100755 --- a/generate_kubectl_config.sh +++ b/generate_kubectl_config.sh @@ -4,7 +4,7 @@ KUBE_API_SERVER=$1 CERT_DIR=${CERT_DIR-"."} kubectl config set-cluster default-cluster --server=${KUBE_API_SERVER} \ - --certificate-authority=${CERT_DIR}/k8s-roor-ca.pem.pem + --certificate-authority=${CERT_DIR}/k8s-roor-ca.pem kubectl config set-credentials default-admin \ --certificate-authority=${CERT_DIR}/k8s-roor-ca.pem \ From 414c94d66007ba8e94ca800176fb313ba2b842b0 Mon Sep 17 00:00:00 2001 From: mritd Date: Fri, 18 Aug 2017 15:15:21 +0800 Subject: [PATCH 096/190] WTF --- generate_kubectl_config.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/generate_kubectl_config.sh b/generate_kubectl_config.sh index d2085a7..5eb0e33 100755 --- a/generate_kubectl_config.sh +++ b/generate_kubectl_config.sh @@ -4,10 +4,10 @@ KUBE_API_SERVER=$1 CERT_DIR=${CERT_DIR-"."} kubectl config set-cluster default-cluster --server=${KUBE_API_SERVER} \ - --certificate-authority=${CERT_DIR}/k8s-roor-ca.pem + --certificate-authority=${CERT_DIR}/k8s-root-ca.pem kubectl config set-credentials default-admin \ - --certificate-authority=${CERT_DIR}/k8s-roor-ca.pem \ + --certificate-authority=${CERT_DIR}/k8s-root-ca.pem \ --client-key=${CERT_DIR}/admin-key.pem \ --client-certificate=${CERT_DIR}/admin.pem From a35a220902f2d29d254e90dd336f292919464222 Mon Sep 17 00:00:00 2001 From: mritd Date: Thu, 7 Sep 2017 20:33:58 +0800 Subject: [PATCH 097/190] =?UTF-8?q?=E7=A6=81=E6=AD=A2=E5=88=A0=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- signature_rpm.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/signature_rpm.sh b/signature_rpm.sh index b6e5f66..802f1db 100755 --- a/signature_rpm.sh +++ b/signature_rpm.sh @@ -11,7 +11,7 @@ fi #yum install rpm-sign -y # clean old files -rm -f /data/repo/centos/7/x86_64/kubernetes-* +#rm -f /data/repo/centos/7/x86_64/kubernetes-* # signature rpms echo %_signature gpg > ~/.rpmmacros From 479972e4b4ac46a5c988288522b134dba1ee5944 Mon Sep 17 00:00:00 2001 From: mritd Date: Sun, 10 Sep 2017 10:55:23 +0800 Subject: [PATCH 098/190] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BB=93=E5=BA=93?= =?UTF-8?q?=E5=9C=B0=E5=9D=80=E6=A0=B7=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- create_imagePullSecret.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/create_imagePullSecret.sh b/create_imagePullSecret.sh index 30fa530..14e9ace 100755 --- a/create_imagePullSecret.sh +++ b/create_imagePullSecret.sh @@ -6,11 +6,11 @@ tee imagePullSecret.yaml < Date: Sun, 10 Sep 2017 10:58:04 +0800 Subject: [PATCH 099/190] =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=8A=A8=E6=80=81?= =?UTF-8?q?=E4=BB=93=E5=BA=93=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- create_imagePullSecret.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/create_imagePullSecret.sh b/create_imagePullSecret.sh index 14e9ace..0c8cd75 100755 --- a/create_imagePullSecret.sh +++ b/create_imagePullSecret.sh @@ -1,16 +1,23 @@ #!/bin/bash REGISTRY_TOKEN=`sudo cat ~/.docker/config.json | base64 | tr -d '\n'` +REGISTRY_ADDRESS=$1 + +if [ "" == $REGISTRY_ADDRESS ] + echo -e "\033[31mError: REGISTRY_ADDRESS is blank!\033[0m" + exit 1 +fi + tee imagePullSecret.yaml < Date: Sun, 10 Sep 2017 11:01:48 +0800 Subject: [PATCH 100/190] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E8=84=9A=E6=9C=AC?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- create_imagePullSecret.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/create_imagePullSecret.sh b/create_imagePullSecret.sh index 0c8cd75..16d8794 100755 --- a/create_imagePullSecret.sh +++ b/create_imagePullSecret.sh @@ -3,7 +3,7 @@ REGISTRY_TOKEN=`sudo cat ~/.docker/config.json | base64 | tr -d '\n'` REGISTRY_ADDRESS=$1 -if [ "" == $REGISTRY_ADDRESS ] +if [ "" == $REGISTRY_ADDRESS ]; then echo -e "\033[31mError: REGISTRY_ADDRESS is blank!\033[0m" exit 1 fi From 56d34baca6ce1ff68945866531525da205ea9b0b Mon Sep 17 00:00:00 2001 From: mritd Date: Mon, 25 Sep 2017 15:38:27 +0800 Subject: [PATCH 101/190] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=20git=20=E5=A4=A7?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E6=B8=85=E7=90=86=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- git_clean.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 git_clean.sh diff --git a/git_clean.sh b/git_clean.sh new file mode 100644 index 0000000..40e6024 --- /dev/null +++ b/git_clean.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +git rev-list --objects --all | grep "$(git verify-pack -v .git/objects/pack/*.idx | sort -k 3 -n | tail -5 | awk '{print$1}')" + +git filter-branch --force --index-filter 'git rm -rf --cached --ignore-unmatch BIGFILE' --prune-empty --tag-name-filter cat -- --all + +git push origin master --force + +rm -rf .git/refs/original/ + +git reflog expire --expire=now --all + +git gc --prune=now From 932737a6ba21f600e40bc8e4e558222d214e9cb4 Mon Sep 17 00:00:00 2001 From: mritd Date: Mon, 25 Sep 2017 15:39:26 +0800 Subject: [PATCH 102/190] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=8F=AF=E6=89=A7?= =?UTF-8?q?=E8=A1=8C=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- git_clean.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 git_clean.sh diff --git a/git_clean.sh b/git_clean.sh old mode 100644 new mode 100755 From e506f9f99cc07f6ab672cb468584fd5d08d9b6f9 Mon Sep 17 00:00:00 2001 From: mritd Date: Tue, 3 Oct 2017 20:18:57 +0800 Subject: [PATCH 103/190] =?UTF-8?q?feat(*):=20=E6=9B=B4=E6=8D=A2=20gpg?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 更换 gpg Signed-off-by: mritd --- signature_rpm.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/signature_rpm.sh b/signature_rpm.sh index 802f1db..8950b39 100755 --- a/signature_rpm.sh +++ b/signature_rpm.sh @@ -15,7 +15,7 @@ fi # signature rpms echo %_signature gpg > ~/.rpmmacros -echo "%_gpg_name mritd (mritd rpm repository)" >> ~/.rpmmacros +echo "%_gpg_name mritd" >> ~/.rpmmacros for rpmName in `ls ${RPM_DIR}/*.rpm`; do rpm --addsign $rpmName From 8f0778a978a37d5cfdea424b8d9c90aeead195b5 Mon Sep 17 00:00:00 2001 From: mritd Date: Wed, 18 Oct 2017 15:36:06 +0800 Subject: [PATCH 104/190] feat(init.sh): add htop epel add htop epel Signed-off-by: mritd --- init.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/init.sh b/init.sh index a853e56..24b47c4 100755 --- a/init.sh +++ b/init.sh @@ -1,5 +1,5 @@ #!/bin/bash yum update -y -yum install tmux wget lrzsz vim net-tools zsh bind-utils yum-utils ctags git -y +yum install epel-release -y +yum install tmux wget lrzsz vim net-tools zsh bind-utils yum-utils ctags git htop -y sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)" - From 72dff76f89f11ce82beaf5e77dc0c7d14b219d29 Mon Sep 17 00:00:00 2001 From: mritd Date: Thu, 26 Oct 2017 20:59:28 +0800 Subject: [PATCH 105/190] feat(docker): add images save script add images save script Signed-off-by: mritd --- save_images.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100755 save_images.sh diff --git a/save_images.sh b/save_images.sh new file mode 100755 index 0000000..e4e511a --- /dev/null +++ b/save_images.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +if [ "$1" = "" ]; then + echo "Error: image Name is blank!" + exit 1 +fi + +allImages=($1) + +for imageName in allImages; do + docker save $imageName > `echo $imageName | tr '/' '_' | tr ':' '_'`.tar; +done From a706fc19484d1de6d235a6e0bbbdf4065f762d42 Mon Sep 17 00:00:00 2001 From: mritd Date: Thu, 26 Oct 2017 21:08:40 +0800 Subject: [PATCH 106/190] =?UTF-8?q?feat(docker):=20=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E6=89=B9=E9=87=8F=E5=AF=BC=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 支持批量导出 Signed-off-by: mritd --- save_images.sh | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/save_images.sh b/save_images.sh index e4e511a..8713379 100755 --- a/save_images.sh +++ b/save_images.sh @@ -1,12 +1,20 @@ #!/bin/bash -if [ "$1" = "" ]; then +if [ "${shellName}" == "zsh" ]; then + read "images?请输入待导出的镜像名称: " +else + read -p "输入待导出的镜像名称: " images +fi + +if [ "${images}" = "" ]; then echo "Error: image Name is blank!" exit 1 fi -allImages=($1) +allImages=(${images}) -for imageName in allImages; do - docker save $imageName > `echo $imageName | tr '/' '_' | tr ':' '_'`.tar; +for imageName in ${allImages[@]}; do + echo "Export image: ${imageName}..." + docker save ${imageName} > `echo ${imageName} | tr '/' '_' | tr ':' '_'`.tar; + echo "done!" done From 2d1ba28104d8deac8ff355e78b65ed66c22dec7b Mon Sep 17 00:00:00 2001 From: mritd Date: Mon, 20 Nov 2017 10:56:44 +0800 Subject: [PATCH 107/190] =?UTF-8?q?:sparkles:=20feat(imagePullSecret):=20?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=20namesapce=20=E8=8E=B7=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 增加 namesapce 获取 Signed-off-by: mritd --- create_imagePullSecret.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/create_imagePullSecret.sh b/create_imagePullSecret.sh index 16d8794..84e5969 100755 --- a/create_imagePullSecret.sh +++ b/create_imagePullSecret.sh @@ -2,8 +2,9 @@ REGISTRY_TOKEN=`sudo cat ~/.docker/config.json | base64 | tr -d '\n'` REGISTRY_ADDRESS=$1 +NAMESPACE=${NAMESAPCE:-"default"} -if [ "" == $REGISTRY_ADDRESS ]; then +if [ "" == ${REGISTRY_ADDRESS} ]; then echo -e "\033[31mError: REGISTRY_ADDRESS is blank!\033[0m" exit 1 fi @@ -13,11 +14,11 @@ tee imagePullSecret.yaml < Date: Mon, 20 Nov 2017 11:23:29 +0800 Subject: [PATCH 108/190] =?UTF-8?q?:bug:fix(imagePullSecret):=20=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E5=AD=97=E7=AC=A6=E4=B8=B2=E5=88=A4=E6=96=AD=E9=94=99?= =?UTF-8?q?=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复字符串判断错误 Signed-off-by: mritd --- create_imagePullSecret.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/create_imagePullSecret.sh b/create_imagePullSecret.sh index 84e5969..e33e305 100755 --- a/create_imagePullSecret.sh +++ b/create_imagePullSecret.sh @@ -1,10 +1,12 @@ #!/bin/bash +set -e + REGISTRY_TOKEN=`sudo cat ~/.docker/config.json | base64 | tr -d '\n'` -REGISTRY_ADDRESS=$1 +REGISTRY_ADDRESS=${REGISTRY_ADDRESS-:"reg.mritd.me"} NAMESPACE=${NAMESAPCE:-"default"} -if [ "" == ${REGISTRY_ADDRESS} ]; then +if [ "" == "${REGISTRY_ADDRESS}" ]; then echo -e "\033[31mError: REGISTRY_ADDRESS is blank!\033[0m" exit 1 fi @@ -14,7 +16,7 @@ tee imagePullSecret.yaml < Date: Mon, 20 Nov 2017 11:25:15 +0800 Subject: [PATCH 109/190] =?UTF-8?q?:bug:fix(imagePullSecret):=20=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3=E5=8F=98=E9=87=8F=E5=90=8D=E7=A7=B0=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修正变量名称错误 Signed-off-by: mritd --- create_imagePullSecret.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/create_imagePullSecret.sh b/create_imagePullSecret.sh index e33e305..90d3816 100755 --- a/create_imagePullSecret.sh +++ b/create_imagePullSecret.sh @@ -4,7 +4,7 @@ set -e REGISTRY_TOKEN=`sudo cat ~/.docker/config.json | base64 | tr -d '\n'` REGISTRY_ADDRESS=${REGISTRY_ADDRESS-:"reg.mritd.me"} -NAMESPACE=${NAMESAPCE:-"default"} +NAMESPACE=${NAMESPACE:-"default"} if [ "" == "${REGISTRY_ADDRESS}" ]; then echo -e "\033[31mError: REGISTRY_ADDRESS is blank!\033[0m" From 881ca849a058e5f238ce5fada72aaf289b9ef5e0 Mon Sep 17 00:00:00 2001 From: mritd Date: Mon, 20 Nov 2017 12:09:35 +0800 Subject: [PATCH 110/190] =?UTF-8?q?:bug:fix(imagePullSecret):=20=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=20path=20=E5=91=BD=E5=90=8D=E7=A9=BA=E9=97=B4?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复 path 命名空间问题 Signed-off-by: mritd --- create_imagePullSecret.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/create_imagePullSecret.sh b/create_imagePullSecret.sh index 90d3816..752c9d7 100755 --- a/create_imagePullSecret.sh +++ b/create_imagePullSecret.sh @@ -23,4 +23,4 @@ data: type: kubernetes.io/dockerconfigjson EOF kubectl create -f imagePullSecret.yaml -kubectl patch serviceaccounts default -p "{\"imagePullSecrets\":[{\"name\":\"${REGISTRY_ADDRESS}\"}]}" +kubectl patch serviceaccounts default -p "{\"imagePullSecrets\":[{\"name\":\"${REGISTRY_ADDRESS}\"}]}" -n ${NAMESPACE} From 2261f38525675bc4f7435f253bc6ee8e8012c7cd Mon Sep 17 00:00:00 2001 From: mritd Date: Mon, 20 Nov 2017 20:09:38 +0800 Subject: [PATCH 111/190] :sparkles: feat(devicemapper): delete devicemapper script delete devicemapper script Signed-off-by: mritd --- docker_devicemapper.sh | 81 ------------------------------------------ 1 file changed, 81 deletions(-) delete mode 100755 docker_devicemapper.sh diff --git a/docker_devicemapper.sh b/docker_devicemapper.sh deleted file mode 100755 index 713215a..0000000 --- a/docker_devicemapper.sh +++ /dev/null @@ -1,81 +0,0 @@ -#!/bin/bash - -device_name=$1 -force_delete=$2 - -if [ "$1" == "" ]; then - echo -e "" - echo -e "\033[33muse \"./docker_devicemapper.sh DEVVICE [-f]\" config docker devicemapper!\033[0m" - echo -e "\033[33mIf using the -f option will be forced to delete existing devicemapper!\033[0m" - echo -e "\033[32mexample: /docker_devicemapper.sh /dev/sdb -f\033[0m" - exit 1 -fi - -yum install -y lvm2 - -if [ "$force_delete" != "" ] && [ "$force_delete" == "-f" ]; then - echo -e "\033[33mForced to delete old devicemapper!\033[0m" - lvremove docker -ff -fi - -if mount | grep $device_name 2>&1 > /dev/null ; then - if ! umount $device_name ; then - echo -e "\033[31mThe device is busy, umount failure!\033[0m" - exit 1 - fi -fi - -echo -e "\033[32mCreate a physical volume replacing $device_name with your block device.\033[0m" -if [ "$force_delete" == "-f" ]; then - if ! pvcreate $device_name -ff ; then - echo -e "\033[31mError: Create a physical volume failed!\033[0m" - exit 1 - fi -else - if ! pvcreate $device_name ; then - echo -e "\033[31mError: Create a physical volume failed!\033[0m" - echo -e "\033[33mIf you want to continue, please use the -f option!\033[0m" - exit 1 - fi -fi - -echo -e "\033[32mCreate a ‘docker’ volume group.\033[0m" -vgcreate docker $device_name - -echo -e "\033[32mCreate a thin pool named thinpool.\033[0m" -lvcreate --wipesignatures y -n thinpool docker -l 95%VG -lvcreate --wipesignatures y -n thinpoolmeta docker -l 1%VG - -echo -e "\033[32mConvert the pool to a thin pool.\033[0m" -lvconvert -y --zero n -c 512K --thinpool docker/thinpool --poolmetadata docker/thinpoolmeta - -echo -e "\033[32mConfigure autoextension of thin pools via an lvm profile.\033[0m" -tee /etc/lvm/profile/docker-thinpool.profile << EOF -activation { - thin_pool_autoextend_threshold=80 - thin_pool_autoextend_percent=20 -} -EOF - -echo -e "\033[32mApply your new lvm profile\033[0m" -lvchange --metadataprofile docker-thinpool docker/thinpool - -echo -e "\033[33mVerify the lv is monitored.\033[0m" -lvs -o+seg_monitor - -echo -e "\033[32mStop docker daemon.\033[0m" -systemctl stop docker - -echo -e "\033[32mClear graph driver directory.\033[0m" -rm -rf /var/lib/docker/* - -echo -e "\033[32mConfigure the Docker daemon with specific devicemapper options.\033[0m" -if ! grep "\-\-storage-driver=devicemapper" /usr/lib/systemd/system/docker.service 2>&1 > /dev/null ;then - sed -i "s@ExecStart=/usr/bin/dockerd@ExecStart=/usr/bin/dockerd --storage-driver=devicemapper --storage-opt=dm.thinpooldev=/dev/mapper/docker-thinpool --storage-opt dm.use_deferred_removal=true --storage-opt=dm.use_deferred_deletion=true @g" /usr/lib/systemd/system/docker.service - systemctl daemon-reload -else - echo -e "\033[33mFound '--storage-driver=devicemapper' option,not to replace!" -fi - -echo -e "\033[32mStart docker daemon.\033[0m" -systemctl start docker From 72ebed666d1bdd47172a6a3b25b96973f1a014e7 Mon Sep 17 00:00:00 2001 From: mritd Date: Mon, 20 Nov 2017 20:12:54 +0800 Subject: [PATCH 112/190] =?UTF-8?q?:sparkles:=20feat(docker=20proxy):=20?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=20socks5=20=E4=BB=A3=E7=90=86=E5=9C=B0?= =?UTF-8?q?=E5=9D=80=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 增加 socks5 代理地址设置 Signed-off-by: mritd --- docker_proxy.sh | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/docker_proxy.sh b/docker_proxy.sh index 63de4f4..0a98ffe 100755 --- a/docker_proxy.sh +++ b/docker_proxy.sh @@ -3,22 +3,29 @@ set -e OS_TYPE=$1 +PROXY_ADDRESS=$2 -if [ "$OS_TYPE" == "" ];then +if [ "${PROXY_ADDRESS}" == "" ]; then + echo -e "\033[31mError: PROXY_ADDRESS is blank!\033[0m" + echo -e "\033[32mUse: sudo $0 centos|ubuntu 1.2.3.4:1080\033[0m" + exit 1 +fi + +if [ "${OS_TYPE}" == "" ];then echo -e "\033[31mError: OS_TYPE is blank!\033[0m" echo -e "\033[32mUse: sudo $0 centos|ubuntu\033[0m" exit 1 -elif [ "$OS_TYPE" == "centos" ];then +elif [ "${OS_TYPE}" == "centos" ];then mkdir /etc/systemd/system/docker.service.d || true tee /etc/systemd/system/docker.service.d/socks5-proxy.conf <<-EOF [Service] -Environment="ALL_PROXY=socks5://192.168.1.21:1080" +Environment="ALL_PROXY=socks5://${PROXY_ADDRESS}" EOF -elif [ "$OS_TYPE" == "ubuntu" ];then +elif [ "${OS_TYPE}" == "ubuntu" ];then mkdir /lib/systemd/system/docker.service.d || true tee /lib/systemd/system/docker.service.d/socks5-proxy.conf <<-EOF [Service] -Environment="ALL_PROXY=socks5://192.168.1.21:1083" +Environment="ALL_PROXY=socks5://${PROXY_ADDRESS}" EOF fi From 3f0a3a8010c88d95ea44745ad09dc1daebf174ed Mon Sep 17 00:00:00 2001 From: mritd Date: Mon, 8 Jan 2018 12:50:46 +0800 Subject: [PATCH 113/190] =?UTF-8?q?:sparkles:=20feat(git=20init):=20?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=20git=20init=20=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 增加 git init 脚本 Signed-off-by: mritd --- git_init.sh | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100755 git_init.sh diff --git a/git_init.sh b/git_init.sh new file mode 100755 index 0000000..e321b75 --- /dev/null +++ b/git_init.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +git config --global user.name mritd +git config --global user.email mritd1234@gimail.com +git config --global core.editor vim +bash -c "$(curl -fsSL https://raw.githubusercontent.com/tonydeng/git-toolkit/master/installer.sh)" From 649f1f4b3c6cf13ff5bdb7c8c7abecd72b2045db Mon Sep 17 00:00:00 2001 From: mritd Date: Mon, 8 Jan 2018 12:51:36 +0800 Subject: [PATCH 114/190] =?UTF-8?q?:sparkles:=20feat(git=20init):=20?= =?UTF-8?q?=E8=B0=83=E6=95=B4=20push=20=E6=A8=A1=E5=BC=8F=E4=B8=BA=20simpl?= =?UTF-8?q?e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 调整 push 模式为 simple Signed-off-by: mritd --- git_init.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/git_init.sh b/git_init.sh index e321b75..979ee2f 100755 --- a/git_init.sh +++ b/git_init.sh @@ -3,4 +3,5 @@ git config --global user.name mritd git config --global user.email mritd1234@gimail.com git config --global core.editor vim +git config --global push.default simple bash -c "$(curl -fsSL https://raw.githubusercontent.com/tonydeng/git-toolkit/master/installer.sh)" From deea5d2db86937960314f5948aa4c96391317c68 Mon Sep 17 00:00:00 2001 From: mritd Date: Mon, 8 Jan 2018 13:03:06 +0800 Subject: [PATCH 115/190] =?UTF-8?q?:sparkles:=20feat(git=20proxy):=20?= =?UTF-8?q?=E8=B0=83=E6=95=B4=20git=20=E4=BB=A3=E7=90=86=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 调整 git 代理脚本 Signed-off-by: mritd --- install_sshproxy.sh => git_proxy.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) rename install_sshproxy.sh => git_proxy.sh (60%) diff --git a/install_sshproxy.sh b/git_proxy.sh similarity index 60% rename from install_sshproxy.sh rename to git_proxy.sh index 19f7459..2b83c65 100755 --- a/install_sshproxy.sh +++ b/git_proxy.sh @@ -3,14 +3,14 @@ tee /usr/local/bin/proxy-wrapper < Date: Fri, 12 Jan 2018 11:12:37 +0800 Subject: [PATCH 116/190] =?UTF-8?q?:sparkles:=20feat(images):=20=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E5=8D=95=E9=95=9C=E5=83=8F=E5=AF=BC=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 增加单镜像导出 Signed-off-by: mritd --- export_docker_images.sh | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/export_docker_images.sh b/export_docker_images.sh index 019691c..2a2e3db 100755 --- a/export_docker_images.sh +++ b/export_docker_images.sh @@ -1,2 +1,14 @@ #!/bin/bash -for imageName in `docker images | grep -v "REPOSITORY" | awk '{print $1":"$2}'`;do docker save $imageName > `echo $imageName | tr '/' '_' | tr ':' '_'`.tar ; done + +set -e + +if [ "$1" == "" ]; then + echo -e "\033[31mError: imageName is blank!\033[0m" + exit 1 +elif [ "$1" == "all" ]; then + for imageName in `docker images | grep -v "REPOSITORY" | awk '{print $1":"$2}'`; do + docker save $imageName > `echo $imageName | tr '/' '_' | tr ':' '_'`.tar + done +else + docker save $1 > `echo $1 | tr '/' '_' | tr ':' '_'`.tar +fi From 4c71c48a269997ab05792f0962aa9cb7e405cef9 Mon Sep 17 00:00:00 2001 From: mritd Date: Sun, 14 Jan 2018 08:31:42 +0800 Subject: [PATCH 117/190] =?UTF-8?q?:sparkles:=20feat(dnsmasq):=20=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=20dnsmasq=20=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 增加 dnsmasq 脚本 Signed-off-by: mritd --- dns_config.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100755 dns_config.sh diff --git a/dns_config.sh b/dns_config.sh new file mode 100755 index 0000000..5115265 --- /dev/null +++ b/dns_config.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +SERVER_IP=$1 + +if [ "${SERVER_IP}" == "" ]; then + echo -e "\033[31mError: SERVER_IP is blank!\033[0m" + exit 1 +fi + +sed -i 's@#resolv-file.*@resolv-file=/etc/resolv.dnsmasq.conf@gi' /etc/dnsmasq.conf +sed -i 's@#no-hosts@no-hosts@gi' /etc/dnsmasq.conf +sed -i "s@#listen-address.*@listen-address=127.0.0.1,$1@gi" /etc/dnsmasq.conf +sed -i 's@#addn-hosts.*@addn-hosts=/etc/dnsmasq.hosts@gi' /etc/dnsmasq.conf + +touch /etc/dnsmasq.hosts +echo 'nameserver 114.114.114.114' >> /etc/resolv.dnsmasq.conf From 020cc9396d828235eaa0213235d75d6a6946bfbf Mon Sep 17 00:00:00 2001 From: mritd Date: Wed, 17 Jan 2018 12:35:54 +0800 Subject: [PATCH 118/190] Update color.sh --- color.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/color.sh b/color.sh index c3fbabe..0a077f6 100755 --- a/color.sh +++ b/color.sh @@ -3,7 +3,7 @@ echo -e "\033[30m 黑色字 \033[0m" echo -e "\033[31m 红色字 \033[0m" echo -e "\033[32m 绿色字 \033[0m" -echo -e "\033[33m ***字 \033[0m" +echo -e "\033[33m 黄色字 \033[0m" echo -e "\033[34m 蓝色字 \033[0m" echo -e "\033[35m 紫色字 \033[0m" echo -e "\033[36m 天蓝字 \033[0m" From d3743774537b35c48807c6732ec563008d578427 Mon Sep 17 00:00:00 2001 From: mritd Date: Wed, 17 Jan 2018 13:37:36 +0800 Subject: [PATCH 119/190] =?UTF-8?q?:sparkles:=20feat(kubectl=20config):=20?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 增加配置文件名 Signed-off-by: mritd --- generate_kubectl_config.sh | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/generate_kubectl_config.sh b/generate_kubectl_config.sh index 5eb0e33..f266189 100755 --- a/generate_kubectl_config.sh +++ b/generate_kubectl_config.sh @@ -1,15 +1,21 @@ #!/bin/bash KUBE_API_SERVER=$1 -CERT_DIR=${CERT_DIR-"."} +CERT_DIR=${2:-"/etc/kubernetes/ssl"} kubectl config set-cluster default-cluster --server=${KUBE_API_SERVER} \ - --certificate-authority=${CERT_DIR}/k8s-root-ca.pem + --certificate-authority=${CERT_DIR}/k8s-root-ca.pem \ + --kubeconfig=admin.kubeconfig kubectl config set-credentials default-admin \ --certificate-authority=${CERT_DIR}/k8s-root-ca.pem \ + --embed-certs=true \ --client-key=${CERT_DIR}/admin-key.pem \ - --client-certificate=${CERT_DIR}/admin.pem + --client-certificate=${CERT_DIR}/admin.pem \ + --kubeconfig=admin.kubeconfig + +kubectl config set-context default-system --cluster=default-cluster \ + --user=default-admin \ + --kubeconfig=admin.kubeconfig -kubectl config set-context default-system --cluster=default-cluster --user=default-admin -kubectl config use-context default-system +kubectl config use-context default-system --kubeconfig=admin.kubeconfig From 09cdfdddfc26e8b4bc2fffd7a880238b7a5559d4 Mon Sep 17 00:00:00 2001 From: mritd Date: Wed, 17 Jan 2018 13:42:34 +0800 Subject: [PATCH 120/190] =?UTF-8?q?:bug:fix(kubectl=20config):=20=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=20apiserver=20=E8=AF=81=E4=B9=A6=E6=9C=AA=E5=86=99?= =?UTF-8?q?=E5=85=A5=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复 apiserver 证书未写入问题 Signed-off-by: mritd --- generate_kubectl_config.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/generate_kubectl_config.sh b/generate_kubectl_config.sh index f266189..27a8dd6 100755 --- a/generate_kubectl_config.sh +++ b/generate_kubectl_config.sh @@ -5,6 +5,7 @@ CERT_DIR=${2:-"/etc/kubernetes/ssl"} kubectl config set-cluster default-cluster --server=${KUBE_API_SERVER} \ --certificate-authority=${CERT_DIR}/k8s-root-ca.pem \ + --embed-certs=true \ --kubeconfig=admin.kubeconfig kubectl config set-credentials default-admin \ From 6826c70ea76ea3dccbcac4910d1d145758aa103d Mon Sep 17 00:00:00 2001 From: mritd Date: Fri, 26 Jan 2018 17:50:26 +0800 Subject: [PATCH 121/190] :sparkles: feat(init ubuntu): add init ubuntu add init ubuntu Signed-off-by: mritd --- init_ubuntu.sh | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100755 init_ubuntu.sh diff --git a/init_ubuntu.sh b/init_ubuntu.sh new file mode 100755 index 0000000..2e7743a --- /dev/null +++ b/init_ubuntu.sh @@ -0,0 +1,58 @@ +#!/bin/bash + +set -e + +function sysupdate(){ + apt update -y + apt upgrade -y + apt install wget curl vim zsh ctags git htop -y +} + +function setlocale(){ + locale-gen --purge en_US.UTF-8 zh_CN.UTF-8 + echo -e 'LANG="en_US.UTF-8"\nLANGUAGE="en_US:en"\n' > /etc/default/locale +} + +function install_ohmyzsh(){ + git clone --depth=1 https://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh + wget https://mritdftp.b0.upaiyun.com/files/config/ohmyzsh.tar.gz + tar -zxvf ohmyzsh.tar.gz -C ~ && rm -f ohmyzsh.tar.gz + chsh -s $(grep /zsh$ /etc/shells | tail -1) +} + +function config_vim(){ + wget https://mritdftp.b0.upaiyun.com/files/config/vim.tar.gz + tar -zxvf vim.tar.gz -C ~ && rm -f vim.tar.gz +} + +function install_docker(){ + apt install apt-transport-https ca-certificates curl software-properties-common -y + curl -fsSL http://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | apt-key add - + echo "deb [arch=amd64] https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/ubuntu $(lsb_release -cs) stable" > /etc/apt/sources.list.d/docker.list + apt update -y + apt install docker-ce -y + mv /etc/apt/sources.list.d/docker.list /etc/apt/sources.list.d/docker.list.bak + mv /lib/systemd/system/docker.service /lib/systemd/system/docker.service.bak + wget https://mritdftp.b0.upaiyun.com/files/config/docker.tar.gz + tar -zxvf docker.tar.gz -C /lib/systemd/system && rm -f docker.tar.gz + systemctl daemon-reload + systemctl restart docker +} + +function install_ctop(){ + wget https://mritdftp.b0.upaiyun.com/files/ctop/ctop-0.7-linux-amd64 -O /usr/local/bin/ctop + chmod +x /usr/local/bin/ctop +} + +function install_dc(){ + curl -L https://get.daocloud.io/docker/compose/releases/download/1.18.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose + chmod +x /usr/local/bin/docker-compose +} + +sysupdate +setlocale +config_vim +install_ohmyzsh +install_docker +install_ctop +install_dc From 511702db6abb7c449d84854fbfa7d815ca31093e Mon Sep 17 00:00:00 2001 From: mritd Date: Tue, 30 Jan 2018 11:07:12 +0800 Subject: [PATCH 122/190] =?UTF-8?q?:sparkles:=20feat(acme):=20=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E8=87=AA=E5=8A=A8=E5=AE=89=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 删除自动安装 Signed-off-by: mritd --- acme_godaddy.sh | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/acme_godaddy.sh b/acme_godaddy.sh index 4dd85d1..2894d15 100755 --- a/acme_godaddy.sh +++ b/acme_godaddy.sh @@ -24,20 +24,6 @@ if [ "$GD_Secret" == "" ];then exit 1 fi -echo -e "\033[32mSystem updateing.......\033[0m" -yum update -y - -echo -e "\033[32mInstall nc and crontabs......\033[0m" -yum install -y nc crontabs - -if [ ! "$?" == "0" ];then - echo -e "\033[31mInstall nc or crontabs failed, System exiting!\033[0m" - exit 1 -fi - -echo -e "\033[32mInstall acme.sh.......\033[0m" -curl https://get.acme.sh | bash - echo -e "\033[32mCreate SSL CRT.......\033[0m" ~/.acme.sh/acme.sh --issue --force --dns dns_gd $Domains From cdb5c554137ebef36751a9521d9d8419a20eadbe Mon Sep 17 00:00:00 2001 From: mritd Date: Sun, 4 Feb 2018 23:59:23 +0800 Subject: [PATCH 123/190] :bug:fix(git init): fix email fix email Signed-off-by: mritd --- git_init.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git_init.sh b/git_init.sh index 979ee2f..85443f7 100755 --- a/git_init.sh +++ b/git_init.sh @@ -1,7 +1,7 @@ #!/bin/bash git config --global user.name mritd -git config --global user.email mritd1234@gimail.com +git config --global user.email mritd1234@gmail.com git config --global core.editor vim git config --global push.default simple bash -c "$(curl -fsSL https://raw.githubusercontent.com/tonydeng/git-toolkit/master/installer.sh)" From 2dbdc093f45764fbb753561c89db3e8b128c6338 Mon Sep 17 00:00:00 2001 From: mritd Date: Thu, 8 Mar 2018 20:00:41 +0800 Subject: [PATCH 124/190] =?UTF-8?q?:sparkles:=20feat(git=20init):=20?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=85=A8=E5=B1=80=20git=20=E6=8E=92=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 添加全局 git 排除 Signed-off-by: mritd --- git_init.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/git_init.sh b/git_init.sh index 85443f7..52e01ea 100755 --- a/git_init.sh +++ b/git_init.sh @@ -4,4 +4,6 @@ git config --global user.name mritd git config --global user.email mritd1234@gmail.com git config --global core.editor vim git config --global push.default simple +git config --global core.excludesfile ~/.global_gitignore +echo ".idea" >> ~/.global_gitignore bash -c "$(curl -fsSL https://raw.githubusercontent.com/tonydeng/git-toolkit/master/installer.sh)" From a5a89686583393c0e80e6725513f0f86686a9ff4 Mon Sep 17 00:00:00 2001 From: mritd Date: Wed, 14 Mar 2018 19:33:54 +0900 Subject: [PATCH 125/190] =?UTF-8?q?:sparkles:=20feat(acme):=20=E6=9B=B4?= =?UTF-8?q?=E6=96=B0acme=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 更新 acme 脚本增加对泛域名支持 Signed-off-by: mritd --- acme_godaddy.sh | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/acme_godaddy.sh b/acme_godaddy.sh index 4dd85d1..2894d15 100755 --- a/acme_godaddy.sh +++ b/acme_godaddy.sh @@ -24,20 +24,6 @@ if [ "$GD_Secret" == "" ];then exit 1 fi -echo -e "\033[32mSystem updateing.......\033[0m" -yum update -y - -echo -e "\033[32mInstall nc and crontabs......\033[0m" -yum install -y nc crontabs - -if [ ! "$?" == "0" ];then - echo -e "\033[31mInstall nc or crontabs failed, System exiting!\033[0m" - exit 1 -fi - -echo -e "\033[32mInstall acme.sh.......\033[0m" -curl https://get.acme.sh | bash - echo -e "\033[32mCreate SSL CRT.......\033[0m" ~/.acme.sh/acme.sh --issue --force --dns dns_gd $Domains From f9e3508c241ec837cb4b7960fa1739fd89fa2aa2 Mon Sep 17 00:00:00 2001 From: mritd Date: Thu, 22 Mar 2018 11:47:19 +0800 Subject: [PATCH 126/190] feat(git gpg): add gpg support add gpg support Signed-off-by: mritd --- git_init.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/git_init.sh b/git_init.sh index 52e01ea..b037248 100755 --- a/git_init.sh +++ b/git_init.sh @@ -5,5 +5,8 @@ git config --global user.email mritd1234@gmail.com git config --global core.editor vim git config --global push.default simple git config --global core.excludesfile ~/.global_gitignore +git config --global user.signingkey 1C78FD62CEA2C04B79EA459F7CB6F1DA9030B819 +git config --global commit.gpgsign true +git config --global gpg.program gpg +git config --global core.quotepath false echo ".idea" >> ~/.global_gitignore -bash -c "$(curl -fsSL https://raw.githubusercontent.com/tonydeng/git-toolkit/master/installer.sh)" From a419d052c0ca1d628500ac179c1d835127b4e2f9 Mon Sep 17 00:00:00 2001 From: mritd Date: Mon, 16 Apr 2018 22:19:40 +0800 Subject: [PATCH 127/190] feat(init_ubuntu): add tz set add tz set Signed-off-by: mritd --- init_ubuntu.sh | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/init_ubuntu.sh b/init_ubuntu.sh index 2e7743a..fa538d3 100755 --- a/init_ubuntu.sh +++ b/init_ubuntu.sh @@ -2,55 +2,72 @@ set -e +TZ='Asia/Shanghai' +OZ_DOWNLOAD_URL='https://github.com/robbyrussell/oh-my-zsh.git' +OZ_CONFIG_DOWNLOAD_URL='https://mritdftp.b0.upaiyun.com/files/config/ohmyzsh.tar.gz' +VIM_CONFIG_DOWNLOAD_URL='https://mritdftp.b0.upaiyun.com/files/config/vim.tar.gz' +DOCKER_DEB="deb [arch=amd64] https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/ubuntu $(lsb_release -cs) stable" +DOCKER_CONFIG_DOWNLOAD_URL='https://mritdftp.b0.upaiyun.com/files/config/docker.tar.gz' +CTOP_DOWNLOAD_URL='https://mritdftp.b0.upaiyun.com/files/ctop/ctop-0.7.1-linux-amd64' +DOCKER_COMPOSE_DOWNLOAD_URL="https://get.daocloud.io/docker/compose/releases/download/1.21.0/docker-compose-`uname -s`-`uname -m`" + + function sysupdate(){ apt update -y apt upgrade -y - apt install wget curl vim zsh ctags git htop -y + apt install wget curl vim zsh ctags git htop tzdata -y } function setlocale(){ locale-gen --purge en_US.UTF-8 zh_CN.UTF-8 - echo -e 'LANG="en_US.UTF-8"\nLANGUAGE="en_US:en"\n' > /etc/default/locale + echo -e 'LANG="en_US.UTF-8"' > /etc/default/locale + echo -e 'LANGUAGE="en_US:en"' >> /etc/default/locale +} + +function settimezone(){ + ln -sf /usr/share/zoneinfo/${TZ} /etc/localtime + echo ${TZ} > /etc/timezone } function install_ohmyzsh(){ - git clone --depth=1 https://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh - wget https://mritdftp.b0.upaiyun.com/files/config/ohmyzsh.tar.gz + git clone --depth=1 ${OZ_DOWNLOAD_URL} ~/.oh-my-zsh + wget ${OZ_CONFIG_DOWNLOAD_URL} tar -zxvf ohmyzsh.tar.gz -C ~ && rm -f ohmyzsh.tar.gz chsh -s $(grep /zsh$ /etc/shells | tail -1) } function config_vim(){ - wget https://mritdftp.b0.upaiyun.com/files/config/vim.tar.gz + wget ${VIM_CONFIG_DOWNLOAD_URL} tar -zxvf vim.tar.gz -C ~ && rm -f vim.tar.gz } function install_docker(){ apt install apt-transport-https ca-certificates curl software-properties-common -y curl -fsSL http://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | apt-key add - - echo "deb [arch=amd64] https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/ubuntu $(lsb_release -cs) stable" > /etc/apt/sources.list.d/docker.list + echo ${DOCKER_DEB} > /etc/apt/sources.list.d/docker.list apt update -y apt install docker-ce -y mv /etc/apt/sources.list.d/docker.list /etc/apt/sources.list.d/docker.list.bak mv /lib/systemd/system/docker.service /lib/systemd/system/docker.service.bak - wget https://mritdftp.b0.upaiyun.com/files/config/docker.tar.gz + wget ${DOCKER_CONFIG_DOWNLOAD_URL} tar -zxvf docker.tar.gz -C /lib/systemd/system && rm -f docker.tar.gz systemctl daemon-reload systemctl restart docker } function install_ctop(){ - wget https://mritdftp.b0.upaiyun.com/files/ctop/ctop-0.7-linux-amd64 -O /usr/local/bin/ctop + wget ${CTOP_DOWNLOAD_URL} -O /usr/local/bin/ctop chmod +x /usr/local/bin/ctop } function install_dc(){ - curl -L https://get.daocloud.io/docker/compose/releases/download/1.18.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose + curl -L ${DOCKER_COMPOSE_DOWNLOAD_URL} > /usr/local/bin/docker-compose chmod +x /usr/local/bin/docker-compose } sysupdate setlocale +settimezone config_vim install_ohmyzsh install_docker From bb9e90f8bfb23de1fd2f5ed904736ae24df2d9c6 Mon Sep 17 00:00:00 2001 From: mritd Date: Thu, 26 Apr 2018 16:52:21 +0800 Subject: [PATCH 128/190] =?UTF-8?q?fix(imagePullSecret):=20=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=20imagePullSecret=20=E8=84=9A=E6=9C=AC=E9=94=99?= =?UTF-8?q?=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复 imagePullSecret 脚本错误 Signed-off-by: mritd --- create_imagePullSecret.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/create_imagePullSecret.sh b/create_imagePullSecret.sh index 752c9d7..d4a70e1 100755 --- a/create_imagePullSecret.sh +++ b/create_imagePullSecret.sh @@ -3,7 +3,7 @@ set -e REGISTRY_TOKEN=`sudo cat ~/.docker/config.json | base64 | tr -d '\n'` -REGISTRY_ADDRESS=${REGISTRY_ADDRESS-:"reg.mritd.me"} +REGISTRY_ADDRESS=${REGISTRY_ADDRESS:-"reg.mritd.me"} NAMESPACE=${NAMESPACE:-"default"} if [ "" == "${REGISTRY_ADDRESS}" ]; then From 468b7f87fe71840c485a591d65e198bf8c6d1e74 Mon Sep 17 00:00:00 2001 From: mritd Date: Thu, 3 May 2018 18:55:08 +0800 Subject: [PATCH 129/190] fix(ubuntu init): remove echo -e option remove echo -e option Signed-off-by: mritd --- init_ubuntu.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/init_ubuntu.sh b/init_ubuntu.sh index fa538d3..b4d5833 100755 --- a/init_ubuntu.sh +++ b/init_ubuntu.sh @@ -20,8 +20,8 @@ function sysupdate(){ function setlocale(){ locale-gen --purge en_US.UTF-8 zh_CN.UTF-8 - echo -e 'LANG="en_US.UTF-8"' > /etc/default/locale - echo -e 'LANGUAGE="en_US:en"' >> /etc/default/locale + echo 'LANG="en_US.UTF-8"' > /etc/default/locale + echo 'LANGUAGE="en_US:en"' >> /etc/default/locale } function settimezone(){ From a3d57d098db6ccafb49f0564e3fa4f10f33e828f Mon Sep 17 00:00:00 2001 From: mritd Date: Thu, 3 May 2018 18:58:12 +0800 Subject: [PATCH 130/190] fix(init ubuntu): check ohmyzsh check ohmyzsh Signed-off-by: mritd --- init_ubuntu.sh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/init_ubuntu.sh b/init_ubuntu.sh index b4d5833..6d4b9d9 100755 --- a/init_ubuntu.sh +++ b/init_ubuntu.sh @@ -30,13 +30,16 @@ function settimezone(){ } function install_ohmyzsh(){ - git clone --depth=1 ${OZ_DOWNLOAD_URL} ~/.oh-my-zsh - wget ${OZ_CONFIG_DOWNLOAD_URL} - tar -zxvf ohmyzsh.tar.gz -C ~ && rm -f ohmyzsh.tar.gz - chsh -s $(grep /zsh$ /etc/shells | tail -1) + if [ ! -d "~/.oh-my-zsh" ]; then + git clone --depth=1 ${OZ_DOWNLOAD_URL} ~/.oh-my-zsh + wget ${OZ_CONFIG_DOWNLOAD_URL} + tar -zxvf ohmyzsh.tar.gz -C ~ && rm -f ohmyzsh.tar.gz + chsh -s $(grep /zsh$ /etc/shells | tail -1) + fi } function config_vim(){ + rm -rf ~/.vim ~/.vimrc wget ${VIM_CONFIG_DOWNLOAD_URL} tar -zxvf vim.tar.gz -C ~ && rm -f vim.tar.gz } From e081ce05d680ab0fda8d2b8b555892b5dd57f344 Mon Sep 17 00:00:00 2001 From: mritd Date: Thu, 3 May 2018 19:22:54 +0800 Subject: [PATCH 131/190] fix(ubuntu init): fix install docker filed on ubuntu 18 fix install docker filed on ubuntu 18 Signed-off-by: mritd --- init_ubuntu.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/init_ubuntu.sh b/init_ubuntu.sh index 6d4b9d9..c542ada 100755 --- a/init_ubuntu.sh +++ b/init_ubuntu.sh @@ -11,6 +11,10 @@ DOCKER_CONFIG_DOWNLOAD_URL='https://mritdftp.b0.upaiyun.com/files/config/docker. CTOP_DOWNLOAD_URL='https://mritdftp.b0.upaiyun.com/files/ctop/ctop-0.7.1-linux-amd64' DOCKER_COMPOSE_DOWNLOAD_URL="https://get.daocloud.io/docker/compose/releases/download/1.21.0/docker-compose-`uname -s`-`uname -m`" +if [ "$(lsb_release -cs)" == "bionic" ]; then + DOCKER_DEB="deb [arch=amd64] https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/ubuntu artful stable" +fi + function sysupdate(){ apt update -y From 0247953e71d69a997f51b98556ac49df2c819cd9 Mon Sep 17 00:00:00 2001 From: mritd Date: Thu, 3 May 2018 19:24:14 +0800 Subject: [PATCH 132/190] feat(ubuntu init): check vim check vim Signed-off-by: mritd --- init_ubuntu.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/init_ubuntu.sh b/init_ubuntu.sh index c542ada..f95ebfd 100755 --- a/init_ubuntu.sh +++ b/init_ubuntu.sh @@ -34,7 +34,7 @@ function settimezone(){ } function install_ohmyzsh(){ - if [ ! -d "~/.oh-my-zsh" ]; then + if [ ! -d ~/.oh-my-zsh ]; then git clone --depth=1 ${OZ_DOWNLOAD_URL} ~/.oh-my-zsh wget ${OZ_CONFIG_DOWNLOAD_URL} tar -zxvf ohmyzsh.tar.gz -C ~ && rm -f ohmyzsh.tar.gz @@ -43,9 +43,10 @@ function install_ohmyzsh(){ } function config_vim(){ - rm -rf ~/.vim ~/.vimrc - wget ${VIM_CONFIG_DOWNLOAD_URL} - tar -zxvf vim.tar.gz -C ~ && rm -f vim.tar.gz + if [ ! -d ~/.vim ]; then + wget ${VIM_CONFIG_DOWNLOAD_URL} + tar -zxvf vim.tar.gz -C ~ && rm -f vim.tar.gz + fi } function install_docker(){ From f9d07f5dc99d26395262f7ae08a24926ce10028c Mon Sep 17 00:00:00 2001 From: mritd Date: Tue, 8 May 2018 11:58:47 +0800 Subject: [PATCH 133/190] feat(consul): add consul script add consul script Signed-off-by: mritd --- consul.sh | 104 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100755 consul.sh diff --git a/consul.sh b/consul.sh new file mode 100755 index 0000000..fda75fc --- /dev/null +++ b/consul.sh @@ -0,0 +1,104 @@ +#!/bin/bash + +set -e + +CONSUL_VERSION="1.0.7" +CONSUL_DONWLOAD_URL="https://releases.hashicorp.com/consul/${CONSUL_VERSION}/consul_${CONSUL_VERSION}_linux_amd64.zip" + +preinstall(){ + if ! command -v unzip >/dev/null 2>&1; then + echo -e "\033[31mError: unzip not found!\033[0m" + exit 1 + fi + + getent group consul >/dev/null || groupadd -r consul + getent passwd consul >/dev/null || useradd -r -g consul -d /var/lib/consul -s /sbin/nologin -c "consul user" consul + if [ ! -d /var/lib/consul ]; then + mkdir /var/lib/consul + chown -R consul:consul /var/lib/consul + chmod -R 0755 /var/lib/consul + fi + if [ ! -d /etc/consul ]; then + mkdir /etc/consul + fi +} + +postinstall(){ + # Initial installation + systemctl --no-reload preset consul.service >/dev/null 2>&1 || : + systemctl enable consul + rm -f consul_${CONSUL_VERSION}_linux_amd64.zip +} + +preuninstall(){ + # Package removal, not upgrade + systemctl --no-reload disable --now consul.service > /dev/null 2>&1 || : +} + +install(){ + wget ${CONSUL_DONWLOAD_URL} + unzip consul_${CONSUL_VERSION}_linux_amd64.zip -d /usr/local/bin + chmod +x /usr/local/bin/consul + cat > /etc/consul/consul.json </lib/systemd/system/consul.service < Date: Tue, 8 May 2018 19:06:17 +0800 Subject: [PATCH 134/190] feat(consul): update consul config update consul config Signed-off-by: mritd --- consul.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/consul.sh b/consul.sh index fda75fc..6637990 100755 --- a/consul.sh +++ b/consul.sh @@ -43,6 +43,7 @@ install(){ { "datacenter": "dc1", "data_dir": "/var/lib/consul", + "disable_update_check": true, "log_level": "INFO", "node_name": "consul1", "server": true, From 599778d89f21d4315b1da1afb3ffd8a2cc7d08de Mon Sep 17 00:00:00 2001 From: mritd Date: Tue, 8 May 2018 19:21:52 +0800 Subject: [PATCH 135/190] feat(fabio): add fabio bash script add fabio bash script Signed-off-by: mritd --- fabio.sh | 939 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 939 insertions(+) create mode 100755 fabio.sh diff --git a/fabio.sh b/fabio.sh new file mode 100755 index 0000000..447756b --- /dev/null +++ b/fabio.sh @@ -0,0 +1,939 @@ +#!/bin/bash + +set -e + +FABIO_VERSION="1.5.8" +FABIO_DONWLOAD_URL="https://github.com/fabiolb/fabio/releases/download/v${FABIO_VERSION}/fabio-${FABIO_VERSION}-go1.10-linux_amd64" + +preinstall(){ + getent group fabio >/dev/null || groupadd -r fabio + getent passwd fabio >/dev/null || useradd -r -g fabio -d /var/lib/fabio -s /sbin/nologin -c "fabio user" fabio +} + +postinstall(){ + # Initial installation + systemctl --no-reload preset fabio.service >/dev/null 2>&1 || : + systemctl enable fabio + if [ ! -d /etc/fabio ]; then + mkdir /etc/fabio + fi +} + +preuninstall(){ + # Package removal, not upgrade + systemctl --no-reload disable --now fabio.service > /dev/null 2>&1 || : +} + +install(){ + wget ${FABIO_DONWLOAD_URL} -O /usr/local/bin/fabio + chmod +x /usr/local/bin/fabio + cat > /etc/fabio/fabio.properties <;type=;opt=arg;opt[=arg];... +# +# All certificates need to be provided in PEM format. +# +# The following types of certificate sources are available: +# +# File +# +# The file certificate source supports one certificate which is loaded at +# startup and is cached until the service exits. +# +# The 'cert' option contains the path to the certificate file. The 'key' +# option contains the path to the private key file. If the certificate file +# contains both the certificate and the private key the 'key' option can be +# omitted. The 'clientca' option contains the path to one or more client +# authentication certificates. +# +# cs=;type=file;cert=p/a-cert.pem;key=p/a-key.pem;clientca=p/clientAuth.pem +# +# Path +# +# The path certificate source loads certificates from a directory in +# alphabetical order and refreshes them periodically. +# +# The 'cert' option provides the path to the TLS certificates and the +# 'clientca' option provides the path to the certificates for client +# authentication. +# +# TLS certificates are stored either in one or two files: +# +# www.example.com.pem or www.example.com-{cert,key}.pem +# +# TLS certificates are loaded in alphabetical order and the first certificate +# is the default for clients which do not support SNI. +# +# The 'refresh' option can be set to specify the refresh interval for the TLS +# certificates. Client authentication certificates cannot be refreshed since +# Go does not provide a mechanism for that yet. +# +# The default refresh interval is 3 seconds and cannot be lower than 1 second +# to prevent busy loops. To load the certificates only once and disable +# automatic refreshing set 'refresh' to zero. +# +# cs=;type=path;cert=path/to/certs;clientca=path/to/clientcas;refresh=3s +# +# HTTP +# +# The http certificate source loads certificates from an HTTP/HTTPS server. +# +# The 'cert' option provides a URL to a text file which contains all files +# that should be loaded from this directory. The filenames follow the same +# rules as for the path source. The text file can be generated with: +# +# ls -1 *.pem > list +# +# The 'clientca' option provides a URL for the client authentication +# certificates analogous to the 'cert' option. +# +# Authentication credentials can be provided in the URL as request parameter, +# as basic authentication parameters or through a header. +# +# The 'refresh' option can be set to specify the refresh interval for the TLS +# certificates. Client authentication certificates cannot be refreshed since +# Go does not provide a mechanism for that yet. +# +# The default refresh interval is 3 seconds and cannot be lower than 1 second +# to prevent busy loops. To load the certificates only once and disable +# automatic refreshing set 'refresh' to zero. +# +# cs=;type=http;cert=https://host.com/path/to/cert/list&token=123 +# cs=;type=http;cert=https://user:pass@host.com/path/to/cert/list +# cs=;type=http;cert=https://host.com/path/to/cert/list;hdr=Authorization: Bearer 1234 +# +# Consul +# +# The consul certificate source loads certificates from consul. +# +# The 'cert' option provides a KV store URL where the the TLS certificates are +# stored. +# +# The 'clientca' option provides a URL to a path in the KV store where the the +# client authentication certificates are stored. +# +# The filenames follow the same rules as for the path source. +# +# The TLS certificates are updated automatically whenever the KV store +# changes. The client authentication certificates cannot be updated +# automatically since Go does not provide a mechanism for that yet. +# +# cs=;type=consul;cert=http://localhost:8500/v1/kv/path/to/cert&token=123 +# +# Vault +# +# The Vault certificate store uses HashiCorp Vault as the certificate +# store. +# +# The 'cert' option provides the path to the TLS certificates and the +# 'clientca' option provides the path to the certificates for client +# authentication. +# +# The 'refresh' option can be set to specify the refresh interval for the TLS +# certificates. Client authentication certificates cannot be refreshed since +# Go does not provide a mechanism for that yet. +# +# The default refresh interval is 3 seconds and cannot be lower than 1 second +# to prevent busy loops. To load the certificates only once and disable +# automatic refreshing set 'refresh' to zero. +# +# The path to vault must be provided in the VAULT_ADDR environment +# variable. The token must be provided in the VAULT_TOKEN environment +# variable. +# +# cs=;type=vault;cert=secret/fabio/certs +# +# +# Common options +# +# All certificate stores support the following options: +# +# caupgcn: Upgrade a self-signed client auth certificate with this common-name +# to a CA certificate. Typically used for self-singed certificates +# for the Amazon AWS Api Gateway certificates which do not have the +# CA flag set which makes them unsuitable for client certificate +# authentication in Go. For the AWS Api Gateway set this value +# to 'ApiGateway' to allow client certificate authentication. +# This replaces the deprecated parameter 'aws.apigw.cert.cn' +# which was introduced in version 1.1.5. +# +# Examples: +# +# # file based certificate source +# proxy.cs = cs=some-name;type=file;cert=p/a-cert.pem;key=p/a-key.pem +# +# # path based certificate source +# proxy.cs = cs=some-name;type=path;path=path/to/certs +# +# # HTTP certificate source +# proxy.cs = cs=some-name;type=http;cert=https://user:pass@host:port/path/to/certs +# +# # Consul certificate source +# proxy.cs = cs=some-name;type=consul;cert=https://host:port/v1/kv/path/to/certs?token=abc123 +# +# # Vault certificate source +# proxy.cs = cs=some-name;type=vault;cert=secret/fabio/certs +# +# # Multiple certificate sources +# proxy.cs = cs=srcA;type=path;path=path/to/certs,\ +# cs=srcB;type=http;cert=https://user:pass@host:port/path/to/certs +# +# # path based certificate source for AWS Api Gateway +# proxy.cs = cs=some-name;type=path;path=path/to/certs;clientca=path/to/clientcas;caupgcn=ApiGateway +# +# The default is +# +# proxy.cs = + + +# proxy.addr configures listeners. +# +# Each listener is configured with and address and a +# list of optional arguments in the form of +# +# [host]:port;opt=arg;opt[=arg];... +# +# Each listener has a protocol which is configured +# with the 'proto' option for which it routes and +# forwards traffic. +# +# The supported protocols are: +# +# * http for HTTP based protocols +# * https for HTTPS based protocols +# * tcp for a raw TCP proxy with or witout TLS support +# * tcp+sni for an SNI aware TCP proxy +# +# If no 'proto' option is specified then the protocol +# is either 'http' or 'https' depending on whether a +# certificate source is configured via the 'cs' option +# which contains the name of the certificate source. +# +# The TCP+SNI proxy analyzes the ClientHello message +# of TLS connections to extract the server name +# extension and then forwards the encrypted traffic +# to the destination without decrypting the traffic. +# +# General options: +# +# rt: Sets the read timeout as a duration value (e.g. '3s') +# +# wt: Sets the write timeout as a duration value (e.g. '3s') +# +# strictmatch: When set to 'true' the certificate source must provide +# a certificate that matches the hostname for the connection +# to be established. Otherwise, the first certificate is used +# if no matching certificate was found. This matches the default +# behavior of the Go TLS server implementation. +# +# TLS options: +# +# tlsmin: Sets the minimum TLS version for the handshake. This value +# is one of [ssl30, tls10, tls11, tls12] or the corresponding +# version number from https://golang.org/pkg/crypto/tls/#pkg-constants +# +# tlsmax: Sets the maximum TLS version for the handshake. See 'tlsmin' +# for the format. +# +# tlsciphers: Sets the list of allowed ciphers for the handshake. The value +# is a quoted comma-separated list of the hex cipher values or +# the constant names from https://golang.org/pkg/crypto/tls/#pkg-constants, +# e.g. "0xc00a,0xc02b" or "TLS_RSA_WITH_RC4_128_SHA,TLS_RSA_WITH_AES_128_CBC_SHA" +# +# Examples: +# +# # HTTP listener on port 9999 +# proxy.addr = :9999 +# +# # HTTP listener on IPv4 with read timeout +# proxy.addr = 1.2.3.4:9999;rt=3s +# +# # HTTP listener on IPv6 with write timeout +# proxy.addr = [2001:DB8::A/32]:9999;wt=5s +# +# # Multiple listeners +# proxy.addr = 1.2.3.4:9999;rt=3s,[2001:DB8::A/32]:9999;wt=5s +# +# # HTTPS listener on port 443 with certificate source +# proxy.addr = :443;cs=some-name +# +# # HTTPS listener on port 443 with certificate source and TLS options +# proxy.addr = :443;cs=some-name;tlsmin=tls10;tlsmax=tls11;tlsciphers="0xc00a,0xc02b" +# +# # TCP listener on port 1234 with port routing +# proxy.addr = :1234;proto=tcp +# +# # TCP listener on port 443 with SNI routing +# proxy.addr = :443;proto=tcp+sni +# +# The default is +# +# proxy.addr = :9999 + + +# proxy.localip configures the ip address of the proxy which is added +# to the Header configured by header.clientip and to the 'Forwarded: by=' attribute. +# +# The local non-loopback address is detected during startup +# but can be overwritten with this property. +# +# The default is +# +# proxy.localip = + + +# proxy.strategy configures the load balancing strategy. +# +# rnd: pseudo-random distribution +# rr: round-robin distribution +# +# "rnd" configures a pseudo-random distribution by using the microsecond +# fraction of the time of the request. +# +# "rr" configures a round-robin distribution. +# +# The default is +# +# proxy.strategy = rnd + + +# proxy.matcher configures the path matching algorithm. +# +# prefix: prefix matching +# glob: glob matching +# +# The default is +# +# proxy.matcher = prefix + + +# proxy.noroutestatus configures the response code when no route was found. +# +# The default is +# +# proxy.noroutestatus = 404 + + +# proxy.shutdownwait configures the time for a graceful shutdown. +# +# After a signal is caught the proxy will immediately suspend +# routing traffic and respond with a 503 Service Unavailable +# for the duration of the given period. +# +# The default is +# +# proxy.shutdownwait = 0s + + +# proxy.responseheadertimeout configures the response header timeout. +# +# This configures the ResponseHeaderTimeout of the http.Transport. +# +# The default is +# +# proxy.responseheadertimeout = 0s + + +# proxy.keepalivetimeout configures the keep-alive timeout. +# +# This configures the KeepAliveTimeout of the network dialer. +# +# The default is +# +# proxy.keepalivetimeout = 0s + + +# proxy.dialtimeout configures the connection timeout for +# outgoing connections. +# +# This configures the DialTimeout of the network dialer. +# +# The default is +# +# proxy.dialtimeout = 30s + + +# proxy.flushinterval configures periodic flushing of the +# response buffer for SSE (server-sent events) connections. +# They are detected when the 'Accept' header is +# 'text/event-stream'. +# +# The default is +# +# proxy.flushinterval = 1s + + +# proxy.maxconn configures the maximum number of cached +# incoming and outgoing connections. +# +# This configures the MaxConnsPerHost of the http.Transport. +# +# The default is +# +# proxy.maxconn = 10000 + + +# proxy.header.clientip configures the header for the request ip. +# +# The remoteIP is taken from http.Request.RemoteAddr. +# +# The default is +# +# proxy.header.clientip = + + +# proxy.header.tls configures the header to set for TLS connections. +# +# When set to a non-empty value the proxy will set this header on every +# TLS request to the value of ${proxy.header.tls.value} +# +# The default is +# +# proxy.header.tls = +# proxy.header.tls.value = + + +# proxy.header.requestid configures the header for the adding a unique request id. +# When set non-empty value the proxy will set this header on every request to the +# unique UUID value. +# +# The default is +# +# proxy.header.requestid = + + +# proxy.gzip.contenttype configures which responses should be compressed. +# +# By default, responses sent to the client are not compressed even if the +# client accepts compressed responses by setting the 'Accept-Encoding: gzip' +# header. By setting this value responses are compressed if the Content-Type +# header of the response matches and the response is not already compressed. +# The list of compressable content types is defined as a regular expression. +# The regular expression must follow the rules outlined in golang.org/pkg/regexp. +# +# A typical example is +# +# proxy.gzip.contenttype = ^(text/.*|application/(javascript|json|font-woff|xml)|.*\+(json|xml))(;.*)?$ +# +# The default is +# +# proxy.gzip.contenttype = + + +# log.access.format configures the format of the access log. +# +# If the value is either 'common' or 'combined' then the logs are written in +# the Common Log Format or the Combined Log Format as defined below: +# +# 'common': $remote_host - - [$time_common] "$request" $response_status $response_body_size +# 'combined': $remote_host - - [$time_common] "$request" $response_status $response_body_size "$header.Referer" "$header.User-Agent" +# +# Otherwise, the value is interpreted as a custom log format which is defined +# with the following parameters. Providing an empty format when logging is +# enabled is an error. To disable access logging leave the log.access.target +# value empty. +# +# $header. - request http header (name: [a-zA-Z0-9-]+) +# $remote_addr - host:port of remote client +# $remote_host - host of remote client +# $remote_port - port of remote client +# $request - request +# $request_args - request query parameters +# $request_host - request host header (aka server name) +# $request_method - request method +# $request_scheme - request scheme +# $request_uri - request URI +# $request_url - request URL +# $request_proto - request protocol +# $response_body_size - response body size in bytes +# $response_status - response status code +# $response_time_ms - response time in S.sss format +# $response_time_us - response time in S.ssssss format +# $response_time_ns - response time in S.sssssssss format +# $time_rfc3339 - log timestamp in YYYY-MM-DDTHH:MM:SSZ format +# $time_rfc3339_ms - log timestamp in YYYY-MM-DDTHH:MM:SS.sssZ format +# $time_rfc3339_us - log timestamp in YYYY-MM-DDTHH:MM:SS.ssssssZ format +# $time_rfc3339_ns - log timestamp in YYYY-MM-DDTHH:MM:SS.sssssssssZ format +# $time_unix_ms - log timestamp in unix epoch ms +# $time_unix_us - log timestamp in unix epoch us +# $time_unix_ns - log timestamp in unix epoch ns +# $time_common - log timestamp in DD/MMM/YYYY:HH:MM:SS -ZZZZ +# $upstream_addr - host:port of upstream server +# $upstream_host - host of upstream server +# $upstream_port - port of upstream server +# $upstream_request_scheme - upstream request scheme +# $upstream_request_uri - upstream request URI +# $upstream_request_url - upstream request URL +# $upstream_service - name of the upstream service +# +# The default is +# +# log.access.format = common + + +# log.access.target configures where the access log is written to. +# +# Options are 'stdout'. If the value is empty no access log is written. +# +# The default is +# +# log.access.target = + + +# log.routes.format configures the log output format of routing table updates. +# +# Changes to the routing table are written to the standard log. This option +# configures the output format: +# +# detail: detailed routing table as ascii tree +# delta: additions and deletions in config language +# all: complete routing table in config language +# +# The default is +# +# log.routes.format = delta + + +# registry.backend configures which backend is used. +# Supported backends are: consul, static, file +# +# The default is +# +# registry.backend = consul + + +# registry.timeout configures how long fabio tries to connect to the registry +# backend during startup. +# +# The default is +# +# registry.timeout = 10s + + +# registry.retry configures the interval with which fabio tries to +# connect to the registry during startup. +# +# The default is +# +# registry.retry = 500ms + + +# registry.static.routes configures a static routing table. +# +# Example: +# +# registry.static.routes = \ +# route add svc / http://1.2.3.4:5000/ +# +# The default is +# +# registry.static.routes = + + +# registry.file.path configures a file based routing table. +# The value configures the path to the file with the routing table. +# +# The default is +# +# registry.file.path = + + +# registry.consul.addr configures the address of the consul agent to connect to. +# +# The default is +# +# registry.consul.addr = localhost:8500 + + +# registry.consul.token configures the acl token for consul. +# +# The default is +# +# registry.consul.token = + + +# registry.consul.kvpath configures the KV path for manual routes. +# +# The consul KV path is watched for changes which get appended to +# the routing table. This allows for manual overrides and weighted +# round-robin routes. +# +# The default is +# +# registry.consul.kvpath = /fabio/config + + +# registry.consul.service.status configures the valid service status +# values for services included in the routing table. +# +# The values are a comma separated list of +# "passing", "warning", "critical" and "unknown" +# +# The default is +# +# registry.consul.service.status = passing + + +# registry.consul.tagprefix configures the prefix for tags which define routes. +# +# Services which define routes publish one or more tags with host/path +# routes which they serve. These tags must have this prefix to be +# recognized as routes. +# +# The default is +# +# registry.consul.tagprefix = urlprefix- + + +# registry.consul.register.enabled configures whether fabio registers itself in consul. +# +# Fabio will register itself in consul only if this value is set to "true" which +# is the default. To disable registration set it to any other value, e.g. "false" +# +# The default is +# +# registry.consul.register.enabled = true + + +# registry.consul.register.addr configures the address for the service registration. +# +# Fabio registers itself in consul with this host:port address. +# It must point to the UI/API endpoint configured by ui.addr and defaults to its +# value. +# +# The default is +# +# registry.consul.register.addr = :9998 + + +# registry.consul.register.name configures the name for the service registration. +# +# Fabio registers itself in consul under this service name. +# +# The default is +# +# registry.consul.register.name = fabio + + +# registry.consul.register.tags configures the tags for the service registration. +# +# Fabio registers itself with these tags. You can provide a comma separated list of tags. +# +# The default is +# +# registry.consul.register.tags = + + +# registry.consul.register.checkInterval configures the interval for the health check. +# +# Fabio registers an http health check on http(s)://${ui.addr}/health +# and this value tells consul how often to check it. +# +# The default is +# +# registry.consul.register.checkInterval = 1s + + +# registry.consul.register.checkTimeout configures the timeout for the health check. +# +# Fabio registers an http health check on http(s)://${ui.addr}/health +# and this value tells consul how long to wait for a response. +# +# The default is +# +# registry.consul.register.checkTimeout = 3s + + +# registry.consul.register.checkTLSSkipVerify configures TLS verification for the health check. +# +# Fabio registers an http health check on http(s)://${ui.addr}/health +# and this value tells consul to skip TLS certificate validation for +# https checks. +# +# The default is +# +# registry.consul.register.checkTLSSkipVerify = false + + +# metrics.target configures the backend the metrics values are +# sent to. +# +# Possible values are: +# : do not report metrics +# stdout: report metrics to stdout +# graphite: report metrics to Graphite on ${metrics.graphite.addr} +# statsd: report metrics to StatsD on ${metrics.statsd.addr} +# circonus: report metrics to Circonus (http://circonus.com/) +# +# The default is +# +# metrics.target = + + +# metrics.prefix configures the template for the prefix of all reported metrics. +# +# Each metric has a unique name which is hard-coded to +# +# prefix.service.host.path.target-addr +# +# The value is expanded by the text/template package and provides +# the following variables: +# +# - Hostname: the Hostname of the server +# - Exec: the executable name of application +# +# The following additional functions are defined: +# +# - clean: lowercase value and replace '.' and ':' with '_' +# +# Template may include regular string parts to customize final prefix +# +# Example: +# +# Server hostname: test-001.something.com +# Binary executable name: fabio +# +# The template variables are: +# +# .Hostname = test-001.something.com +# .Exec = fabio +# +# which results to the following prefix string when using the +# default template: +# +# test-001_something_com.fabio +# +# The default is +# +# metrics.prefix = {{clean .Hostname}}.{{clean .Exec}} + + +# metrics.names configures the template for the route metric names. +# The value is expanded by the text/template package and provides +# the following variables: +# +# - Service: the service name +# - Host: the host part of the URL prefix +# - Path: the path part of the URL prefix +# - TargetURL: the URL of the target +# +# The following additional functions are defined: +# +# - clean: lowercase value and replace '.' and ':' with '_' +# +# Given a route rule of +# +# route add testservice www.example.com/ http://10.1.2.3:12345/ +# +# the template variables are: +# +# .Service = testservice +# .Host = www.example.com +# .Path = / +# .TargetURL.Host = 10.1.2.3:12345 +# +# which results to the following metric name when using the +# default template: +# +# testservice.www_example_com./.10_1_2_3_12345 +# +# The default is +# +# metrics.names = {{clean .Service}}.{{clean .Host}}.{{clean .Path}}.{{clean .TargetURL.Host}} + + +# metrics.interval configures the interval in which metrics are +# reported. +# +# The default is +# +# metrics.interval = 30s + + +# metrics.graphite.addr configures the host:port of the Graphite +# server. This is required when ${metrics.target} is set to "graphite". +# +# The default is +# +# metrics.graphite.addr = + + +# metrics.statsd.addr configures the host:port of the StatsD +# server. This is required when ${metrics.target} is set to "statsd". +# +# The default is +# +# metrics.statsd.addr = + + +# metrics.circonus.apikey configures the API token key to use when +# submitting metrics to Circonus. See: https://login.circonus.com/user/tokens +# This is required when ${metrics.target} is set to "circonus". +# +# The default is +# +# metrics.circonus.apikey = + + +# metrics.circonus.apiapp configures the API token app to use when +# submitting metrics to Circonus. See: https://login.circonus.com/user/tokens +# This is optional when ${metrics.target} is set to "circonus". +# +# The default is +# +# metrics.circonus.apiapp = fabio + + +# metrics.circonus.apiurl configures the API URL to use when +# submitting metrics to Circonus. https://api.circonus.com/v2/ +# will be used if no specific URL is provided. +# This is optional when ${metrics.target} is set to "circonus". +# +# The default is +# +# metrics.circonus.apiurl = + + +# metrics.circonus.brokerid configures a specific broker to use when +# creating a check for submitting metrics to Circonus. +# This is optional when ${metrics.target} is set to "circonus". +# Optional for public brokers, required for Inside brokers. +# Only applicable if a check is being created. +# +# The default is +# +# metrics.circonus.brokerid = + + +# metrics.circonus.checkid configures a specific check to use when +# submitting metrics to Circonus. +# This is optional when ${metrics.target} is set to "circonus". +# An attempt will be made to search for a previously created check, +# if no applicable check is found, one will be created. +# +# The default is +# +# metrics.circonus.checkid = + + +# runtime.gogc configures GOGC (the GC target percentage). +# +# Setting runtime.gogc is equivalent to setting the GOGC +# environment variable which also takes precedence over +# the value from the config file. +# +# Increasing this value means fewer but longer GC cycles +# since there is more garbage to collect. +# +# The default of GOGC=100 works for Go 1.4 but shows +# a significant performance drop for Go 1.5 since the +# concurrent GC kicks in more often. +# +# During benchmarking I have found the following values +# to work for my setup and for now I consider them sane +# defaults for both Go 1.4 and Go 1.5. +# +# GOGC=100: Go 1.5 40% slower than Go 1.4 +# GOGC=200: Go 1.5 == Go 1.4 with GOGC=100 (default) +# GOGC=800: both Go 1.4 and 1.5 significantly faster (40%/go1.4, 100%/go1.5) +# +# The default is +# +# runtime.gogc = 800 + + +# runtime.gomaxprocs configures GOMAXPROCS. +# +# Setting runtime.gomaxprocs is equivalent to setting the GOMAXPROCS +# environment variable which also takes precedence over +# the value from the config file. +# +# If runtime.gomaxprocs < 0 then all CPU cores are used. +# +# The default is +# +# runtime.gomaxprocs = -1 + + +# ui.access configures the access mode for the UI. +# +# ro: read-only access +# rw: read-write access +# +# The default is +# +# ui.access = rw + + +# ui.addr configures the address the UI is listening on. +# The listener uses the same syntax as proxy.addr but +# supports only a single listener. To enable HTTPS +# configure a certificate source. You should use +# a different certificate source than the one you +# use for the external connections, e.g. 'cs=ui'. +# +# The default is +# +# ui.addr = :9998 + + +# ui.color configures the background color of the UI. +# Color names are from http://materializecss.com/color.html +# +# The default is +# +# ui.color = light-green + + +# ui.title configures an optional title for the UI. +# +# The default is +# +# ui.title = +EOF + cat >/lib/systemd/system/fabio.service < Date: Wed, 9 May 2018 10:58:13 +0800 Subject: [PATCH 136/190] fix(fabio): fix fabio config dir not creat fix fabio config dir not creat Signed-off-by: mritd --- fabio.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fabio.sh b/fabio.sh index 447756b..eaecdde 100755 --- a/fabio.sh +++ b/fabio.sh @@ -8,15 +8,15 @@ FABIO_DONWLOAD_URL="https://github.com/fabiolb/fabio/releases/download/v${FABIO_ preinstall(){ getent group fabio >/dev/null || groupadd -r fabio getent passwd fabio >/dev/null || useradd -r -g fabio -d /var/lib/fabio -s /sbin/nologin -c "fabio user" fabio + if [ ! -d /etc/fabio ]; then + mkdir /etc/fabio + fi } postinstall(){ # Initial installation systemctl --no-reload preset fabio.service >/dev/null 2>&1 || : systemctl enable fabio - if [ ! -d /etc/fabio ]; then - mkdir /etc/fabio - fi } preuninstall(){ From 5a4914c4b8da6802e9a10ff49e5da78a38bba9b6 Mon Sep 17 00:00:00 2001 From: mritd Date: Wed, 9 May 2018 11:01:00 +0800 Subject: [PATCH 137/190] feat(fabio): download config file download config file Signed-off-by: mritd --- fabio.sh | 871 +------------------------------------------------------ 1 file changed, 1 insertion(+), 870 deletions(-) diff --git a/fabio.sh b/fabio.sh index eaecdde..179641c 100755 --- a/fabio.sh +++ b/fabio.sh @@ -27,876 +27,7 @@ preuninstall(){ install(){ wget ${FABIO_DONWLOAD_URL} -O /usr/local/bin/fabio chmod +x /usr/local/bin/fabio - cat > /etc/fabio/fabio.properties <;type=;opt=arg;opt[=arg];... -# -# All certificates need to be provided in PEM format. -# -# The following types of certificate sources are available: -# -# File -# -# The file certificate source supports one certificate which is loaded at -# startup and is cached until the service exits. -# -# The 'cert' option contains the path to the certificate file. The 'key' -# option contains the path to the private key file. If the certificate file -# contains both the certificate and the private key the 'key' option can be -# omitted. The 'clientca' option contains the path to one or more client -# authentication certificates. -# -# cs=;type=file;cert=p/a-cert.pem;key=p/a-key.pem;clientca=p/clientAuth.pem -# -# Path -# -# The path certificate source loads certificates from a directory in -# alphabetical order and refreshes them periodically. -# -# The 'cert' option provides the path to the TLS certificates and the -# 'clientca' option provides the path to the certificates for client -# authentication. -# -# TLS certificates are stored either in one or two files: -# -# www.example.com.pem or www.example.com-{cert,key}.pem -# -# TLS certificates are loaded in alphabetical order and the first certificate -# is the default for clients which do not support SNI. -# -# The 'refresh' option can be set to specify the refresh interval for the TLS -# certificates. Client authentication certificates cannot be refreshed since -# Go does not provide a mechanism for that yet. -# -# The default refresh interval is 3 seconds and cannot be lower than 1 second -# to prevent busy loops. To load the certificates only once and disable -# automatic refreshing set 'refresh' to zero. -# -# cs=;type=path;cert=path/to/certs;clientca=path/to/clientcas;refresh=3s -# -# HTTP -# -# The http certificate source loads certificates from an HTTP/HTTPS server. -# -# The 'cert' option provides a URL to a text file which contains all files -# that should be loaded from this directory. The filenames follow the same -# rules as for the path source. The text file can be generated with: -# -# ls -1 *.pem > list -# -# The 'clientca' option provides a URL for the client authentication -# certificates analogous to the 'cert' option. -# -# Authentication credentials can be provided in the URL as request parameter, -# as basic authentication parameters or through a header. -# -# The 'refresh' option can be set to specify the refresh interval for the TLS -# certificates. Client authentication certificates cannot be refreshed since -# Go does not provide a mechanism for that yet. -# -# The default refresh interval is 3 seconds and cannot be lower than 1 second -# to prevent busy loops. To load the certificates only once and disable -# automatic refreshing set 'refresh' to zero. -# -# cs=;type=http;cert=https://host.com/path/to/cert/list&token=123 -# cs=;type=http;cert=https://user:pass@host.com/path/to/cert/list -# cs=;type=http;cert=https://host.com/path/to/cert/list;hdr=Authorization: Bearer 1234 -# -# Consul -# -# The consul certificate source loads certificates from consul. -# -# The 'cert' option provides a KV store URL where the the TLS certificates are -# stored. -# -# The 'clientca' option provides a URL to a path in the KV store where the the -# client authentication certificates are stored. -# -# The filenames follow the same rules as for the path source. -# -# The TLS certificates are updated automatically whenever the KV store -# changes. The client authentication certificates cannot be updated -# automatically since Go does not provide a mechanism for that yet. -# -# cs=;type=consul;cert=http://localhost:8500/v1/kv/path/to/cert&token=123 -# -# Vault -# -# The Vault certificate store uses HashiCorp Vault as the certificate -# store. -# -# The 'cert' option provides the path to the TLS certificates and the -# 'clientca' option provides the path to the certificates for client -# authentication. -# -# The 'refresh' option can be set to specify the refresh interval for the TLS -# certificates. Client authentication certificates cannot be refreshed since -# Go does not provide a mechanism for that yet. -# -# The default refresh interval is 3 seconds and cannot be lower than 1 second -# to prevent busy loops. To load the certificates only once and disable -# automatic refreshing set 'refresh' to zero. -# -# The path to vault must be provided in the VAULT_ADDR environment -# variable. The token must be provided in the VAULT_TOKEN environment -# variable. -# -# cs=;type=vault;cert=secret/fabio/certs -# -# -# Common options -# -# All certificate stores support the following options: -# -# caupgcn: Upgrade a self-signed client auth certificate with this common-name -# to a CA certificate. Typically used for self-singed certificates -# for the Amazon AWS Api Gateway certificates which do not have the -# CA flag set which makes them unsuitable for client certificate -# authentication in Go. For the AWS Api Gateway set this value -# to 'ApiGateway' to allow client certificate authentication. -# This replaces the deprecated parameter 'aws.apigw.cert.cn' -# which was introduced in version 1.1.5. -# -# Examples: -# -# # file based certificate source -# proxy.cs = cs=some-name;type=file;cert=p/a-cert.pem;key=p/a-key.pem -# -# # path based certificate source -# proxy.cs = cs=some-name;type=path;path=path/to/certs -# -# # HTTP certificate source -# proxy.cs = cs=some-name;type=http;cert=https://user:pass@host:port/path/to/certs -# -# # Consul certificate source -# proxy.cs = cs=some-name;type=consul;cert=https://host:port/v1/kv/path/to/certs?token=abc123 -# -# # Vault certificate source -# proxy.cs = cs=some-name;type=vault;cert=secret/fabio/certs -# -# # Multiple certificate sources -# proxy.cs = cs=srcA;type=path;path=path/to/certs,\ -# cs=srcB;type=http;cert=https://user:pass@host:port/path/to/certs -# -# # path based certificate source for AWS Api Gateway -# proxy.cs = cs=some-name;type=path;path=path/to/certs;clientca=path/to/clientcas;caupgcn=ApiGateway -# -# The default is -# -# proxy.cs = - - -# proxy.addr configures listeners. -# -# Each listener is configured with and address and a -# list of optional arguments in the form of -# -# [host]:port;opt=arg;opt[=arg];... -# -# Each listener has a protocol which is configured -# with the 'proto' option for which it routes and -# forwards traffic. -# -# The supported protocols are: -# -# * http for HTTP based protocols -# * https for HTTPS based protocols -# * tcp for a raw TCP proxy with or witout TLS support -# * tcp+sni for an SNI aware TCP proxy -# -# If no 'proto' option is specified then the protocol -# is either 'http' or 'https' depending on whether a -# certificate source is configured via the 'cs' option -# which contains the name of the certificate source. -# -# The TCP+SNI proxy analyzes the ClientHello message -# of TLS connections to extract the server name -# extension and then forwards the encrypted traffic -# to the destination without decrypting the traffic. -# -# General options: -# -# rt: Sets the read timeout as a duration value (e.g. '3s') -# -# wt: Sets the write timeout as a duration value (e.g. '3s') -# -# strictmatch: When set to 'true' the certificate source must provide -# a certificate that matches the hostname for the connection -# to be established. Otherwise, the first certificate is used -# if no matching certificate was found. This matches the default -# behavior of the Go TLS server implementation. -# -# TLS options: -# -# tlsmin: Sets the minimum TLS version for the handshake. This value -# is one of [ssl30, tls10, tls11, tls12] or the corresponding -# version number from https://golang.org/pkg/crypto/tls/#pkg-constants -# -# tlsmax: Sets the maximum TLS version for the handshake. See 'tlsmin' -# for the format. -# -# tlsciphers: Sets the list of allowed ciphers for the handshake. The value -# is a quoted comma-separated list of the hex cipher values or -# the constant names from https://golang.org/pkg/crypto/tls/#pkg-constants, -# e.g. "0xc00a,0xc02b" or "TLS_RSA_WITH_RC4_128_SHA,TLS_RSA_WITH_AES_128_CBC_SHA" -# -# Examples: -# -# # HTTP listener on port 9999 -# proxy.addr = :9999 -# -# # HTTP listener on IPv4 with read timeout -# proxy.addr = 1.2.3.4:9999;rt=3s -# -# # HTTP listener on IPv6 with write timeout -# proxy.addr = [2001:DB8::A/32]:9999;wt=5s -# -# # Multiple listeners -# proxy.addr = 1.2.3.4:9999;rt=3s,[2001:DB8::A/32]:9999;wt=5s -# -# # HTTPS listener on port 443 with certificate source -# proxy.addr = :443;cs=some-name -# -# # HTTPS listener on port 443 with certificate source and TLS options -# proxy.addr = :443;cs=some-name;tlsmin=tls10;tlsmax=tls11;tlsciphers="0xc00a,0xc02b" -# -# # TCP listener on port 1234 with port routing -# proxy.addr = :1234;proto=tcp -# -# # TCP listener on port 443 with SNI routing -# proxy.addr = :443;proto=tcp+sni -# -# The default is -# -# proxy.addr = :9999 - - -# proxy.localip configures the ip address of the proxy which is added -# to the Header configured by header.clientip and to the 'Forwarded: by=' attribute. -# -# The local non-loopback address is detected during startup -# but can be overwritten with this property. -# -# The default is -# -# proxy.localip = - - -# proxy.strategy configures the load balancing strategy. -# -# rnd: pseudo-random distribution -# rr: round-robin distribution -# -# "rnd" configures a pseudo-random distribution by using the microsecond -# fraction of the time of the request. -# -# "rr" configures a round-robin distribution. -# -# The default is -# -# proxy.strategy = rnd - - -# proxy.matcher configures the path matching algorithm. -# -# prefix: prefix matching -# glob: glob matching -# -# The default is -# -# proxy.matcher = prefix - - -# proxy.noroutestatus configures the response code when no route was found. -# -# The default is -# -# proxy.noroutestatus = 404 - - -# proxy.shutdownwait configures the time for a graceful shutdown. -# -# After a signal is caught the proxy will immediately suspend -# routing traffic and respond with a 503 Service Unavailable -# for the duration of the given period. -# -# The default is -# -# proxy.shutdownwait = 0s - - -# proxy.responseheadertimeout configures the response header timeout. -# -# This configures the ResponseHeaderTimeout of the http.Transport. -# -# The default is -# -# proxy.responseheadertimeout = 0s - - -# proxy.keepalivetimeout configures the keep-alive timeout. -# -# This configures the KeepAliveTimeout of the network dialer. -# -# The default is -# -# proxy.keepalivetimeout = 0s - - -# proxy.dialtimeout configures the connection timeout for -# outgoing connections. -# -# This configures the DialTimeout of the network dialer. -# -# The default is -# -# proxy.dialtimeout = 30s - - -# proxy.flushinterval configures periodic flushing of the -# response buffer for SSE (server-sent events) connections. -# They are detected when the 'Accept' header is -# 'text/event-stream'. -# -# The default is -# -# proxy.flushinterval = 1s - - -# proxy.maxconn configures the maximum number of cached -# incoming and outgoing connections. -# -# This configures the MaxConnsPerHost of the http.Transport. -# -# The default is -# -# proxy.maxconn = 10000 - - -# proxy.header.clientip configures the header for the request ip. -# -# The remoteIP is taken from http.Request.RemoteAddr. -# -# The default is -# -# proxy.header.clientip = - - -# proxy.header.tls configures the header to set for TLS connections. -# -# When set to a non-empty value the proxy will set this header on every -# TLS request to the value of ${proxy.header.tls.value} -# -# The default is -# -# proxy.header.tls = -# proxy.header.tls.value = - - -# proxy.header.requestid configures the header for the adding a unique request id. -# When set non-empty value the proxy will set this header on every request to the -# unique UUID value. -# -# The default is -# -# proxy.header.requestid = - - -# proxy.gzip.contenttype configures which responses should be compressed. -# -# By default, responses sent to the client are not compressed even if the -# client accepts compressed responses by setting the 'Accept-Encoding: gzip' -# header. By setting this value responses are compressed if the Content-Type -# header of the response matches and the response is not already compressed. -# The list of compressable content types is defined as a regular expression. -# The regular expression must follow the rules outlined in golang.org/pkg/regexp. -# -# A typical example is -# -# proxy.gzip.contenttype = ^(text/.*|application/(javascript|json|font-woff|xml)|.*\+(json|xml))(;.*)?$ -# -# The default is -# -# proxy.gzip.contenttype = - - -# log.access.format configures the format of the access log. -# -# If the value is either 'common' or 'combined' then the logs are written in -# the Common Log Format or the Combined Log Format as defined below: -# -# 'common': $remote_host - - [$time_common] "$request" $response_status $response_body_size -# 'combined': $remote_host - - [$time_common] "$request" $response_status $response_body_size "$header.Referer" "$header.User-Agent" -# -# Otherwise, the value is interpreted as a custom log format which is defined -# with the following parameters. Providing an empty format when logging is -# enabled is an error. To disable access logging leave the log.access.target -# value empty. -# -# $header. - request http header (name: [a-zA-Z0-9-]+) -# $remote_addr - host:port of remote client -# $remote_host - host of remote client -# $remote_port - port of remote client -# $request - request -# $request_args - request query parameters -# $request_host - request host header (aka server name) -# $request_method - request method -# $request_scheme - request scheme -# $request_uri - request URI -# $request_url - request URL -# $request_proto - request protocol -# $response_body_size - response body size in bytes -# $response_status - response status code -# $response_time_ms - response time in S.sss format -# $response_time_us - response time in S.ssssss format -# $response_time_ns - response time in S.sssssssss format -# $time_rfc3339 - log timestamp in YYYY-MM-DDTHH:MM:SSZ format -# $time_rfc3339_ms - log timestamp in YYYY-MM-DDTHH:MM:SS.sssZ format -# $time_rfc3339_us - log timestamp in YYYY-MM-DDTHH:MM:SS.ssssssZ format -# $time_rfc3339_ns - log timestamp in YYYY-MM-DDTHH:MM:SS.sssssssssZ format -# $time_unix_ms - log timestamp in unix epoch ms -# $time_unix_us - log timestamp in unix epoch us -# $time_unix_ns - log timestamp in unix epoch ns -# $time_common - log timestamp in DD/MMM/YYYY:HH:MM:SS -ZZZZ -# $upstream_addr - host:port of upstream server -# $upstream_host - host of upstream server -# $upstream_port - port of upstream server -# $upstream_request_scheme - upstream request scheme -# $upstream_request_uri - upstream request URI -# $upstream_request_url - upstream request URL -# $upstream_service - name of the upstream service -# -# The default is -# -# log.access.format = common - - -# log.access.target configures where the access log is written to. -# -# Options are 'stdout'. If the value is empty no access log is written. -# -# The default is -# -# log.access.target = - - -# log.routes.format configures the log output format of routing table updates. -# -# Changes to the routing table are written to the standard log. This option -# configures the output format: -# -# detail: detailed routing table as ascii tree -# delta: additions and deletions in config language -# all: complete routing table in config language -# -# The default is -# -# log.routes.format = delta - - -# registry.backend configures which backend is used. -# Supported backends are: consul, static, file -# -# The default is -# -# registry.backend = consul - - -# registry.timeout configures how long fabio tries to connect to the registry -# backend during startup. -# -# The default is -# -# registry.timeout = 10s - - -# registry.retry configures the interval with which fabio tries to -# connect to the registry during startup. -# -# The default is -# -# registry.retry = 500ms - - -# registry.static.routes configures a static routing table. -# -# Example: -# -# registry.static.routes = \ -# route add svc / http://1.2.3.4:5000/ -# -# The default is -# -# registry.static.routes = - - -# registry.file.path configures a file based routing table. -# The value configures the path to the file with the routing table. -# -# The default is -# -# registry.file.path = - - -# registry.consul.addr configures the address of the consul agent to connect to. -# -# The default is -# -# registry.consul.addr = localhost:8500 - - -# registry.consul.token configures the acl token for consul. -# -# The default is -# -# registry.consul.token = - - -# registry.consul.kvpath configures the KV path for manual routes. -# -# The consul KV path is watched for changes which get appended to -# the routing table. This allows for manual overrides and weighted -# round-robin routes. -# -# The default is -# -# registry.consul.kvpath = /fabio/config - - -# registry.consul.service.status configures the valid service status -# values for services included in the routing table. -# -# The values are a comma separated list of -# "passing", "warning", "critical" and "unknown" -# -# The default is -# -# registry.consul.service.status = passing - - -# registry.consul.tagprefix configures the prefix for tags which define routes. -# -# Services which define routes publish one or more tags with host/path -# routes which they serve. These tags must have this prefix to be -# recognized as routes. -# -# The default is -# -# registry.consul.tagprefix = urlprefix- - - -# registry.consul.register.enabled configures whether fabio registers itself in consul. -# -# Fabio will register itself in consul only if this value is set to "true" which -# is the default. To disable registration set it to any other value, e.g. "false" -# -# The default is -# -# registry.consul.register.enabled = true - - -# registry.consul.register.addr configures the address for the service registration. -# -# Fabio registers itself in consul with this host:port address. -# It must point to the UI/API endpoint configured by ui.addr and defaults to its -# value. -# -# The default is -# -# registry.consul.register.addr = :9998 - - -# registry.consul.register.name configures the name for the service registration. -# -# Fabio registers itself in consul under this service name. -# -# The default is -# -# registry.consul.register.name = fabio - - -# registry.consul.register.tags configures the tags for the service registration. -# -# Fabio registers itself with these tags. You can provide a comma separated list of tags. -# -# The default is -# -# registry.consul.register.tags = - - -# registry.consul.register.checkInterval configures the interval for the health check. -# -# Fabio registers an http health check on http(s)://${ui.addr}/health -# and this value tells consul how often to check it. -# -# The default is -# -# registry.consul.register.checkInterval = 1s - - -# registry.consul.register.checkTimeout configures the timeout for the health check. -# -# Fabio registers an http health check on http(s)://${ui.addr}/health -# and this value tells consul how long to wait for a response. -# -# The default is -# -# registry.consul.register.checkTimeout = 3s - - -# registry.consul.register.checkTLSSkipVerify configures TLS verification for the health check. -# -# Fabio registers an http health check on http(s)://${ui.addr}/health -# and this value tells consul to skip TLS certificate validation for -# https checks. -# -# The default is -# -# registry.consul.register.checkTLSSkipVerify = false - - -# metrics.target configures the backend the metrics values are -# sent to. -# -# Possible values are: -# : do not report metrics -# stdout: report metrics to stdout -# graphite: report metrics to Graphite on ${metrics.graphite.addr} -# statsd: report metrics to StatsD on ${metrics.statsd.addr} -# circonus: report metrics to Circonus (http://circonus.com/) -# -# The default is -# -# metrics.target = - - -# metrics.prefix configures the template for the prefix of all reported metrics. -# -# Each metric has a unique name which is hard-coded to -# -# prefix.service.host.path.target-addr -# -# The value is expanded by the text/template package and provides -# the following variables: -# -# - Hostname: the Hostname of the server -# - Exec: the executable name of application -# -# The following additional functions are defined: -# -# - clean: lowercase value and replace '.' and ':' with '_' -# -# Template may include regular string parts to customize final prefix -# -# Example: -# -# Server hostname: test-001.something.com -# Binary executable name: fabio -# -# The template variables are: -# -# .Hostname = test-001.something.com -# .Exec = fabio -# -# which results to the following prefix string when using the -# default template: -# -# test-001_something_com.fabio -# -# The default is -# -# metrics.prefix = {{clean .Hostname}}.{{clean .Exec}} - - -# metrics.names configures the template for the route metric names. -# The value is expanded by the text/template package and provides -# the following variables: -# -# - Service: the service name -# - Host: the host part of the URL prefix -# - Path: the path part of the URL prefix -# - TargetURL: the URL of the target -# -# The following additional functions are defined: -# -# - clean: lowercase value and replace '.' and ':' with '_' -# -# Given a route rule of -# -# route add testservice www.example.com/ http://10.1.2.3:12345/ -# -# the template variables are: -# -# .Service = testservice -# .Host = www.example.com -# .Path = / -# .TargetURL.Host = 10.1.2.3:12345 -# -# which results to the following metric name when using the -# default template: -# -# testservice.www_example_com./.10_1_2_3_12345 -# -# The default is -# -# metrics.names = {{clean .Service}}.{{clean .Host}}.{{clean .Path}}.{{clean .TargetURL.Host}} - - -# metrics.interval configures the interval in which metrics are -# reported. -# -# The default is -# -# metrics.interval = 30s - - -# metrics.graphite.addr configures the host:port of the Graphite -# server. This is required when ${metrics.target} is set to "graphite". -# -# The default is -# -# metrics.graphite.addr = - - -# metrics.statsd.addr configures the host:port of the StatsD -# server. This is required when ${metrics.target} is set to "statsd". -# -# The default is -# -# metrics.statsd.addr = - - -# metrics.circonus.apikey configures the API token key to use when -# submitting metrics to Circonus. See: https://login.circonus.com/user/tokens -# This is required when ${metrics.target} is set to "circonus". -# -# The default is -# -# metrics.circonus.apikey = - - -# metrics.circonus.apiapp configures the API token app to use when -# submitting metrics to Circonus. See: https://login.circonus.com/user/tokens -# This is optional when ${metrics.target} is set to "circonus". -# -# The default is -# -# metrics.circonus.apiapp = fabio - - -# metrics.circonus.apiurl configures the API URL to use when -# submitting metrics to Circonus. https://api.circonus.com/v2/ -# will be used if no specific URL is provided. -# This is optional when ${metrics.target} is set to "circonus". -# -# The default is -# -# metrics.circonus.apiurl = - - -# metrics.circonus.brokerid configures a specific broker to use when -# creating a check for submitting metrics to Circonus. -# This is optional when ${metrics.target} is set to "circonus". -# Optional for public brokers, required for Inside brokers. -# Only applicable if a check is being created. -# -# The default is -# -# metrics.circonus.brokerid = - - -# metrics.circonus.checkid configures a specific check to use when -# submitting metrics to Circonus. -# This is optional when ${metrics.target} is set to "circonus". -# An attempt will be made to search for a previously created check, -# if no applicable check is found, one will be created. -# -# The default is -# -# metrics.circonus.checkid = - - -# runtime.gogc configures GOGC (the GC target percentage). -# -# Setting runtime.gogc is equivalent to setting the GOGC -# environment variable which also takes precedence over -# the value from the config file. -# -# Increasing this value means fewer but longer GC cycles -# since there is more garbage to collect. -# -# The default of GOGC=100 works for Go 1.4 but shows -# a significant performance drop for Go 1.5 since the -# concurrent GC kicks in more often. -# -# During benchmarking I have found the following values -# to work for my setup and for now I consider them sane -# defaults for both Go 1.4 and Go 1.5. -# -# GOGC=100: Go 1.5 40% slower than Go 1.4 -# GOGC=200: Go 1.5 == Go 1.4 with GOGC=100 (default) -# GOGC=800: both Go 1.4 and 1.5 significantly faster (40%/go1.4, 100%/go1.5) -# -# The default is -# -# runtime.gogc = 800 - - -# runtime.gomaxprocs configures GOMAXPROCS. -# -# Setting runtime.gomaxprocs is equivalent to setting the GOMAXPROCS -# environment variable which also takes precedence over -# the value from the config file. -# -# If runtime.gomaxprocs < 0 then all CPU cores are used. -# -# The default is -# -# runtime.gomaxprocs = -1 - - -# ui.access configures the access mode for the UI. -# -# ro: read-only access -# rw: read-write access -# -# The default is -# -# ui.access = rw - - -# ui.addr configures the address the UI is listening on. -# The listener uses the same syntax as proxy.addr but -# supports only a single listener. To enable HTTPS -# configure a certificate source. You should use -# a different certificate source than the one you -# use for the external connections, e.g. 'cs=ui'. -# -# The default is -# -# ui.addr = :9998 - - -# ui.color configures the background color of the UI. -# Color names are from http://materializecss.com/color.html -# -# The default is -# -# ui.color = light-green - - -# ui.title configures an optional title for the UI. -# -# The default is -# -# ui.title = -EOF + wget https://raw.githubusercontent.com/fabiolb/fabio/master/fabio.properties -O /etc/fabio/fabio.properties cat >/lib/systemd/system/fabio.service < Date: Thu, 10 May 2018 10:36:26 +0800 Subject: [PATCH 138/190] fix(imagePullSecret): fix imagePullSecret check fix imagePullSecret check Signed-off-by: mritd --- create_imagePullSecret.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/create_imagePullSecret.sh b/create_imagePullSecret.sh index d4a70e1..d2c833f 100755 --- a/create_imagePullSecret.sh +++ b/create_imagePullSecret.sh @@ -6,9 +6,8 @@ REGISTRY_TOKEN=`sudo cat ~/.docker/config.json | base64 | tr -d '\n'` REGISTRY_ADDRESS=${REGISTRY_ADDRESS:-"reg.mritd.me"} NAMESPACE=${NAMESPACE:-"default"} -if [ "" == "${REGISTRY_ADDRESS}" ]; then - echo -e "\033[31mError: REGISTRY_ADDRESS is blank!\033[0m" - exit 1 +if [ "reg.mritd.me" == "${REGISTRY_ADDRESS}" ]; then + echo -e "\033[33mWARNING: REGISTRY_ADDRESS is blank,use default value ==> reg.mritd.me\033[0m" fi @@ -24,3 +23,4 @@ type: kubernetes.io/dockerconfigjson EOF kubectl create -f imagePullSecret.yaml kubectl patch serviceaccounts default -p "{\"imagePullSecrets\":[{\"name\":\"${REGISTRY_ADDRESS}\"}]}" -n ${NAMESPACE} +rm -f imagePullSecret.yaml From 215f87e953ed49f9efee0a784a37de7fcf435b04 Mon Sep 17 00:00:00 2001 From: mritd Date: Thu, 10 May 2018 11:04:24 +0800 Subject: [PATCH 139/190] =?UTF-8?q?feat(imagePullSecret):=20=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E7=BB=88=E7=AB=AF=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 使用终端参数 Signed-off-by: mritd --- create_imagePullSecret.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/create_imagePullSecret.sh b/create_imagePullSecret.sh index d2c833f..180386e 100755 --- a/create_imagePullSecret.sh +++ b/create_imagePullSecret.sh @@ -3,11 +3,16 @@ set -e REGISTRY_TOKEN=`sudo cat ~/.docker/config.json | base64 | tr -d '\n'` -REGISTRY_ADDRESS=${REGISTRY_ADDRESS:-"reg.mritd.me"} -NAMESPACE=${NAMESPACE:-"default"} +REGISTRY_ADDRESS=${1} +NAMESPACE=${2} -if [ "reg.mritd.me" == "${REGISTRY_ADDRESS}" ]; then +if [ "" == "${REGISTRY_ADDRESS}" ]; then echo -e "\033[33mWARNING: REGISTRY_ADDRESS is blank,use default value ==> reg.mritd.me\033[0m" + REGISTRY_ADDRESS="reg.mritd.me" +fi +if [ "" == "${NAMESPACE}" ]; then + echo -e "\033[33mWARNING: NAMESPACE is blank,use default value ==> default\033[0m" + NAMESPACE="default" fi From d873a9843f7ec8b3fdb678f7f65dca5704e5339a Mon Sep 17 00:00:00 2001 From: mritd Date: Fri, 22 Jun 2018 17:42:58 +0800 Subject: [PATCH 140/190] feat(ohmyzsh): add zsh-syntax-highlighting add zsh-syntax-highlighting Signed-off-by: mritd --- init_ubuntu.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/init_ubuntu.sh b/init_ubuntu.sh index f95ebfd..f80018f 100755 --- a/init_ubuntu.sh +++ b/init_ubuntu.sh @@ -5,6 +5,7 @@ set -e TZ='Asia/Shanghai' OZ_DOWNLOAD_URL='https://github.com/robbyrussell/oh-my-zsh.git' OZ_CONFIG_DOWNLOAD_URL='https://mritdftp.b0.upaiyun.com/files/config/ohmyzsh.tar.gz' +OZ_SYNTAX_HIGHLIGHTING_DOWNLOAD_URL='https://github.com/zsh-users/zsh-syntax-highlighting.git' VIM_CONFIG_DOWNLOAD_URL='https://mritdftp.b0.upaiyun.com/files/config/vim.tar.gz' DOCKER_DEB="deb [arch=amd64] https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/ubuntu $(lsb_release -cs) stable" DOCKER_CONFIG_DOWNLOAD_URL='https://mritdftp.b0.upaiyun.com/files/config/docker.tar.gz' @@ -36,6 +37,7 @@ function settimezone(){ function install_ohmyzsh(){ if [ ! -d ~/.oh-my-zsh ]; then git clone --depth=1 ${OZ_DOWNLOAD_URL} ~/.oh-my-zsh + git clone ${OZ_SYNTAX_HIGHLIGHTING_DOWNLOAD_URL} ~/.oh-my-zsh/plugins/zsh-syntax-highlighting wget ${OZ_CONFIG_DOWNLOAD_URL} tar -zxvf ohmyzsh.tar.gz -C ~ && rm -f ohmyzsh.tar.gz chsh -s $(grep /zsh$ /etc/shells | tail -1) From 6b36e2194c8a4accc58713682f427efc37a57317 Mon Sep 17 00:00:00 2001 From: mritd Date: Mon, 16 Jul 2018 11:30:17 +0800 Subject: [PATCH 141/190] feat(consul): update consul version update consul version Signed-off-by: mritd --- consul.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/consul.sh b/consul.sh index 6637990..45ee265 100755 --- a/consul.sh +++ b/consul.sh @@ -2,7 +2,7 @@ set -e -CONSUL_VERSION="1.0.7" +CONSUL_VERSION="1.2.1" CONSUL_DONWLOAD_URL="https://releases.hashicorp.com/consul/${CONSUL_VERSION}/consul_${CONSUL_VERSION}_linux_amd64.zip" preinstall(){ From cf7d91e487ce25f8f7af5b84ec4f7f6a8e20b838 Mon Sep 17 00:00:00 2001 From: mritd Date: Thu, 19 Jul 2018 17:06:01 +0800 Subject: [PATCH 142/190] feat(dns config): remove dns_config.sh remove dns_config.sh Signed-off-by: mritd --- dns_config.sh | 16 ---------------- 1 file changed, 16 deletions(-) delete mode 100755 dns_config.sh diff --git a/dns_config.sh b/dns_config.sh deleted file mode 100755 index 5115265..0000000 --- a/dns_config.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -SERVER_IP=$1 - -if [ "${SERVER_IP}" == "" ]; then - echo -e "\033[31mError: SERVER_IP is blank!\033[0m" - exit 1 -fi - -sed -i 's@#resolv-file.*@resolv-file=/etc/resolv.dnsmasq.conf@gi' /etc/dnsmasq.conf -sed -i 's@#no-hosts@no-hosts@gi' /etc/dnsmasq.conf -sed -i "s@#listen-address.*@listen-address=127.0.0.1,$1@gi" /etc/dnsmasq.conf -sed -i 's@#addn-hosts.*@addn-hosts=/etc/dnsmasq.hosts@gi' /etc/dnsmasq.conf - -touch /etc/dnsmasq.hosts -echo 'nameserver 114.114.114.114' >> /etc/resolv.dnsmasq.conf From 31f34c67ae35d2649116232d2a34ab45b666d40f Mon Sep 17 00:00:00 2001 From: mritd Date: Thu, 19 Jul 2018 17:35:11 +0800 Subject: [PATCH 143/190] feat(init ubuntu): update oymyzsh update oymyzsh Signed-off-by: mritd --- init_ubuntu.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init_ubuntu.sh b/init_ubuntu.sh index f80018f..a4ede73 100755 --- a/init_ubuntu.sh +++ b/init_ubuntu.sh @@ -37,7 +37,7 @@ function settimezone(){ function install_ohmyzsh(){ if [ ! -d ~/.oh-my-zsh ]; then git clone --depth=1 ${OZ_DOWNLOAD_URL} ~/.oh-my-zsh - git clone ${OZ_SYNTAX_HIGHLIGHTING_DOWNLOAD_URL} ~/.oh-my-zsh/plugins/zsh-syntax-highlighting + git clone ${OZ_SYNTAX_HIGHLIGHTING_DOWNLOAD_URL} ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting wget ${OZ_CONFIG_DOWNLOAD_URL} tar -zxvf ohmyzsh.tar.gz -C ~ && rm -f ohmyzsh.tar.gz chsh -s $(grep /zsh$ /etc/shells | tail -1) From 018015536d8fd72a8f7949241167100ef8dd6016 Mon Sep 17 00:00:00 2001 From: mritd Date: Tue, 24 Jul 2018 18:52:11 +0800 Subject: [PATCH 144/190] feat(init ubuntu): switch to space vim switch to space vim Signed-off-by: mritd --- init_ubuntu.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/init_ubuntu.sh b/init_ubuntu.sh index a4ede73..e61b164 100755 --- a/init_ubuntu.sh +++ b/init_ubuntu.sh @@ -45,7 +45,8 @@ function install_ohmyzsh(){ } function config_vim(){ - if [ ! -d ~/.vim ]; then + curl -sLf https://spacevim.org/cn/install.sh | bash -s -- --install vim + if [ ! -d ~/.SpaceVim.d ]; then wget ${VIM_CONFIG_DOWNLOAD_URL} tar -zxvf vim.tar.gz -C ~ && rm -f vim.tar.gz fi From e4cd17701ab5404cf4667a0d70b65b74fb690bc1 Mon Sep 17 00:00:00 2001 From: mritd Date: Wed, 22 Aug 2018 17:30:55 +0800 Subject: [PATCH 145/190] feat(init): remove vim config remove vim config Signed-off-by: mritd --- init_ubuntu.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init_ubuntu.sh b/init_ubuntu.sh index e61b164..8aaf513 100755 --- a/init_ubuntu.sh +++ b/init_ubuntu.sh @@ -79,7 +79,7 @@ function install_dc(){ sysupdate setlocale settimezone -config_vim +#config_vim install_ohmyzsh install_docker install_ctop From a0f4af80d8581b67b04358a60a8749a3540db0be Mon Sep 17 00:00:00 2001 From: mritd Date: Sat, 25 Aug 2018 16:25:02 +0800 Subject: [PATCH 146/190] feat(vim): fix vim fix vim Signed-off-by: mritd --- init_ubuntu.sh | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/init_ubuntu.sh b/init_ubuntu.sh index 8aaf513..4016b9c 100755 --- a/init_ubuntu.sh +++ b/init_ubuntu.sh @@ -45,11 +45,8 @@ function install_ohmyzsh(){ } function config_vim(){ - curl -sLf https://spacevim.org/cn/install.sh | bash -s -- --install vim - if [ ! -d ~/.SpaceVim.d ]; then - wget ${VIM_CONFIG_DOWNLOAD_URL} - tar -zxvf vim.tar.gz -C ~ && rm -f vim.tar.gz - fi + wget ${VIM_CONFIG_DOWNLOAD_URL} + tar -zxvf vim.tar.gz -C ~ && rm -f vim.tar.gz } function install_docker(){ @@ -79,7 +76,7 @@ function install_dc(){ sysupdate setlocale settimezone -#config_vim +config_vim install_ohmyzsh install_docker install_ctop From 028fb8ba66c43d7aafcc40f93420a2fa27d9b8fc Mon Sep 17 00:00:00 2001 From: mritd Date: Sat, 25 Aug 2018 17:37:32 +0800 Subject: [PATCH 147/190] feat(cloud-init): disable cloud-init and systemd-resolved disable cloud-init and systemd-resolved Signed-off-by: mritd --- init_ubuntu.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/init_ubuntu.sh b/init_ubuntu.sh index 4016b9c..3a1daca 100755 --- a/init_ubuntu.sh +++ b/init_ubuntu.sh @@ -13,7 +13,8 @@ CTOP_DOWNLOAD_URL='https://mritdftp.b0.upaiyun.com/files/ctop/ctop-0.7.1-linux-a DOCKER_COMPOSE_DOWNLOAD_URL="https://get.daocloud.io/docker/compose/releases/download/1.21.0/docker-compose-`uname -s`-`uname -m`" if [ "$(lsb_release -cs)" == "bionic" ]; then - DOCKER_DEB="deb [arch=amd64] https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/ubuntu artful stable" + systemctl stop cloud-config cloud-final cloud-init cloud-init-local systemd-resolved + systemctl dsiable cloud-config cloud-final cloud-init cloud-init-local systemd-resolved fi From 00308f4b8f8b1d287a5a58e3476e894989debf3b Mon Sep 17 00:00:00 2001 From: mritd Date: Sun, 26 Aug 2018 12:02:13 +0800 Subject: [PATCH 148/190] feat(ubuntu-init): enable systemd-resolved enable systemd-resolved Signed-off-by: mritd --- init_ubuntu.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/init_ubuntu.sh b/init_ubuntu.sh index 3a1daca..ed203e2 100755 --- a/init_ubuntu.sh +++ b/init_ubuntu.sh @@ -13,8 +13,8 @@ CTOP_DOWNLOAD_URL='https://mritdftp.b0.upaiyun.com/files/ctop/ctop-0.7.1-linux-a DOCKER_COMPOSE_DOWNLOAD_URL="https://get.daocloud.io/docker/compose/releases/download/1.21.0/docker-compose-`uname -s`-`uname -m`" if [ "$(lsb_release -cs)" == "bionic" ]; then - systemctl stop cloud-config cloud-final cloud-init cloud-init-local systemd-resolved - systemctl dsiable cloud-config cloud-final cloud-init cloud-init-local systemd-resolved + systemctl stop cloud-config cloud-final cloud-init cloud-init-local + systemctl dsiable cloud-config cloud-final cloud-init cloud-init-local fi From 0ad226f45c849daa1ac78299b6b22e2474d0bbed Mon Sep 17 00:00:00 2001 From: mritd Date: Wed, 5 Sep 2018 22:13:14 +0800 Subject: [PATCH 149/190] feat(initubuntu): add ipvsadm ipset add ipvsadm ipset Signed-off-by: mritd --- init_ubuntu.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init_ubuntu.sh b/init_ubuntu.sh index ed203e2..997eade 100755 --- a/init_ubuntu.sh +++ b/init_ubuntu.sh @@ -21,7 +21,7 @@ fi function sysupdate(){ apt update -y apt upgrade -y - apt install wget curl vim zsh ctags git htop tzdata -y + apt install wget curl vim zsh ctags git htop tzdata ipvsadm ipset -y } function setlocale(){ From 9bd152bd5aa3d04311856c2f3ea7693c3aa92002 Mon Sep 17 00:00:00 2001 From: mritd Date: Wed, 19 Sep 2018 00:27:31 +0800 Subject: [PATCH 150/190] fix(systemd): fix systemd cmd fix systemd cmd Signed-off-by: mritd --- init_ubuntu.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init_ubuntu.sh b/init_ubuntu.sh index 997eade..33e671a 100755 --- a/init_ubuntu.sh +++ b/init_ubuntu.sh @@ -14,7 +14,7 @@ DOCKER_COMPOSE_DOWNLOAD_URL="https://get.daocloud.io/docker/compose/releases/dow if [ "$(lsb_release -cs)" == "bionic" ]; then systemctl stop cloud-config cloud-final cloud-init cloud-init-local - systemctl dsiable cloud-config cloud-final cloud-init cloud-init-local + systemctl disable cloud-config cloud-final cloud-init cloud-init-local fi From 2649d0b668dbc89b2926cc64161f10ab3ae46572 Mon Sep 17 00:00:00 2001 From: mritd Date: Sun, 30 Sep 2018 14:01:14 +0800 Subject: [PATCH 151/190] feat(ntfs): add mac ntfs add mac ntfs Signed-off-by: mritd --- mac_ntfs.sh | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100755 mac_ntfs.sh diff --git a/mac_ntfs.sh b/mac_ntfs.sh new file mode 100755 index 0000000..b5f7a46 --- /dev/null +++ b/mac_ntfs.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +brew cask install osxfuse +brew install ntfs-3g + +sudo mv /sbin/mount_ntfs /sbin/mount_ntfs.bak +sudo ln -s /usr/local/bin/ntfs-3g /sbin/mount_ntfs From d241356d76c97972ebb11d1bd489e98706826327 Mon Sep 17 00:00:00 2001 From: mritd Date: Tue, 5 Feb 2019 10:08:44 +0800 Subject: [PATCH 152/190] feat(acme): update godaddy update godaddy Signed-off-by: mritd --- acme_godaddy.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/acme_godaddy.sh b/acme_godaddy.sh index 2894d15..f883e40 100755 --- a/acme_godaddy.sh +++ b/acme_godaddy.sh @@ -5,11 +5,11 @@ # Example: ./acme_dns.sh GD_Key GD_Secret mritd.me cdn.mritd.me # GD_Key and GD_Secret can be obtained from Godaddy developer page -export GD_Key=$1 -export GD_Secret=$2 +#export GD_Key=$1 +#export GD_Secret=$2 for i in `seq 3 $#`;do - Domains+=" -d $3" + Domains+=" -d $1" echo -e "\033[32mDomains: $3\033[0m" shift done From e0774dbc676e51a169dd89db65b1c5706b21b409 Mon Sep 17 00:00:00 2001 From: mritd Date: Tue, 5 Feb 2019 10:48:53 +0800 Subject: [PATCH 153/190] feat(init_ubuntu): update update Signed-off-by: mritd --- init_ubuntu.sh | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/init_ubuntu.sh b/init_ubuntu.sh index 33e671a..722e67f 100755 --- a/init_ubuntu.sh +++ b/init_ubuntu.sh @@ -4,13 +4,13 @@ set -e TZ='Asia/Shanghai' OZ_DOWNLOAD_URL='https://github.com/robbyrussell/oh-my-zsh.git' -OZ_CONFIG_DOWNLOAD_URL='https://mritdftp.b0.upaiyun.com/files/config/ohmyzsh.tar.gz' +OZ_CONFIG_DOWNLOAD_URL='https://git.io/fh9U2' OZ_SYNTAX_HIGHLIGHTING_DOWNLOAD_URL='https://github.com/zsh-users/zsh-syntax-highlighting.git' VIM_CONFIG_DOWNLOAD_URL='https://mritdftp.b0.upaiyun.com/files/config/vim.tar.gz' DOCKER_DEB="deb [arch=amd64] https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/ubuntu $(lsb_release -cs) stable" -DOCKER_CONFIG_DOWNLOAD_URL='https://mritdftp.b0.upaiyun.com/files/config/docker.tar.gz' -CTOP_DOWNLOAD_URL='https://mritdftp.b0.upaiyun.com/files/ctop/ctop-0.7.1-linux-amd64' -DOCKER_COMPOSE_DOWNLOAD_URL="https://get.daocloud.io/docker/compose/releases/download/1.21.0/docker-compose-`uname -s`-`uname -m`" +DOCKER_CONFIG_DOWNLOAD_URL='https://git.io/fh9Ui' +CTOP_DOWNLOAD_URL='https://github.com/bcicen/ctop/releases/download/v0.7.2/ctop-0.7.2-linux-amd64' +DOCKER_COMPOSE_DOWNLOAD_URL="https://github.com/docker/compose/releases/download/1.23.2/docker-compose-Linux-x86_64" if [ "$(lsb_release -cs)" == "bionic" ]; then systemctl stop cloud-config cloud-final cloud-init cloud-init-local @@ -39,14 +39,13 @@ function install_ohmyzsh(){ if [ ! -d ~/.oh-my-zsh ]; then git clone --depth=1 ${OZ_DOWNLOAD_URL} ~/.oh-my-zsh git clone ${OZ_SYNTAX_HIGHLIGHTING_DOWNLOAD_URL} ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting - wget ${OZ_CONFIG_DOWNLOAD_URL} - tar -zxvf ohmyzsh.tar.gz -C ~ && rm -f ohmyzsh.tar.gz + curl -L ${OZ_CONFIG_DOWNLOAD_URL} > ~/.zshrc chsh -s $(grep /zsh$ /etc/shells | tail -1) fi } function config_vim(){ - wget ${VIM_CONFIG_DOWNLOAD_URL} + curl -L ${VIM_CONFIG_DOWNLOAD_URL} > vim.tar.gz tar -zxvf vim.tar.gz -C ~ && rm -f vim.tar.gz } @@ -58,14 +57,13 @@ function install_docker(){ apt install docker-ce -y mv /etc/apt/sources.list.d/docker.list /etc/apt/sources.list.d/docker.list.bak mv /lib/systemd/system/docker.service /lib/systemd/system/docker.service.bak - wget ${DOCKER_CONFIG_DOWNLOAD_URL} - tar -zxvf docker.tar.gz -C /lib/systemd/system && rm -f docker.tar.gz + curl -L ${DOCKER_CONFIG_DOWNLOAD_URL} > /lib/systemd/system/docker.service systemctl daemon-reload systemctl restart docker } function install_ctop(){ - wget ${CTOP_DOWNLOAD_URL} -O /usr/local/bin/ctop + curl -L ${CTOP_DOWNLOAD_URL} > /usr/local/bin/ctop chmod +x /usr/local/bin/ctop } From 5cbdaf0be10da1885a1157a8e8b88cf35cdd484e Mon Sep 17 00:00:00 2001 From: mritd Date: Tue, 5 Feb 2019 10:56:28 +0800 Subject: [PATCH 154/190] feat(init_ubuntu): fix cloud init fix cloud init Signed-off-by: mritd --- init_ubuntu.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/init_ubuntu.sh b/init_ubuntu.sh index 722e67f..641e104 100755 --- a/init_ubuntu.sh +++ b/init_ubuntu.sh @@ -13,8 +13,11 @@ CTOP_DOWNLOAD_URL='https://github.com/bcicen/ctop/releases/download/v0.7.2/ctop- DOCKER_COMPOSE_DOWNLOAD_URL="https://github.com/docker/compose/releases/download/1.23.2/docker-compose-Linux-x86_64" if [ "$(lsb_release -cs)" == "bionic" ]; then - systemctl stop cloud-config cloud-final cloud-init cloud-init-local - systemctl disable cloud-config cloud-final cloud-init cloud-init-local + for svc in 'cloud-config cloud-final cloud-init cloud-init-local'; do + systemctl is-active --quiet ${svc} \ + && systemctl stop ${svc} \ + && systemctl disable ${svc} + done fi From d53203113fcbcc96cf814345c747fdfe1e101eac Mon Sep 17 00:00:00 2001 From: mritd Date: Wed, 6 Feb 2019 21:24:23 +0800 Subject: [PATCH 155/190] feat(vim): update vim config update vim config Signed-off-by: mritd --- init_ubuntu.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/init_ubuntu.sh b/init_ubuntu.sh index 641e104..5dd4571 100755 --- a/init_ubuntu.sh +++ b/init_ubuntu.sh @@ -6,7 +6,8 @@ TZ='Asia/Shanghai' OZ_DOWNLOAD_URL='https://github.com/robbyrussell/oh-my-zsh.git' OZ_CONFIG_DOWNLOAD_URL='https://git.io/fh9U2' OZ_SYNTAX_HIGHLIGHTING_DOWNLOAD_URL='https://github.com/zsh-users/zsh-syntax-highlighting.git' -VIM_CONFIG_DOWNLOAD_URL='https://mritdftp.b0.upaiyun.com/files/config/vim.tar.gz' +VIM_CONFIG_DOWNLOAD_URL='https://git.io/fh9rI' +VIM_PLUGINS_DOWNLOAD_URL='https://git.io/fh9r3' DOCKER_DEB="deb [arch=amd64] https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/ubuntu $(lsb_release -cs) stable" DOCKER_CONFIG_DOWNLOAD_URL='https://git.io/fh9Ui' CTOP_DOWNLOAD_URL='https://github.com/bcicen/ctop/releases/download/v0.7.2/ctop-0.7.2-linux-amd64' @@ -48,8 +49,12 @@ function install_ohmyzsh(){ } function config_vim(){ - curl -L ${VIM_CONFIG_DOWNLOAD_URL} > vim.tar.gz - tar -zxvf vim.tar.gz -C ~ && rm -f vim.tar.gz + curl -L ${VIM_CONFIG_DOWNLOAD_URL} > ~/.vimrc + mkdir -p ~/.vim/pack/mritd/{start/opt} + cd ~/.vim/pack/mritd/start + for addr in `curl -s ${VIM_PLUGINS_DOWNLOAD_URL}`; do + git clone ${addr} + done } function install_docker(){ From 94544bcf040819679c84a00c29f18419b2a2777b Mon Sep 17 00:00:00 2001 From: mritd Date: Wed, 6 Feb 2019 22:01:20 +0800 Subject: [PATCH 156/190] feat(vim): fix vim plugins fix vim plugins Signed-off-by: mritd --- init_ubuntu.sh | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/init_ubuntu.sh b/init_ubuntu.sh index 5dd4571..3f0f044 100755 --- a/init_ubuntu.sh +++ b/init_ubuntu.sh @@ -43,40 +43,41 @@ function install_ohmyzsh(){ if [ ! -d ~/.oh-my-zsh ]; then git clone --depth=1 ${OZ_DOWNLOAD_URL} ~/.oh-my-zsh git clone ${OZ_SYNTAX_HIGHLIGHTING_DOWNLOAD_URL} ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting - curl -L ${OZ_CONFIG_DOWNLOAD_URL} > ~/.zshrc - chsh -s $(grep /zsh$ /etc/shells | tail -1) + curl -sL ${OZ_CONFIG_DOWNLOAD_URL} > ~/.zshrc + chsh -sL $(grep /zsh$ /etc/shells | tail -1) fi } function config_vim(){ - curl -L ${VIM_CONFIG_DOWNLOAD_URL} > ~/.vimrc - mkdir -p ~/.vim/pack/mritd/{start/opt} + curl -sL ${VIM_CONFIG_DOWNLOAD_URL} > ~/.vimrc + mkdir -p ~/.vim/pack/mritd/{start,opt} cd ~/.vim/pack/mritd/start - for addr in `curl -s ${VIM_PLUGINS_DOWNLOAD_URL}`; do - git clone ${addr} + for addr in `curl -sL ${VIM_PLUGINS_DOWNLOAD_URL}`; do + echo "git clone => ${addr}" + git clone ${addr} > /dev/null 2>&1 done } function install_docker(){ - apt install apt-transport-https ca-certificates curl software-properties-common -y + apt install apt-transport-https ca-certificates software-properties-common -y curl -fsSL http://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | apt-key add - echo ${DOCKER_DEB} > /etc/apt/sources.list.d/docker.list apt update -y apt install docker-ce -y mv /etc/apt/sources.list.d/docker.list /etc/apt/sources.list.d/docker.list.bak mv /lib/systemd/system/docker.service /lib/systemd/system/docker.service.bak - curl -L ${DOCKER_CONFIG_DOWNLOAD_URL} > /lib/systemd/system/docker.service + curl -sL ${DOCKER_CONFIG_DOWNLOAD_URL} > /lib/systemd/system/docker.service systemctl daemon-reload systemctl restart docker } function install_ctop(){ - curl -L ${CTOP_DOWNLOAD_URL} > /usr/local/bin/ctop + curl -sL ${CTOP_DOWNLOAD_URL} > /usr/local/bin/ctop chmod +x /usr/local/bin/ctop } function install_dc(){ - curl -L ${DOCKER_COMPOSE_DOWNLOAD_URL} > /usr/local/bin/docker-compose + curl -sL ${DOCKER_COMPOSE_DOWNLOAD_URL} > /usr/local/bin/docker-compose chmod +x /usr/local/bin/docker-compose } From 400a7f35cdef2f27745309b75d63d17864a94f54 Mon Sep 17 00:00:00 2001 From: mritd Date: Wed, 6 Feb 2019 22:15:52 +0800 Subject: [PATCH 157/190] feat(vim): update pack dir name update pack dir name Signed-off-by: mritd --- init_ubuntu.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/init_ubuntu.sh b/init_ubuntu.sh index 3f0f044..d740c3f 100755 --- a/init_ubuntu.sh +++ b/init_ubuntu.sh @@ -50,8 +50,8 @@ function install_ohmyzsh(){ function config_vim(){ curl -sL ${VIM_CONFIG_DOWNLOAD_URL} > ~/.vimrc - mkdir -p ~/.vim/pack/mritd/{start,opt} - cd ~/.vim/pack/mritd/start + mkdir -p ~/.vim/pack/plugins/{start,opt} + cd ~/.vim/pack/plugins/start for addr in `curl -sL ${VIM_PLUGINS_DOWNLOAD_URL}`; do echo "git clone => ${addr}" git clone ${addr} > /dev/null 2>&1 From a7beac5fc4efbea0a19af0ef3d4326553fcd58a1 Mon Sep 17 00:00:00 2001 From: mritd Date: Tue, 12 Feb 2019 17:44:31 +0800 Subject: [PATCH 158/190] feat(init_ubuntu): add package add package Signed-off-by: mritd --- init_ubuntu.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/init_ubuntu.sh b/init_ubuntu.sh index d740c3f..5367564 100755 --- a/init_ubuntu.sh +++ b/init_ubuntu.sh @@ -25,7 +25,8 @@ fi function sysupdate(){ apt update -y apt upgrade -y - apt install wget curl vim zsh ctags git htop tzdata ipvsadm ipset -y + apt install wget curl vim zsh ctags git htop tzdata ipvsadm ipset \ + stress sysstat -y } function setlocale(){ From 039110019bb7050580dca7d5778af11571c0ce12 Mon Sep 17 00:00:00 2001 From: mritd Date: Tue, 12 Feb 2019 18:50:47 +0800 Subject: [PATCH 159/190] feat(inint_ubuntu): add sources.list add sources.list Signed-off-by: mritd --- init_ubuntu.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/init_ubuntu.sh b/init_ubuntu.sh index 5367564..b028fc3 100755 --- a/init_ubuntu.sh +++ b/init_ubuntu.sh @@ -3,6 +3,7 @@ set -e TZ='Asia/Shanghai' +SOURCES_LIST_URL='https://git.io/fhQKL' OZ_DOWNLOAD_URL='https://github.com/robbyrussell/oh-my-zsh.git' OZ_CONFIG_DOWNLOAD_URL='https://git.io/fh9U2' OZ_SYNTAX_HIGHLIGHTING_DOWNLOAD_URL='https://github.com/zsh-users/zsh-syntax-highlighting.git' @@ -23,10 +24,13 @@ fi function sysupdate(){ + mv /etc/apt/sources.list /etc/apt/sources.list.old + curl -sL ${SOURCES_LIST_URL} > /etc/apt/sources.list apt update -y apt upgrade -y apt install wget curl vim zsh ctags git htop tzdata ipvsadm ipset \ stress sysstat -y + ssh-keyscan github.com >> ~/.ssh/known_hosts } function setlocale(){ From 11005e0397be6a2ff8da5ede7517836e15147a98 Mon Sep 17 00:00:00 2001 From: mritd Date: Tue, 12 Feb 2019 19:58:05 +0800 Subject: [PATCH 160/190] feat(init_ubuntu): add docker.list add docker.list Signed-off-by: mritd --- init_ubuntu.sh | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/init_ubuntu.sh b/init_ubuntu.sh index b028fc3..fea4705 100755 --- a/init_ubuntu.sh +++ b/init_ubuntu.sh @@ -3,13 +3,13 @@ set -e TZ='Asia/Shanghai' -SOURCES_LIST_URL='https://git.io/fhQKL' +SOURCES_LIST_URL='https://git.io/fhQ6B' +DOCKER_LIST_URL='https://git.io/fhQ68' OZ_DOWNLOAD_URL='https://github.com/robbyrussell/oh-my-zsh.git' OZ_CONFIG_DOWNLOAD_URL='https://git.io/fh9U2' OZ_SYNTAX_HIGHLIGHTING_DOWNLOAD_URL='https://github.com/zsh-users/zsh-syntax-highlighting.git' VIM_CONFIG_DOWNLOAD_URL='https://git.io/fh9rI' VIM_PLUGINS_DOWNLOAD_URL='https://git.io/fh9r3' -DOCKER_DEB="deb [arch=amd64] https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/ubuntu $(lsb_release -cs) stable" DOCKER_CONFIG_DOWNLOAD_URL='https://git.io/fh9Ui' CTOP_DOWNLOAD_URL='https://github.com/bcicen/ctop/releases/download/v0.7.2/ctop-0.7.2-linux-amd64' DOCKER_COMPOSE_DOWNLOAD_URL="https://github.com/docker/compose/releases/download/1.23.2/docker-compose-Linux-x86_64" @@ -23,20 +23,19 @@ if [ "$(lsb_release -cs)" == "bionic" ]; then fi +function setlocale(){ + locale-gen --purge en_US.UTF-8 zh_CN.UTF-8 + echo 'LANG="en_US.UTF-8"' > /etc/default/locale + echo 'LANGUAGE="en_US:en"' >> /etc/default/locale +} + function sysupdate(){ mv /etc/apt/sources.list /etc/apt/sources.list.old curl -sL ${SOURCES_LIST_URL} > /etc/apt/sources.list apt update -y apt upgrade -y - apt install wget curl vim zsh ctags git htop tzdata ipvsadm ipset \ - stress sysstat -y - ssh-keyscan github.com >> ~/.ssh/known_hosts -} - -function setlocale(){ - locale-gen --purge en_US.UTF-8 zh_CN.UTF-8 - echo 'LANG="en_US.UTF-8"' > /etc/default/locale - echo 'LANGUAGE="en_US:en"' >> /etc/default/locale + apt install -y apt-transport-https ca-certificates software-properties-common \ + wget curl vim zsh ctags git htop tzdata ipvsadm ipset stress sysstat } function settimezone(){ @@ -64,9 +63,8 @@ function config_vim(){ } function install_docker(){ - apt install apt-transport-https ca-certificates software-properties-common -y + curl -sL ${DOCKER_LIST_URL} > /etc/apt/sources.list.d/docker.list curl -fsSL http://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | apt-key add - - echo ${DOCKER_DEB} > /etc/apt/sources.list.d/docker.list apt update -y apt install docker-ce -y mv /etc/apt/sources.list.d/docker.list /etc/apt/sources.list.d/docker.list.bak @@ -86,8 +84,8 @@ function install_dc(){ chmod +x /usr/local/bin/docker-compose } -sysupdate setlocale +sysupdate settimezone config_vim install_ohmyzsh From 3192cada7397beee2d28e8148a992c318887c538 Mon Sep 17 00:00:00 2001 From: mritd Date: Tue, 12 Feb 2019 20:23:46 +0800 Subject: [PATCH 161/190] feat(init_ubuntu): add disable_cloudinit, fix apt source list add disable_cloudinit, fix apt source list Signed-off-by: mritd --- init_ubuntu.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/init_ubuntu.sh b/init_ubuntu.sh index fea4705..1fcbd73 100755 --- a/init_ubuntu.sh +++ b/init_ubuntu.sh @@ -3,6 +3,7 @@ set -e TZ='Asia/Shanghai' +OS_RELEASE="$(lsb_release -cs)" SOURCES_LIST_URL='https://git.io/fhQ6B' DOCKER_LIST_URL='https://git.io/fhQ68' OZ_DOWNLOAD_URL='https://github.com/robbyrussell/oh-my-zsh.git' @@ -14,14 +15,13 @@ DOCKER_CONFIG_DOWNLOAD_URL='https://git.io/fh9Ui' CTOP_DOWNLOAD_URL='https://github.com/bcicen/ctop/releases/download/v0.7.2/ctop-0.7.2-linux-amd64' DOCKER_COMPOSE_DOWNLOAD_URL="https://github.com/docker/compose/releases/download/1.23.2/docker-compose-Linux-x86_64" -if [ "$(lsb_release -cs)" == "bionic" ]; then +function disable_cloudinit(){ for svc in 'cloud-config cloud-final cloud-init cloud-init-local'; do systemctl is-active --quiet ${svc} \ && systemctl stop ${svc} \ && systemctl disable ${svc} done -fi - +} function setlocale(){ locale-gen --purge en_US.UTF-8 zh_CN.UTF-8 @@ -31,7 +31,7 @@ function setlocale(){ function sysupdate(){ mv /etc/apt/sources.list /etc/apt/sources.list.old - curl -sL ${SOURCES_LIST_URL} > /etc/apt/sources.list + curl -sL ${SOURCES_LIST_URL} | sed "s@{{OS_RELEASE}}@${OS_RELEASE}@gi" > /etc/apt/sources.list apt update -y apt upgrade -y apt install -y apt-transport-https ca-certificates software-properties-common \ @@ -63,7 +63,7 @@ function config_vim(){ } function install_docker(){ - curl -sL ${DOCKER_LIST_URL} > /etc/apt/sources.list.d/docker.list + curl -sL ${DOCKER_LIST_URL} | sed "s@{{OS_RELEASE}}@${OS_RELEASE}@gi" > /etc/apt/sources.list.d/docker.list curl -fsSL http://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | apt-key add - apt update -y apt install docker-ce -y @@ -84,6 +84,7 @@ function install_dc(){ chmod +x /usr/local/bin/docker-compose } +disable_cloudinit setlocale sysupdate settimezone From d0d11bf6ac698f24cba0ecd1f2c4888e0fe1041f Mon Sep 17 00:00:00 2001 From: mritd Date: Tue, 12 Feb 2019 20:55:39 +0800 Subject: [PATCH 162/190] fix(init_ubuntu): fix zsh fix zsh Signed-off-by: mritd --- init_ubuntu.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init_ubuntu.sh b/init_ubuntu.sh index 1fcbd73..4c5683a 100755 --- a/init_ubuntu.sh +++ b/init_ubuntu.sh @@ -48,7 +48,7 @@ function install_ohmyzsh(){ git clone --depth=1 ${OZ_DOWNLOAD_URL} ~/.oh-my-zsh git clone ${OZ_SYNTAX_HIGHLIGHTING_DOWNLOAD_URL} ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting curl -sL ${OZ_CONFIG_DOWNLOAD_URL} > ~/.zshrc - chsh -sL $(grep /zsh$ /etc/shells | tail -1) + chsh -s $(grep /zsh$ /etc/shells | tail -1) fi } From ddae8eeada8029ac373abc336add5ca195a9d760 Mon Sep 17 00:00:00 2001 From: mritd Date: Wed, 13 Mar 2019 19:09:31 +0800 Subject: [PATCH 163/190] feat(init_ubuntu): add conntrack add conntrack Signed-off-by: mritd --- init_ubuntu.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init_ubuntu.sh b/init_ubuntu.sh index 4c5683a..00295c4 100755 --- a/init_ubuntu.sh +++ b/init_ubuntu.sh @@ -35,7 +35,7 @@ function sysupdate(){ apt update -y apt upgrade -y apt install -y apt-transport-https ca-certificates software-properties-common \ - wget curl vim zsh ctags git htop tzdata ipvsadm ipset stress sysstat + wget curl vim zsh ctags git htop tzdata conntrack ipvsadm ipset stress sysstat } function settimezone(){ From 27bacf780808bf88cedb192159dd4205897d2af2 Mon Sep 17 00:00:00 2001 From: mritd Date: Wed, 21 Aug 2019 13:28:31 +0800 Subject: [PATCH 164/190] feat(jvm-dns): add jvm-dns-ttl-policy.sh add jvm-dns-ttl-policy.sh Signed-off-by: mritd --- jvm-dns-ttl-policy.sh | 79 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100755 jvm-dns-ttl-policy.sh diff --git a/jvm-dns-ttl-policy.sh b/jvm-dns-ttl-policy.sh new file mode 100755 index 0000000..dfaf103 --- /dev/null +++ b/jvm-dns-ttl-policy.sh @@ -0,0 +1,79 @@ +#!/bin/sh + +if [ -z "${1}" ]; then + echo "Usage: ${0} --enable-security-manager" + exit 1 +fi + +target_image="${1}" + +dockerfile=" +FROM ${target_image} +WORKDIR /var/tmp +RUN printf ' \\ + public class DNSTTLPolicy { \\ + public static void main(String args[]) { \\ + System.out.printf(\"Implementation DNS TTL for JVM in Docker image based on '${target_image}' is %%d seconds\\\\n\", sun.net.InetAddressCachePolicy.get()); \\ + } \\ + }' >DNSTTLPolicy.java +RUN javac DNSTTLPolicy.java -XDignore.symbol.file +CMD java DNSTTLPolicy +ENTRYPOINT java DNSTTLPolicy +" + +dockerfile_security_manager=" +FROM ${target_image} +WORKDIR /var/tmp +RUN printf ' \\ + public class DNSTTLPolicy { \\ + public static void main(String args[]) { \\ + System.out.printf(\"Implementation DNS TTL for JVM in Docker image based on '${target_image}' (with security manager enabled) is %%d seconds\\\\n\", sun.net.InetAddressCachePolicy.get()); \\ + } \\ + }' >DNSTTLPolicy.java +RUN printf ' \\ + grant { \\ + permission java.security.AllPermission; \\ + };' >all-permissions.policy +RUN javac DNSTTLPolicy.java -XDignore.symbol.file +CMD java -Djava.security.manager -Djava.security.policy==all-permissions.policy DNSTTLPolicy +ENTRYPOINT java -Djava.security.manager -Djava.security.policy==all-permissions.policy DNSTTLPolicy +" + +target_dockerfile="${dockerfile}" +if [ -n "${2}" ] && [ "${2}" == "--enable-security-manager" ]; then + target_dockerfile="${dockerfile_security_manager}" +fi + +tag_name="jvm-dns-ttl-policy" +output_file="$(mktemp)" + +function cleanup() { + rm "${output_file}" + docker rmi "${tag_name}" >/dev/null +} + +trap "cleanup; exit" SIGHUP SIGINT SIGTERM + +echo "Building Docker image based on ${target_image} ..." >&2 +docker build -t "${tag_name}" - <<<"${target_dockerfile}" &>"${output_file}" + +if [ "$?" -ne 0 ]; then + >&2 echo "Error building test image:" + cat "${output_file}" + cleanup + exit 1 +fi + +echo "Testing DNS TTL ..." >&2 +docker run --rm "${tag_name}" &>"${output_file}" + +if [ "$?" -ne 0 ]; then + >&2 echo "Error running test image:" + cat "${output_file}" + cleanup + exit 1 +fi + +cat "${output_file}" + +cleanup From 1743872277f9ea8bbabc418ebea012961d0218ff Mon Sep 17 00:00:00 2001 From: mritd Date: Tue, 10 Sep 2019 14:34:33 +0800 Subject: [PATCH 165/190] add git-show-big-files.sh --- git-show-big-files.sh | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 git-show-big-files.sh diff --git a/git-show-big-files.sh b/git-show-big-files.sh new file mode 100644 index 0000000..407cea9 --- /dev/null +++ b/git-show-big-files.sh @@ -0,0 +1,31 @@ +#!/bin/bash +#set -x + +# Shows you the largest objects in your repo's pack file. +# Written for osx. +# +# @see http://stubbisms.wordpress.com/2009/07/10/git-script-to-show-largest-pack-objects-and-trim-your-waist-line/ +# @author Antony Stubbs + +# set the internal field spereator to line break, so that we can iterate easily over the verify-pack output +IFS=$'\n'; + +# list all objects including their size, sort by size, take top 10 +objects=`git verify-pack -v .git/objects/pack/pack-*.idx | grep -Ev "non delta|chain length|git/objects" | tr -s " " | sort -k3gr | head -n30` + +echo "All sizes are in kB's. The pack column is the size of the object, compressed, inside the pack file." + +output="size,SHA,location" +for y in $objects +do + # extract the size in KB + size=$((`echo $y | cut -f 3 -d ' '`/1024)) + # extract the SHA + sha=`echo $y | cut -f 1 -d ' '` + # find the objects location in the repository tree + other=`git rev-list --all --objects | grep $sha` + #lineBreak=`echo -e "\n"` + output="${output}\n${size},${other}" +done + +echo -e $output | column -t -s ', ' From 3d72647b4125f4c571545b4b7d9cde21d10a5242 Mon Sep 17 00:00:00 2001 From: mritd Date: Tue, 10 Sep 2019 14:47:31 +0800 Subject: [PATCH 166/190] Create git-show-blob.sh --- git-show-blob.sh | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 git-show-blob.sh diff --git a/git-show-blob.sh b/git-show-blob.sh new file mode 100644 index 0000000..4543bfb --- /dev/null +++ b/git-show-blob.sh @@ -0,0 +1,9 @@ +#!/bin/sh +obj_name="$1" +shift +git log "$@" --pretty=format:'%T %h %s' \ +| while read tree commit subject ; do + if git ls-tree -r $tree | grep -q "$obj_name" ; then + echo $commit "$subject" + fi +done From 9761411677c5fe4625f941192da0338295f8fdd6 Mon Sep 17 00:00:00 2001 From: mritd Date: Fri, 11 Oct 2019 14:03:27 +0800 Subject: [PATCH 167/190] feat(init_ubuntu): update tz config update tz config Signed-off-by: mritd --- init_ubuntu.sh | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) mode change 100755 => 100644 init_ubuntu.sh diff --git a/init_ubuntu.sh b/init_ubuntu.sh old mode 100755 new mode 100644 index 00295c4..d58eda5 --- a/init_ubuntu.sh +++ b/init_ubuntu.sh @@ -24,14 +24,20 @@ function disable_cloudinit(){ } function setlocale(){ - locale-gen --purge en_US.UTF-8 zh_CN.UTF-8 - echo 'LANG="en_US.UTF-8"' > /etc/default/locale - echo 'LANGUAGE="en_US:en"' >> /etc/default/locale + if [ ! -f /etc/locale.gen.bak ]; then + cp /etc/locale.gen /etc/locale.gen.bak + echo 'en_US.UTF-8 UTF-8' > /etc/locale.gen + echo 'zh_CN.UTF-8 UTF-8' >> /etc/locale.gen + fi + locale-gen --purge + localectl set-locale LANG=en_US.UTF-8 } function sysupdate(){ - mv /etc/apt/sources.list /etc/apt/sources.list.old - curl -sL ${SOURCES_LIST_URL} | sed "s@{{OS_RELEASE}}@${OS_RELEASE}@gi" > /etc/apt/sources.list + if [ ! -f /etc/apt/sources.list.bak ]; then + cp /etc/apt/sources.list /etc/apt/sources.list.old + curl -sL ${SOURCES_LIST_URL} | sed "s@{{OS_RELEASE}}@${OS_RELEASE}@gi" > /etc/apt/sources.list + fi apt update -y apt upgrade -y apt install -y apt-transport-https ca-certificates software-properties-common \ @@ -39,8 +45,7 @@ function sysupdate(){ } function settimezone(){ - ln -sf /usr/share/zoneinfo/${TZ} /etc/localtime - echo ${TZ} > /etc/timezone + timedatectl set-timezone ${TZ} } function install_ohmyzsh(){ From a896986493aac2e9a7b2730bcdae9bcbbb50ee4b Mon Sep 17 00:00:00 2001 From: mritd Date: Sat, 26 Oct 2019 15:03:57 +0800 Subject: [PATCH 168/190] feat(all): clean clean Signed-off-by: mritd --- README.md | 0 acme_webserver.sh | 22 --- activate_mybatis.sh | 11 -- backup.sh | 7 - build_rpm_tool.sh | 303 --------------------------------------- download_kube_image.sh | 44 ------ fabio.sh | 70 --------- flush_repo.sh | 2 - git-show-big-files.sh | 0 git-show-blob.sh | 0 init_ubuntu.sh | 0 install_docker.sh | 15 -- install_dockercompose.sh | 7 - kernel_update.sh | 13 -- mac_ntfs.sh | 7 - signature_rpm.sh | 29 ---- syncrpm.sh | 23 --- wol.py | 46 ------ 18 files changed, 599 deletions(-) mode change 100644 => 100755 README.md delete mode 100755 acme_webserver.sh delete mode 100755 activate_mybatis.sh delete mode 100755 backup.sh delete mode 100755 build_rpm_tool.sh delete mode 100755 download_kube_image.sh delete mode 100755 fabio.sh delete mode 100755 flush_repo.sh mode change 100644 => 100755 git-show-big-files.sh mode change 100644 => 100755 git-show-blob.sh mode change 100644 => 100755 init_ubuntu.sh delete mode 100755 install_docker.sh delete mode 100755 install_dockercompose.sh delete mode 100755 kernel_update.sh delete mode 100755 mac_ntfs.sh delete mode 100755 signature_rpm.sh delete mode 100755 syncrpm.sh delete mode 100755 wol.py diff --git a/README.md b/README.md old mode 100644 new mode 100755 diff --git a/acme_webserver.sh b/acme_webserver.sh deleted file mode 100755 index fab8033..0000000 --- a/acme_webserver.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash - -yum update -y - -yum install -y nc crontabs - -curl https://get.acme.sh | bash - -mkdir -p /home/www - -docker run -dt --name acme -p 80:80 -v /home/www:/usr/share/nginx/html nginx:1.10.1-alpine - -~/.acme.sh/acme.sh --issue -d mritd.me -d www.mritd.me -w /tmp/acme --force - -docker rm -f acme - -~/.acme.sh/acme.sh --installcert -d mritd.me -d www.mritd.me \ - --keypath /etc/nginx/ssl/mritd.me.key \ - --certpath /etc/nginx/ssl/mritd.me.cer \ - --reloadcmd "cd /root/docker/mritd && docker-compose restart" - -~/.acme.sh/acme.sh --upgrade --auto-upgrade diff --git a/activate_mybatis.sh b/activate_mybatis.sh deleted file mode 100755 index cb826df..0000000 --- a/activate_mybatis.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -config_path=`find ~ -name "mybatis.xml" 2>/dev/null | tail -n 1` - -if [ "$config_path" == "" ];then - config_path=`sudo find / -name "mybatis.xml" 2>/dev/null | tail -n 1` -fi - -echo "127.0.0.1 www.codesmagic.com" | sudo tee -a /etc/hosts -sudo sed -i 's/KEY=\"\"/KEY=\"305c300d06092a864886f70d0101010500034b003048024100878e6bea07d7052499419efe4ed4382f426dc5ca2d01140f896a6d0566526c6757ff591347d888bd032f94ce92609ce0cc349de0ba9043dc3163f9667438a14d0203010001\"/g' $config_path -sudo sed -i 's/RESULT=\"\"/RESULT=\"414834456369b9329793f0b42c6c0af67d00516c7ceb136ad221fa0355dc2cd611ed1bcd36b61d00ba7e587d253c1de145831cd0d65b891c9dc34430f9e69c59\"/g' $config_path diff --git a/backup.sh b/backup.sh deleted file mode 100755 index 77a79ee..0000000 --- a/backup.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -rm -rf /backup >& /dev/null && mkdir /backup - -cd / && tar -zcvf root.tar.gz root && mv root.tar.gz /backup -cd / && tar -zcvf data.tar.gz data && mv data.tar.gz /backup -cd /etc && tar -zcvf nginx.tar.gz nginx && mv nginx.tar.gz /backup diff --git a/build_rpm_tool.sh b/build_rpm_tool.sh deleted file mode 100755 index e8c7814..0000000 --- a/build_rpm_tool.sh +++ /dev/null @@ -1,303 +0,0 @@ -#!/bin/bash - -# This script is used to create etcd | flannel | kubernetes RPM -# You can use the "./build_rpm_tool.sh etcd VERSION" to create a etcd RPM -# Kubernetes and flannel use the same command to create the RPM - -set -e - -targetModel=$1 -version=$2 - -function _checkInput(){ - if [ -z "$targetModel" ] || [ -z "$version" ];then - echo -e "\033[33mtargetModel or version is blank!\033[0m" - echo -e "\033[32mUse ./build_rpm_tool.sh etcd|flannel|kubernetes VSERSION to build rpm\033[0m" - echo -e "\033[32mexample: ./build_rpm_tool.sh etcd 3.0.7\033[0m" - exit 1 - fi - - if [ ! "$targetModel" == "etcd" ] && [ ! "$targetModel" == "flannel" ] && [ ! "$targetModel" == "kubernetes" ] && [ ! "$targetModel" == "k8s" ]; then - echo -e "\033[31mThe script only support etcd|flannel|kubernetes!\033[0m" - echo -e "\033[32mUse build_rpm.sh etcd|flannel|kubernetes VSERSION to build rpm\033[0m" - echo -e "\033[32mexample: ./build_rpm_tool.sh etcd 3.0.7\033[0m" - exit 1 - fi -} - - -function _prebuild(){ - - PATH=$PATH:/usr/local/rvm/bin:/usr/local/rvm/rubies/ruby-2.3.0/bin - - echo -e "\033[33mclean old files!\033[0m" - rm -rf build_tmp - echo -e "\033[32mbuild $targetModel rpm!\033[0m" - echo -e "\033[32mtarget version: $version\033[0m" - echo -e "\033[32mcreate tmp dir...\033[0m" - if [ ! -d build_rpms ]; then - mkdir build_rpms - fi - mkdir build_tmp && cd build_tmp - - _update_installdep - if [ -n `which fpm` ]; then - _install_ruby_fpm - else - echo -e "\033[33mfpm exist!\033[0m" - fi -} - - -function _update_installdep(){ - # update - echo -e "\033[32msystem updating...\033[0m" - yum update -y - yum upgrade -y - - echo -e "\033[32minstall build tools...\033[0m" - yum install wget which zlib zlib-devel curl git rpm-build \ - epel-release yum-utils libyaml-devel glibc-headers autoconf \ - gcc-c++ glibc-devel readline-devel libffi-devel openssl-devel \ - make automake libtool bison sqlite-devel -y -} - -function _install_ruby_fpm(){ - - # install rvm and ruby - echo -e "\033[32minstall rvm...\033[0m" - curl -sSL https://rvm.io/mpapis.asc | gpg2 --import - - curl -sSL https://get.rvm.io | bash -s stable - echo "ruby_url=https://cache.ruby-china.org/pub/ruby" >> /usr/local/rvm/user/db - rvm requirements - - echo -e "\033[32minstall ruby...\033[0m" - rvm install 2.3.0 - rvm use 2.3.0 --default - - echo -e "\033[32minstall bundler...\033[0m" - gem install bundler - - echo -e "\033[32minstall fpm...\033[0m" - gem install fpm -} - - -function unpackagerpm(){ - echo -e "\033[32munpackage rpm...\033[0m" - rpm2cpio *.rpm | cpio -idmv - rm -f *.rpm -} - -function build_etcd(){ - echo -e "\033[32mdownload etcd release package...\033[0m" - wget https://github.com/coreos/etcd/releases/download/v$version/etcd-v$version-linux-amd64.tar.gz - tar -zxvf etcd-v$version-linux-amd64.tar.gz - if [ ! -f etcd-v$version-linux-amd64.tar.gz ]; then - echo -e "\033[31merror: download etcd release package failed!\033[0m" - exit 1 - fi - - echo -e "\033[32mdownload etcd old rpm...\033[0m" - yumdownloader etcd - - unpackagerpm - - echo -e "\033[32mreplace new files...\033[0m" - rm -f usr/bin/* - cp etcd-v$version-linux-amd64/{etcd,etcdctl} usr/bin - - echo -e "\033[32mmake rpm scripts...\033[0m" - tee preinstall.sh </dev/null || groupadd -r etcd -getent passwd etcd >/dev/null || useradd -r -g etcd -d /var/lib/etcd \\ - -s /sbin/nologin -c "etcd user" etcd -EOF - - tee postinstall.sh </dev/null 2>&1 || : -fi -chown -R etcd.etcd /var/lib/etcd -EOF - - tee preuninstall.sh </dev/null 2>&1 || : -EOF - - echo -e "\033[32mmake new rpm...\033[0m" - fpm -s dir -t rpm -n "etcd" -v $version --pre-install preinstall.sh --post-install postinstall.sh --pre-uninstall preuninstall.sh --post-uninstall postuninstall.sh etc usr var - -} - - -function build_flannel(){ - echo -e "\033[32mdownload flannel release package...\033[0m" - wget https://github.com/coreos/flannel/releases/download/v$version/flannel-v$version-linux-amd64.tar.gz - tar -zxvf flannel-v$version-linux-amd64.tar.gz - if [ ! -f flannel-v$version-linux-amd64.tar.gz ]; then - echo -e "\033[31merror: download flannel release package failed!\033[0m" - exit 1 - fi - - echo -e "\033[32mdownload flannel old rpm...\033[0m" - yumdownloader flannel - - unpackagerpm - - echo -e "\033[32mreplace new files...\033[0m" - rm -f usr/bin/flanneld - cp flanneld usr/bin/flanneld - - rm -f usr/libexec/flannel/mk-docker-opts.sh - cp mk-docker-opts.sh usr/libexec/flannel/mk-docker-opts.sh - - echo -e "\033[32mmake rpm scripts...\033[0m" - tee postinstall.sh </dev/null 2>&1 || : -fi -EOF - - tee preuninstall.sh </dev/null 2>&1 || : -if [ \$1 -ge 1 ] ; then - # Package upgrade, not uninstall - systemctl try-restart flanneld.service >/dev/null 2>&1 || : -fi -EOF - - echo -e "\033[32mmake new rpm...\033[0m" - fpm -s dir -t rpm -n "flannel" -v $version --post-install postinstall.sh --pre-uninstall preuninstall.sh --post-uninstall postuninstall.sh etc run usr - -} - - -function build_k8s(){ - - BASEPACKAGE=kubernetes-1.5.1-git82450d0.el7.centos.x86_64.rpm - - echo -e "\033[32mdownload k8s release package...\033[0m" - - allBins=(hyperkube kube-apiserver kube-controller-manager kubectl kube-dns kubelet kube-proxy kube-scheduler) - for binName in ${allBins[@]};do - echo -e "\033[32mdownload $binName...\033[0m" - wget https://storage.googleapis.com/kubernetes-release/release/v$version/bin/linux/amd64/$binName -O $binName - if [ ! -f $binName ]; then - echo -e "\033[31merrot: download $binName failed!\033[0m" - exit 1 - fi - chmod +x $binName - echo -e "\033[32m$binName download success...\033[0m" - done - - echo -e "\033[32mdownload old kubernetes...\033[0m" - wget http://mritdftp.b0.upaiyun.com/rpms/$BASEPACKAGE - if [ ! -f $BASEPACKAGE ]; then - echo -e "\033[31merror: download kubernetes old rpm failed!\033[0m" - exit 1 - fi - - unpackagerpm - - echo -e "\033[32mreplace new files...\033[0m" - rm -f usr/bin/* - cp hyperkube kube-apiserver kube-controller-manager kubectl kube-dns kubelet kube-proxy kube-scheduler usr/bin/ - - echo -e "\033[32mmake rpm scripts...\033[0m" - tee preinstall.sh </dev/null || groupadd -r kube -getent passwd kube >/dev/null || useradd -r -g kube -d / -s /sbin/nologin \\ - -c "Kubernetes user" kube -EOF - - tee postinstall.sh </dev/null 2>&1 || : -fi -EOF - - tee preuninstall.sh </dev/null 2>&1 || : -EOF - - echo -e "\033[32mmake new rpm...\033[0m" - fpm -s dir -t rpm -n "kubernetes" -v $version --pre-install preinstall.sh --post-install postinstall.sh --pre-uninstall preuninstall.sh --post-uninstall postuninstall.sh etc usr var - -} - -function build(){ - - if [ "$targetModel" == "etcd" ];then - build_etcd - elif [ "$targetModel" == "flannel" ];then - build_flannel - elif [ "$targetModel" == "k8s" ] || [ "$targetModel" == "kubernetes" ]; then - build_k8s - fi -} - -function success_zhaungbi(){ - - echo -e "\033[32mmove rpms and remove tmp dir...\033[0m" - mv *.rpm ../build_rpms && cd ../ && rm -rf build_tmp - echo -e "\033[32mbuild seccess!\033[0m" - - - # 谦(zhuang)虚(bi) - # 88 88 - # "" ,d 88 - # 88 88 - # 88,dPYba,,adPYba, 8b,dPPYba, 88 MM88MMM ,adPPYb,88 - # 88P' "88" "8a 88P' "Y8 88 88 a8" `Y88 - # 88 88 88 88 88 88 8b 88 - # 88 88 88 88 88 88, "8a, ,d88 - # 88 88 88 88 88 "Y888 `"8bbdP"Y8 - - echo -e "" - echo -e "\033[32m 88 88\033[0m" - echo -e "\033[32m \"\" ,d 88 \033[0m" - echo -e "\033[32m 88 88\033[0m" - echo -e "\033[32m88,dPYba,,adPYba, 8b,dPPYba, 88 MM88MMM ,adPPYb,88\033[0m" - echo -e "\033[32m88P' \"88\" \"8a 88P' \"Y8 88 88 a8\" \`Y88\033[0m" - echo -e "\033[32m88 88 88 88 88 88 8b 88 \033[0m" - echo -e "\033[32m88 88 88 88 88 88, \"8a, ,d88\033[0m" - echo -e "\033[32m88 88 88 88 88 \"Y888 \`\"8bbdP\"Y8\033[0m" - echo -e "" - echo -e "" -} - - - -_checkInput -_prebuild -build -success_zhaungbi diff --git a/download_kube_image.sh b/download_kube_image.sh deleted file mode 100755 index 3203412..0000000 --- a/download_kube_image.sh +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/bash - -# This script is used to download some images and packaged kubernetes used - -KUBEVERSION=$1 - -images=(kube-proxy-amd64:$KUBEVERSION kube-discovery-amd64:1.0 kubedns-amd64:1.7 kube-scheduler-amd64:$KUBEVERSION kube-controller-manager-amd64:$KUBEVERSION kube-apiserver-amd64:$KUBEVERSION etcd-amd64:3.0.14-kubeadm kube-dnsmasq-amd64:1.3 exechealthz-amd64:1.1 pause-amd64:3.0 kubernetes-dashboard-amd64:v1.5.0) - -echo -e "\033[33mclean old files!\033[0m" -rm -rf ~/kube_images > /dev/null 2>&1 -rm -f ~/kube_images-$KUBEVERSION.tar.gz > /dev/null 2>&1 - -echo -e "\033[32mcreate download directory...\033[0m" -mkdir ~/kube_images - -for imageName in ${images[@]} ; do - echo -e "\033[32mpull image: $imageName...\033[0m" - docker pull gcr.io/google_containers/$imageName - if [ ! "$?"=="0" ]; then - echo -e "\033[31merror: pull image: $imageName failed!\033[0m" - exit 1 - fi - echo -e "\033[32msave image: $imageName...\033[0m" - docker save gcr.io/google_containers/$imageName > ~/kube_images/$imageName.tar - - if [ -f ~/kube_images/$imageName.tar ]; then - echo -e "\033[32mdownload $imageName image success!\033[0m" - else - echo -e "\033[31mdownload $imageName image failed!\033[0m" - exit 1 - fi -done - -echo -e "\033[32mcreate images package...\033[0m" -(cd ~/kube_images && tar -zcvf ~/kube_images-$KUBEVERSION.tar.gz *.tar) - -if [ -f ~/kube_images-$KUBEVERSION.tar.gz ]; then - echo -e "\033[32mcreate images package success!\033[0m" - echo -e "\033[32mclean temp files...\033[0m" - rm -rf ~/kube_images -else - echo -e "\033[31merror: create images package failed!\033[0m" - exit 1 -fi diff --git a/fabio.sh b/fabio.sh deleted file mode 100755 index 179641c..0000000 --- a/fabio.sh +++ /dev/null @@ -1,70 +0,0 @@ -#!/bin/bash - -set -e - -FABIO_VERSION="1.5.8" -FABIO_DONWLOAD_URL="https://github.com/fabiolb/fabio/releases/download/v${FABIO_VERSION}/fabio-${FABIO_VERSION}-go1.10-linux_amd64" - -preinstall(){ - getent group fabio >/dev/null || groupadd -r fabio - getent passwd fabio >/dev/null || useradd -r -g fabio -d /var/lib/fabio -s /sbin/nologin -c "fabio user" fabio - if [ ! -d /etc/fabio ]; then - mkdir /etc/fabio - fi -} - -postinstall(){ - # Initial installation - systemctl --no-reload preset fabio.service >/dev/null 2>&1 || : - systemctl enable fabio -} - -preuninstall(){ - # Package removal, not upgrade - systemctl --no-reload disable --now fabio.service > /dev/null 2>&1 || : -} - -install(){ - wget ${FABIO_DONWLOAD_URL} -O /usr/local/bin/fabio - chmod +x /usr/local/bin/fabio - wget https://raw.githubusercontent.com/fabiolb/fabio/master/fabio.properties -O /etc/fabio/fabio.properties - cat >/lib/systemd/system/fabio.service < /usr/local/bin/docker-compose - -chmod +x /usr/local/bin/docker-compose - -echo "alias dc='docker-compose'" >> ~/.zshrc diff --git a/kernel_update.sh b/kernel_update.sh deleted file mode 100755 index 45403d4..0000000 --- a/kernel_update.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash - -# import key -rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org - -# install elrepo repo -rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm - -# install kernel -yum --enablerepo=elrepo-kernel install kernel-lt kernel-lt-headers kernel-lt-devel -y - -# modify grub -grub2-set-default 0 diff --git a/mac_ntfs.sh b/mac_ntfs.sh deleted file mode 100755 index b5f7a46..0000000 --- a/mac_ntfs.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -brew cask install osxfuse -brew install ntfs-3g - -sudo mv /sbin/mount_ntfs /sbin/mount_ntfs.bak -sudo ln -s /usr/local/bin/ntfs-3g /sbin/mount_ntfs diff --git a/signature_rpm.sh b/signature_rpm.sh deleted file mode 100755 index 8950b39..0000000 --- a/signature_rpm.sh +++ /dev/null @@ -1,29 +0,0 @@ -#/bin/bash - -set -e - -RPM_DIR=$1 - -if [ "$RPM_DIR" == "" ];then - echo -e "\033[31mError: RPM_DIR is blank!\033[0m" - exit 1 -fi -#yum install rpm-sign -y - -# clean old files -#rm -f /data/repo/centos/7/x86_64/kubernetes-* - -# signature rpms -echo %_signature gpg > ~/.rpmmacros -echo "%_gpg_name mritd" >> ~/.rpmmacros - -for rpmName in `ls ${RPM_DIR}/*.rpm`; do - rpm --addsign $rpmName - cp -f $rpmName /data/repo/centos/7/x86_64 -done - -# create repodata -`pwd`/flush_repo.sh - -# sync cdn -`pwd`/syncrpm.sh diff --git a/syncrpm.sh b/syncrpm.sh deleted file mode 100755 index 4114166..0000000 --- a/syncrpm.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash - -set -e - -FORCEPUSH=$1 - -# clean old files -upx rm centos/7/x86_64/\* -upx rm centos/7/x86_64/repodata/\* - -# waiting cdn clean cache -echo "Wating cdn sync:" -if ! [ "$FORCEPUSH" == "-f" ];then - for i in `seq -w 120 -1 1`;do - echo -ne "\033[1;31;32m\b\b\b$i\033[0m"; - sleep 1; - done -fi - -# sync rpm -cd /data/repo/centos/7/x86_64/ && for rpmName in `ls *.rpm`;do upx put $rpmName centos/7/x86_64/;done -cd /data/repo/centos/7/x86_64/repodata/ && for repodata in `ls`;do upx put $repodata centos/7/x86_64/repodata/;done - diff --git a/wol.py b/wol.py deleted file mode 100755 index ae78a09..0000000 --- a/wol.py +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/env python -#coding=utf-8 - -import socket, sys -import struct -def to_hex_int(s): - return int(s.upper(), 16) - -dest = ('192.168.1.255', 9) - -if len(sys.argv) < 2: - print("usage: %s " % sys.argv[0]) - sys.exit() - -mac = sys.argv[1] - -spliter = "" -if mac.count(":") == 5: spliter = ":" -if mac.count("-") == 5: spliter = "-" - -if spliter == "": - print("MAC address should be like XX:XX:XX:XX:XX:XX / XX-XX-XX-XX-XX-XX") - sys.exit() - -parts = mac.split(spliter) -a1 = to_hex_int(parts[0]) -a2 = to_hex_int(parts[1]) -a3 = to_hex_int(parts[2]) -a4 = to_hex_int(parts[3]) -a5 = to_hex_int(parts[4]) -a6 = to_hex_int(parts[5]) -addr = [a1, a2, a3, a4, a5, a6] - -packet = chr(255) + chr(255) + chr(255) + chr(255) + chr(255) + chr(255) - -for n in range(0,16): - for a in addr: - packet = packet + chr(a) - -packet = packet + chr(0) + chr(0) + chr(0) + chr(0) + chr(0) + chr(0) - -s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) -s.setsockopt(socket.SOL_SOCKET,socket.SO_BROADCAST,1) -s.sendto(packet,dest) - -print("WOL packet %d bytes sent !" % len(packet)) From df763d817bf18f7ea4b7269be8dafa8dc92daca9 Mon Sep 17 00:00:00 2001 From: mritd Date: Sat, 26 Oct 2019 15:04:54 +0800 Subject: [PATCH 169/190] docs(README): remove executable permissions remove executable permissions Signed-off-by: mritd --- README.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 README.md diff --git a/README.md b/README.md old mode 100755 new mode 100644 From 04a1b1a60efbc99ceb516ed923214b076f3cfd15 Mon Sep 17 00:00:00 2001 From: mritd Date: Tue, 29 Oct 2019 17:09:03 +0800 Subject: [PATCH 170/190] feat(coredns): add install coredns add install coredns Signed-off-by: mritd --- install_coredns.sh | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100755 install_coredns.sh diff --git a/install_coredns.sh b/install_coredns.sh new file mode 100755 index 0000000..7c3fb75 --- /dev/null +++ b/install_coredns.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +set -e + +VERSION="${1}" + +if [ -z "${VERSION}" ]; then + VERSION="1.6.4" + echo "No CoreDNS version specified, use default version: 1.6.4!" +fi + +COREDNS_URL="https://github.com/coredns/coredns/releases/download/v${VERSION}/coredns_${VERSION}_linux_amd64.tgz" +COREDNS_CONF="https://raw.githubusercontent.com/mritd/config/master/coredns/Corefile" +SYSUSERS_CONF="https://raw.githubusercontent.com/coredns/deployment/master/systemd/coredns-sysusers.conf" +TEMPFILES_CONF="https://raw.githubusercontent.com/coredns/deployment/master/systemd/coredns-tmpfiles.conf" +SERVICE_CONF="https://raw.githubusercontent.com/coredns/deployment/master/systemd/coredns.service" + +curl -fsSL ${COREDNS_URL} > coredns.tar.gz +curl -fsSL ${SYSUSERS_CONF} > /usr/lib/sysusers.d/coredns-sysusers.conf +curl -fsSL ${TEMPFILES_CONF} > /usr/lib/tmpfiles.d/coredns-tmpfiles.conf +curl -fsSL ${SERVICE_CONF} > /lib/systemd/system/coredns.service + +tar -zxf coredns.tar.gz --strip-components=1 -C /usr/bin +systemd-sysusers +systemd-tmpfiles --create +systemctl daemon-reload + +mkdir -p /etc/coredns +curl -fsSL ${COREDNS_CONF} > /etc/coredns/Corefile +touch /etc/coredns/hosts + +rm -f coredns.tar.gz From a4540557b59a0bad87cfcf5c42fad530d515ead2 Mon Sep 17 00:00:00 2001 From: mritd Date: Tue, 3 Dec 2019 11:18:46 +0800 Subject: [PATCH 171/190] feat(init_ubuntu): fix curl fix curl Signed-off-by: mritd --- init_ubuntu.sh | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/init_ubuntu.sh b/init_ubuntu.sh index d58eda5..57dde9c 100755 --- a/init_ubuntu.sh +++ b/init_ubuntu.sh @@ -36,12 +36,12 @@ function setlocale(){ function sysupdate(){ if [ ! -f /etc/apt/sources.list.bak ]; then cp /etc/apt/sources.list /etc/apt/sources.list.old - curl -sL ${SOURCES_LIST_URL} | sed "s@{{OS_RELEASE}}@${OS_RELEASE}@gi" > /etc/apt/sources.list + curl -fsSL ${SOURCES_LIST_URL} | sed "s@{{OS_RELEASE}}@${OS_RELEASE}@gi" > /etc/apt/sources.list fi apt update -y apt upgrade -y apt install -y apt-transport-https ca-certificates software-properties-common \ - wget curl vim zsh ctags git htop tzdata conntrack ipvsadm ipset stress sysstat + wget vim zsh git htop tzdata conntrack ipvsadm ipset stress sysstat } function settimezone(){ @@ -52,40 +52,40 @@ function install_ohmyzsh(){ if [ ! -d ~/.oh-my-zsh ]; then git clone --depth=1 ${OZ_DOWNLOAD_URL} ~/.oh-my-zsh git clone ${OZ_SYNTAX_HIGHLIGHTING_DOWNLOAD_URL} ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting - curl -sL ${OZ_CONFIG_DOWNLOAD_URL} > ~/.zshrc + curl -fsSL ${OZ_CONFIG_DOWNLOAD_URL} > ~/.zshrc chsh -s $(grep /zsh$ /etc/shells | tail -1) fi } function config_vim(){ - curl -sL ${VIM_CONFIG_DOWNLOAD_URL} > ~/.vimrc + curl -fsSL ${VIM_CONFIG_DOWNLOAD_URL} > ~/.vimrc mkdir -p ~/.vim/pack/plugins/{start,opt} cd ~/.vim/pack/plugins/start - for addr in `curl -sL ${VIM_PLUGINS_DOWNLOAD_URL}`; do + for addr in `curl -fsSL ${VIM_PLUGINS_DOWNLOAD_URL}`; do echo "git clone => ${addr}" git clone ${addr} > /dev/null 2>&1 done } function install_docker(){ - curl -sL ${DOCKER_LIST_URL} | sed "s@{{OS_RELEASE}}@${OS_RELEASE}@gi" > /etc/apt/sources.list.d/docker.list + curl -fsSL ${DOCKER_LIST_URL} | sed "s@{{OS_RELEASE}}@${OS_RELEASE}@gi" > /etc/apt/sources.list.d/docker.list curl -fsSL http://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | apt-key add - apt update -y apt install docker-ce -y mv /etc/apt/sources.list.d/docker.list /etc/apt/sources.list.d/docker.list.bak mv /lib/systemd/system/docker.service /lib/systemd/system/docker.service.bak - curl -sL ${DOCKER_CONFIG_DOWNLOAD_URL} > /lib/systemd/system/docker.service + curl -fsSL ${DOCKER_CONFIG_DOWNLOAD_URL} > /lib/systemd/system/docker.service systemctl daemon-reload systemctl restart docker } function install_ctop(){ - curl -sL ${CTOP_DOWNLOAD_URL} > /usr/local/bin/ctop + curl -fsSL ${CTOP_DOWNLOAD_URL} > /usr/local/bin/ctop chmod +x /usr/local/bin/ctop } function install_dc(){ - curl -sL ${DOCKER_COMPOSE_DOWNLOAD_URL} > /usr/local/bin/docker-compose + curl -fsSL ${DOCKER_COMPOSE_DOWNLOAD_URL} > /usr/local/bin/docker-compose chmod +x /usr/local/bin/docker-compose } From 42c3679531dc4d9878d6d778ac6c9a1ef7076e51 Mon Sep 17 00:00:00 2001 From: mritd Date: Fri, 3 Jan 2020 14:26:39 +0800 Subject: [PATCH 172/190] feat(git_proxy.sh): remove git proxy remove git proxy Signed-off-by: mritd --- git_proxy.sh | 16 ---------------- 1 file changed, 16 deletions(-) delete mode 100755 git_proxy.sh diff --git a/git_proxy.sh b/git_proxy.sh deleted file mode 100755 index 2b83c65..0000000 --- a/git_proxy.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -tee /usr/local/bin/proxy-wrapper < Date: Thu, 19 Mar 2020 17:44:12 +0800 Subject: [PATCH 173/190] feat(inint_ubuntu): add some tools add some tools Signed-off-by: mritd --- init_ubuntu.sh | 48 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) diff --git a/init_ubuntu.sh b/init_ubuntu.sh index 57dde9c..970b600 100755 --- a/init_ubuntu.sh +++ b/init_ubuntu.sh @@ -14,6 +14,11 @@ VIM_PLUGINS_DOWNLOAD_URL='https://git.io/fh9r3' DOCKER_CONFIG_DOWNLOAD_URL='https://git.io/fh9Ui' CTOP_DOWNLOAD_URL='https://github.com/bcicen/ctop/releases/download/v0.7.2/ctop-0.7.2-linux-amd64' DOCKER_COMPOSE_DOWNLOAD_URL="https://github.com/docker/compose/releases/download/1.23.2/docker-compose-Linux-x86_64" +HEY_DOWNLOAD_URL="https://storage.googleapis.com/hey-release/hey_linux_amd64" +BAT_DOWNLOAD_URL="https://github.com/sharkdp/bat/releases/download/v0.12.1/bat-v0.12.1-x86_64-unknown-linux-gnu.tar.gz" +SIMPLER_DOWNLOAD_URL="https://github.com/sqshq/sampler/releases/download/v1.1.0/sampler-1.1.0-linux-amd64" +PERF_TOOLS_DOWNLOAD_URL="https://github.com/brendangregg/perf-tools" +TERMSHARK_DOWNLOAD_URL="https://github.com/gcla/termshark/releases/download/v2.1.1/termshark_2.1.1_linux_x64.tar.gz" function disable_cloudinit(){ for svc in 'cloud-config cloud-final cloud-init cloud-init-local'; do @@ -41,7 +46,7 @@ function sysupdate(){ apt update -y apt upgrade -y apt install -y apt-transport-https ca-certificates software-properties-common \ - wget vim zsh git htop tzdata conntrack ipvsadm ipset stress sysstat + wget vim zsh git htop tzdata conntrack ipvsadm ipset stress sysstat axel fzf } function settimezone(){ @@ -89,6 +94,42 @@ function install_dc(){ chmod +x /usr/local/bin/docker-compose } +function install_hey(){ + curl -fsSL ${HEY_DOWNLOAD_URL} > /usr/local/bin/hey + chmod +x /usr/local/bin/hey +} + +function install_bat(){ + curl -fsSL ${BAT_DOWNLOAD_URL} > bat.tar.gz + tar -zxf bat.tar.gz + mv bat-*/bat /usr/local/bin/bat + rm -rf bat* +} + +function install_simpler(){ + curl -fsSL ${SIMPLER_DOWNLOAD_URL} > /usr/local/bin/simpler + chmod +x /usr/local/bin/simpler +} + +function install_pert-tools(){ + git clone --depth 1 ${PERF_TOOLS_DOWNLOAD_URL} /usr/local/perf-tools +} + +function install_termshark(){ + curl -fsSL ${TERMSHARK_DOWNLOAD_URL} > termshark.tar.gz + tar -zxf termshark.tar.gz + mv termshark*/termshark /usr/local/bin/termshark + rm -rf termshark* +} + +function install_osquery(){ + OSQUERY_KEY=1484120AC4E9F8A1A577AEEE97A80C63C9D8B80B + apt-key adv --keyserver keyserver.ubuntu.com --recv-keys ${OSQUERY_KEY} -y + add-apt-repository 'deb [arch=amd64] https://pkg.osquery.io/deb deb main' -y + apt-get update -y + apt-get install osquery -y +} + disable_cloudinit setlocale sysupdate @@ -98,3 +139,8 @@ install_ohmyzsh install_docker install_ctop install_dc +install_hey +install_bat +install_simpler +install_termshark +install_osquery From b4be55bc74689d0dd71a1ce5226d9a0680668dc7 Mon Sep 17 00:00:00 2001 From: mritd Date: Thu, 19 Mar 2020 18:00:52 +0800 Subject: [PATCH 174/190] feat(init_ubuntu): remove fzf remove fzf Signed-off-by: mritd --- init_ubuntu.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init_ubuntu.sh b/init_ubuntu.sh index 970b600..5755899 100755 --- a/init_ubuntu.sh +++ b/init_ubuntu.sh @@ -46,7 +46,7 @@ function sysupdate(){ apt update -y apt upgrade -y apt install -y apt-transport-https ca-certificates software-properties-common \ - wget vim zsh git htop tzdata conntrack ipvsadm ipset stress sysstat axel fzf + wget vim zsh git htop tzdata conntrack ipvsadm ipset stress sysstat axel } function settimezone(){ From 016f244d09236597db1d121900734c69db904d33 Mon Sep 17 00:00:00 2001 From: mritd Date: Thu, 19 Mar 2020 18:17:04 +0800 Subject: [PATCH 175/190] feat(inint_ubuntu): add tshark add tshark Signed-off-by: mritd --- init_ubuntu.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/init_ubuntu.sh b/init_ubuntu.sh index 5755899..6f05a78 100755 --- a/init_ubuntu.sh +++ b/init_ubuntu.sh @@ -47,6 +47,8 @@ function sysupdate(){ apt upgrade -y apt install -y apt-transport-https ca-certificates software-properties-common \ wget vim zsh git htop tzdata conntrack ipvsadm ipset stress sysstat axel + apt autoremove -y + apt autoclean -y } function settimezone(){ @@ -120,11 +122,12 @@ function install_termshark(){ tar -zxf termshark.tar.gz mv termshark*/termshark /usr/local/bin/termshark rm -rf termshark* + apt install tshark -y } function install_osquery(){ OSQUERY_KEY=1484120AC4E9F8A1A577AEEE97A80C63C9D8B80B - apt-key adv --keyserver keyserver.ubuntu.com --recv-keys ${OSQUERY_KEY} -y + apt-key adv --keyserver keyserver.ubuntu.com --recv-keys ${OSQUERY_KEY} add-apt-repository 'deb [arch=amd64] https://pkg.osquery.io/deb deb main' -y apt-get update -y apt-get install osquery -y From 8f629400c6921b038cc656164bfa2eb86f398f75 Mon Sep 17 00:00:00 2001 From: mritd Date: Sat, 21 Mar 2020 11:21:28 +0800 Subject: [PATCH 176/190] feat(inint_ubuntu): remove simpler remove simpler Signed-off-by: mritd --- init_ubuntu.sh | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/init_ubuntu.sh b/init_ubuntu.sh index 6f05a78..1496252 100755 --- a/init_ubuntu.sh +++ b/init_ubuntu.sh @@ -16,7 +16,6 @@ CTOP_DOWNLOAD_URL='https://github.com/bcicen/ctop/releases/download/v0.7.2/ctop- DOCKER_COMPOSE_DOWNLOAD_URL="https://github.com/docker/compose/releases/download/1.23.2/docker-compose-Linux-x86_64" HEY_DOWNLOAD_URL="https://storage.googleapis.com/hey-release/hey_linux_amd64" BAT_DOWNLOAD_URL="https://github.com/sharkdp/bat/releases/download/v0.12.1/bat-v0.12.1-x86_64-unknown-linux-gnu.tar.gz" -SIMPLER_DOWNLOAD_URL="https://github.com/sqshq/sampler/releases/download/v1.1.0/sampler-1.1.0-linux-amd64" PERF_TOOLS_DOWNLOAD_URL="https://github.com/brendangregg/perf-tools" TERMSHARK_DOWNLOAD_URL="https://github.com/gcla/termshark/releases/download/v2.1.1/termshark_2.1.1_linux_x64.tar.gz" @@ -30,9 +29,9 @@ function disable_cloudinit(){ function setlocale(){ if [ ! -f /etc/locale.gen.bak ]; then - cp /etc/locale.gen /etc/locale.gen.bak - echo 'en_US.UTF-8 UTF-8' > /etc/locale.gen - echo 'zh_CN.UTF-8 UTF-8' >> /etc/locale.gen + cp /etc/locale.gen /etc/locale.gen.bak + echo 'en_US.UTF-8 UTF-8' > /etc/locale.gen + echo 'zh_CN.UTF-8 UTF-8' >> /etc/locale.gen fi locale-gen --purge localectl set-locale LANG=en_US.UTF-8 @@ -40,8 +39,8 @@ function setlocale(){ function sysupdate(){ if [ ! -f /etc/apt/sources.list.bak ]; then - cp /etc/apt/sources.list /etc/apt/sources.list.old - curl -fsSL ${SOURCES_LIST_URL} | sed "s@{{OS_RELEASE}}@${OS_RELEASE}@gi" > /etc/apt/sources.list + cp /etc/apt/sources.list /etc/apt/sources.list.old + curl -fsSL ${SOURCES_LIST_URL} | sed "s@{{OS_RELEASE}}@${OS_RELEASE}@gi" > /etc/apt/sources.list fi apt update -y apt upgrade -y @@ -108,11 +107,6 @@ function install_bat(){ rm -rf bat* } -function install_simpler(){ - curl -fsSL ${SIMPLER_DOWNLOAD_URL} > /usr/local/bin/simpler - chmod +x /usr/local/bin/simpler -} - function install_pert-tools(){ git clone --depth 1 ${PERF_TOOLS_DOWNLOAD_URL} /usr/local/perf-tools } @@ -144,6 +138,5 @@ install_ctop install_dc install_hey install_bat -install_simpler install_termshark install_osquery From 9a9d39a5c2e989ccb65644e8a846c0f414be2bbc Mon Sep 17 00:00:00 2001 From: mritd Date: Mon, 30 Mar 2020 11:48:41 +0800 Subject: [PATCH 177/190] feat(coredns): add install_coredns add install_coredns Signed-off-by: mritd --- install_coredns.sh | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/install_coredns.sh b/install_coredns.sh index 7c3fb75..76cab2b 100755 --- a/install_coredns.sh +++ b/install_coredns.sh @@ -1,12 +1,11 @@ -#!/bin/bash set -e VERSION="${1}" if [ -z "${VERSION}" ]; then - VERSION="1.6.4" - echo "No CoreDNS version specified, use default version: 1.6.4!" + VERSION="1.6.9" + echo "No CoreDNS version specified, use default version: ${VERSION}!" fi COREDNS_URL="https://github.com/coredns/coredns/releases/download/v${VERSION}/coredns_${VERSION}_linux_amd64.tgz" @@ -15,18 +14,22 @@ SYSUSERS_CONF="https://raw.githubusercontent.com/coredns/deployment/master/syste TEMPFILES_CONF="https://raw.githubusercontent.com/coredns/deployment/master/systemd/coredns-tmpfiles.conf" SERVICE_CONF="https://raw.githubusercontent.com/coredns/deployment/master/systemd/coredns.service" -curl -fsSL ${COREDNS_URL} > coredns.tar.gz -curl -fsSL ${SYSUSERS_CONF} > /usr/lib/sysusers.d/coredns-sysusers.conf -curl -fsSL ${TEMPFILES_CONF} > /usr/lib/tmpfiles.d/coredns-tmpfiles.conf -curl -fsSL ${SERVICE_CONF} > /lib/systemd/system/coredns.service +curl -sSL ${COREDNS_URL} > coredns.tar.gz +curl -sSL ${SYSUSERS_CONF} > /usr/lib/sysusers.d/coredns-sysusers.conf +curl -sSL ${TEMPFILES_CONF} > /usr/lib/tmpfiles.d/coredns-tmpfiles.conf +curl -sSL ${SERVICE_CONF} > /lib/systemd/system/coredns.service -tar -zxf coredns.tar.gz --strip-components=1 -C /usr/bin +#tar -zxf coredns.tar.gz --strip-components=1 -C /usr/bin +tar -zxf coredns.tar.gz -C /usr/bin systemd-sysusers systemd-tmpfiles --create systemctl daemon-reload -mkdir -p /etc/coredns -curl -fsSL ${COREDNS_CONF} > /etc/coredns/Corefile +if [ ! -d "/etc/coredns" ]; then + mkdir -p /etc/coredns +fi + +curl -sSL ${COREDNS_CONF} > /etc/coredns/Corefile touch /etc/coredns/hosts rm -f coredns.tar.gz From 529b27ddbf2081da3d25c3d0368ca4cc2f034975 Mon Sep 17 00:00:00 2001 From: mritd Date: Mon, 30 Mar 2020 11:51:15 +0800 Subject: [PATCH 178/190] feat(docker_check): update docker check update docker check Signed-off-by: mritd --- docker-check-config.sh | 93 +++++++++++++++++++++++------------------- 1 file changed, 51 insertions(+), 42 deletions(-) diff --git a/docker-check-config.sh b/docker-check-config.sh index 88eb8aa..3d82118 100755 --- a/docker-check-config.sh +++ b/docker-check-config.sh @@ -16,7 +16,7 @@ possibleConfigs=( if [ $# -gt 0 ]; then CONFIG="$1" else - : ${CONFIG:="${possibleConfigs[0]}"} + : "${CONFIG:="${possibleConfigs[0]}"}" fi if ! command -v zgrep &> /dev/null; then @@ -43,7 +43,7 @@ is_set_as_module() { color() { local codes=() if [ "$1" = 'bold' ]; then - codes=( "${codes[@]}" '1' ) + codes=("${codes[@]}" '1') shift fi if [ "$#" -gt 0 ]; then @@ -60,7 +60,7 @@ color() { white) code=37 ;; esac if [ "$code" ]; then - codes=( "${codes[@]}" "$code" ) + codes=("${codes[@]}" "$code") fi fi local IFS=';' @@ -98,12 +98,13 @@ check_flag() { check_flags() { for flag in "$@"; do - echo -n "- "; check_flag "$flag" + echo -n "- " + check_flag "$flag" done } check_command() { - if command -v "$1" >/dev/null 2>&1; then + if command -v "$1" > /dev/null 2>&1; then wrap_good "$1 command" 'available' else wrap_bad "$1 command" 'missing' @@ -121,7 +122,7 @@ check_device() { } check_distro_userns() { - source /etc/os-release 2>/dev/null || /bin/true + source /etc/os-release 2> /dev/null || /bin/true if [[ "${ID}" =~ ^(centos|rhel)$ && "${VERSION_ID}" =~ ^7 ]]; then # this is a CentOS7 or RHEL7 system grep -q "user_namespace.enable=1" /proc/cmdline || { @@ -156,31 +157,31 @@ echo 'Generally Necessary:' echo -n '- ' cgroupSubsystemDir="$(awk '/[, ](cpu|cpuacct|cpuset|devices|freezer|memory)[, ]/ && $3 == "cgroup" { print $2 }' /proc/mounts | head -n1)" cgroupDir="$(dirname "$cgroupSubsystemDir")" -if [ -d "$cgroupDir/cpu" -o -d "$cgroupDir/cpuacct" -o -d "$cgroupDir/cpuset" -o -d "$cgroupDir/devices" -o -d "$cgroupDir/freezer" -o -d "$cgroupDir/memory" ]; then +if [ -d "$cgroupDir/cpu" ] || [ -d "$cgroupDir/cpuacct" ] || [ -d "$cgroupDir/cpuset" ] || [ -d "$cgroupDir/devices" ] || [ -d "$cgroupDir/freezer" ] || [ -d "$cgroupDir/memory" ]; then echo "$(wrap_good 'cgroup hierarchy' 'properly mounted') [$cgroupDir]" else if [ "$cgroupSubsystemDir" ]; then echo "$(wrap_bad 'cgroup hierarchy' 'single mountpoint!') [$cgroupSubsystemDir]" else - echo "$(wrap_bad 'cgroup hierarchy' 'nonexistent??')" + wrap_bad 'cgroup hierarchy' 'nonexistent??' fi EXITCODE=1 echo " $(wrap_color '(see https://github.com/tianon/cgroupfs-mount)' yellow)" fi -if [ "$(cat /sys/module/apparmor/parameters/enabled 2>/dev/null)" = 'Y' ]; then +if [ "$(cat /sys/module/apparmor/parameters/enabled 2> /dev/null)" = 'Y' ]; then echo -n '- ' if command -v apparmor_parser &> /dev/null; then - echo "$(wrap_good 'apparmor' 'enabled and tools installed')" + wrap_good 'apparmor' 'enabled and tools installed' else - echo "$(wrap_bad 'apparmor' 'enabled, but apparmor_parser missing')" + wrap_bad 'apparmor' 'enabled, but apparmor_parser missing' echo -n ' ' if command -v apt-get &> /dev/null; then - echo "$(wrap_color '(use "apt-get install apparmor" to fix this)')" + wrap_color '(use "apt-get install apparmor" to fix this)' elif command -v yum &> /dev/null; then - echo "$(wrap_color '(your best bet is "yum install apparmor-parser")')" + wrap_color '(your best bet is "yum install apparmor-parser")' else - echo "$(wrap_color '(look for an "apparmor" package for your distribution)')" + wrap_color '(look for an "apparmor" package for your distribution)' fi EXITCODE=1 fi @@ -199,8 +200,8 @@ flags=( POSIX_MQUEUE ) check_flags "${flags[@]}" -if [ "$kernelMajor" -lt 4 ] || [ "$kernelMajor" -eq 4 -a "$kernelMinor" -lt 8 ]; then - check_flags DEVPTS_MULTIPLE_INSTANCES +if [ "$kernelMajor" -lt 4 ] || ([ "$kernelMajor" -eq 4 ] && [ "$kernelMinor" -lt 8 ]); then + check_flags DEVPTS_MULTIPLE_INSTANCES fi echo @@ -228,12 +229,15 @@ echo 'Optional Features:' } { if is_set LEGACY_VSYSCALL_NATIVE; then - echo -n "- "; wrap_bad "CONFIG_LEGACY_VSYSCALL_NATIVE" 'enabled' + echo -n "- " + wrap_bad "CONFIG_LEGACY_VSYSCALL_NATIVE" 'enabled' echo " $(wrap_color '(dangerous, provides an ASLR-bypassing target with usable ROP gadgets.)' bold black)" elif is_set LEGACY_VSYSCALL_EMULATE; then - echo -n "- "; wrap_good "CONFIG_LEGACY_VSYSCALL_EMULATE" 'enabled' + echo -n "- " + wrap_good "CONFIG_LEGACY_VSYSCALL_EMULATE" 'enabled' elif is_set LEGACY_VSYSCALL_NONE; then - echo -n "- "; wrap_bad "CONFIG_LEGACY_VSYSCALL_NONE" 'enabled' + echo -n "- " + wrap_bad "CONFIG_LEGACY_VSYSCALL_NONE" 'enabled' echo " $(wrap_color '(containers using eglibc <= 2.13 will not work. Switch to' bold black)" echo " $(wrap_color ' "CONFIG_VSYSCALL_[NATIVE|EMULATE]" or use "vsyscall=[native|emulate]"' bold black)" echo " $(wrap_color ' on kernel command line. Note that this will disable ASLR for the,' bold black)" @@ -245,15 +249,15 @@ echo 'Optional Features:' fi } -if [ "$kernelMajor" -lt 4 ] || [ "$kernelMajor" -eq 4 -a "$kernelMinor" -le 5 ]; then +if [ "$kernelMajor" -lt 4 ] || ([ "$kernelMajor" -eq 4 ] && [ "$kernelMinor" -le 5 ]); then check_flags MEMCG_KMEM fi -if [ "$kernelMajor" -lt 3 ] || [ "$kernelMajor" -eq 3 -a "$kernelMinor" -le 18 ]; then +if [ "$kernelMajor" -lt 3 ] || ([ "$kernelMajor" -eq 3 ] && [ "$kernelMinor" -le 18 ]); then check_flags RESOURCE_COUNTERS fi -if [ "$kernelMajor" -lt 3 ] || [ "$kernelMajor" -eq 3 -a "$kernelMinor" -le 13 ]; then +if [ "$kernelMajor" -lt 3 ] || ([ "$kernelMajor" -eq 3 ] && [ "$kernelMinor" -le 13 ]); then netprio=NETPRIO_CGROUP else netprio=CGROUP_NET_PRIO @@ -265,9 +269,12 @@ flags=( CGROUP_HUGETLB NET_CLS_CGROUP $netprio CFS_BANDWIDTH FAIR_GROUP_SCHED RT_GROUP_SCHED + IP_NF_TARGET_REDIRECT IP_VS IP_VS_NFCT - IP_VS_RR + IP_VS_PROTO_TCP + IP_VS_PROTO_UDP + IP_VS_RR ) check_flags "${flags[@]}" @@ -288,16 +295,16 @@ if ! is_set EXT4_FS || ! is_set EXT4_FS_POSIX_ACL || ! is_set EXT4_FS_SECURITY; fi echo '- Network Drivers:' -echo ' - "'$(wrap_color 'overlay' blue)'":' -check_flags VXLAN | sed 's/^/ /' +echo " - \"$(wrap_color 'overlay' blue)\":" +check_flags VXLAN BRIDGE_VLAN_FILTERING | sed 's/^/ /' echo ' Optional (for encrypted networks):' check_flags CRYPTO CRYPTO_AEAD CRYPTO_GCM CRYPTO_SEQIV CRYPTO_GHASH \ - XFRM XFRM_USER XFRM_ALGO INET_ESP INET_XFRM_MODE_TRANSPORT | sed 's/^/ /' -echo ' - "'$(wrap_color 'ipvlan' blue)'":' + XFRM XFRM_USER XFRM_ALGO INET_ESP INET_XFRM_MODE_TRANSPORT | sed 's/^/ /' +echo " - \"$(wrap_color 'ipvlan' blue)\":" check_flags IPVLAN | sed 's/^/ /' -echo ' - "'$(wrap_color 'macvlan' blue)'":' +echo " - \"$(wrap_color 'macvlan' blue)\":" check_flags MACVLAN DUMMY | sed 's/^/ /' -echo ' - "'$(wrap_color 'ftp,tftp client in container' blue)'":' +echo " - \"$(wrap_color 'ftp,tftp client in container' blue)\":" check_flags NF_NAT_FTP NF_CONNTRACK_FTP NF_NAT_TFTP NF_CONNTRACK_TFTP | sed 's/^/ /' # only fail if no storage drivers available @@ -306,7 +313,7 @@ EXITCODE=0 STORAGE=1 echo '- Storage Drivers:' -echo ' - "'$(wrap_color 'aufs' blue)'":' +echo " - \"$(wrap_color 'aufs' blue)\":" check_flags AUFS_FS | sed 's/^/ /' if ! is_set AUFS_FS && grep -q aufs /proc/filesystems; then echo " $(wrap_color '(note that some kernels include AUFS patches but not the AUFS_FS flag)' bold black)" @@ -314,26 +321,29 @@ fi [ "$EXITCODE" = 0 ] && STORAGE=0 EXITCODE=0 -echo ' - "'$(wrap_color 'btrfs' blue)'":' +echo " - \"$(wrap_color 'btrfs' blue)\":" check_flags BTRFS_FS | sed 's/^/ /' check_flags BTRFS_FS_POSIX_ACL | sed 's/^/ /' [ "$EXITCODE" = 0 ] && STORAGE=0 EXITCODE=0 -echo ' - "'$(wrap_color 'devicemapper' blue)'":' +echo " - \"$(wrap_color 'devicemapper' blue)\":" check_flags BLK_DEV_DM DM_THIN_PROVISIONING | sed 's/^/ /' [ "$EXITCODE" = 0 ] && STORAGE=0 EXITCODE=0 -echo ' - "'$(wrap_color 'overlay' blue)'":' +echo " - \"$(wrap_color 'overlay' blue)\":" check_flags OVERLAY_FS | sed 's/^/ /' [ "$EXITCODE" = 0 ] && STORAGE=0 EXITCODE=0 -echo ' - "'$(wrap_color 'zfs' blue)'":' -echo -n " - "; check_device /dev/zfs -echo -n " - "; check_command zfs -echo -n " - "; check_command zpool +echo " - \"$(wrap_color 'zfs' blue)\":" +echo -n " - " +check_device /dev/zfs +echo -n " - " +check_command zfs +echo -n " - " +check_command zpool [ "$EXITCODE" = 0 ] && STORAGE=0 EXITCODE=0 @@ -342,14 +352,13 @@ EXITCODE=$CODE echo -check_limit_over() -{ - if [ $(cat "$1") -le "$2" ]; then - wrap_bad "- $1" "$(cat $1)" +check_limit_over() { + if [ "$(cat "$1")" -le "$2" ]; then + wrap_bad "- $1" "$(cat "$1")" wrap_color " This should be set to at least $2, for example set: sysctl -w kernel/keys/root_maxkeys=1000000" bold black EXITCODE=1 else - wrap_good "- $1" "$(cat $1)" + wrap_good "- $1" "$(cat "$1")" fi } From 13c17b4d76b7617a4cfdb91adef1544f57bcb021 Mon Sep 17 00:00:00 2001 From: mritd Date: Mon, 30 Mar 2020 11:51:55 +0800 Subject: [PATCH 179/190] feat(acme): remove acme godaddy remove acme godaddy Signed-off-by: mritd --- acme_godaddy.sh | 31 ------------------------------- 1 file changed, 31 deletions(-) delete mode 100755 acme_godaddy.sh diff --git a/acme_godaddy.sh b/acme_godaddy.sh deleted file mode 100755 index f883e40..0000000 --- a/acme_godaddy.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash - -# SSL certificates are used to create the script of Let's Encrypt -# Authentication method using Godaddy DNS -# Example: ./acme_dns.sh GD_Key GD_Secret mritd.me cdn.mritd.me -# GD_Key and GD_Secret can be obtained from Godaddy developer page - -#export GD_Key=$1 -#export GD_Secret=$2 - -for i in `seq 3 $#`;do - Domains+=" -d $1" - echo -e "\033[32mDomains: $3\033[0m" - shift -done - -if [ "$GD_Key" == "" ];then - echo -e "\033[31merror: GD_Key is blank!\033[0m" - exit 1 -fi - -if [ "$GD_Secret" == "" ];then - echo -e "\033[31merror: GD_Secret is blank!\033[0m" - exit 1 -fi - -echo -e "\033[32mCreate SSL CRT.......\033[0m" -~/.acme.sh/acme.sh --issue --force --dns dns_gd $Domains - -echo -e "\033[32mUpdate acme.sh......\033[0m" -~/.acme.sh/acme.sh --upgrade --auto-upgrade From 0f44566795d2a2e81305a905e16f8024780aa00d Mon Sep 17 00:00:00 2001 From: mritd Date: Fri, 3 Apr 2020 22:48:53 +0800 Subject: [PATCH 180/190] feat(build_nginx): change to ubuntu change to ubuntu Signed-off-by: mritd --- build_nginx.sh | 149 ++++++++++++++----------------------------------- 1 file changed, 42 insertions(+), 107 deletions(-) diff --git a/build_nginx.sh b/build_nginx.sh index e9f10e8..0908a3e 100755 --- a/build_nginx.sh +++ b/build_nginx.sh @@ -3,157 +3,95 @@ set -e # Nginx and module dependencies -NGINX_VERSION="1.11.7" -NGINX_LUA_MODULE_VERSION="0.10.7" -OPENSSL_VERSION="1.0.2j" -HEADERS_MORE_VERSION="0.32" -UPSTREAM_CHECK_VERSION="0.3.0" -DEVEL_KIT_VERSION="0.3.0" -NGINX_CT_VERSION="1.3.2" -LUAJIT_VERSION="2.0.4" +NGINX_VERSION="1.17.9" +NGINX_LUA_MODULE_VERSION="0.10.15" +NGINX_NJS_VERSION="0.3.9" +HEADERS_MORE_VERSION="0.33" +LUAJIT_VERSION="2.0.2" LUAJIT_MAIN_VERSION="2.0" LUAJIT_LIB="/usr/local/lib" -LUAJIT_INC="/usr/local/include/luajit-$LUAJIT_MAIN_VERSION" +LUAJIT_INC="/usr/local/include/luajit-${LUAJIT_MAIN_VERSION}" PREFIX=$1 # build args CONFIG_ARGS="\ --prefix=${PREFIX:-/usr/local/nginx} \ + --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 \ - --with-http_ssl_module \ - --with-http_realip_module \ + --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-file-aio \ + --with-threads \ --with-http_addition_module \ - --with-http_sub_module \ + --with-http_auth_request_module \ --with-http_dav_module \ --with-http_flv_module \ - --with-http_mp4_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_auth_request_module \ - --with-http_xslt_module=dynamic \ - --with-http_image_filter_module=dynamic \ - --with-http_geoip_module=dynamic \ - --with-http_perl_module=dynamic \ - --with-threads \ + --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 \ - --with-stream_realip_module \ + --with-http_geoip_module=dynamic \ --with-stream_geoip_module=dynamic \ - --with-http_slice_module \ - --with-mail \ - --with-mail_ssl_module \ - --with-file-aio \ - --with-http_v2_module \ - --with-openssl=/usr/src/openssl-${OPENSSL_VERSION} \ + --with-http_image_filter_module=dynamic \ + --with-http_perl_module=dynamic \ + --with-http_xslt_module=dynamic \ + --add-dynamic-module=/usr/src/njs-${NGINX_NJS_VERSION}/nginx \ --add-module=/usr/src/headers-more-nginx-module-${HEADERS_MORE_VERSION} \ - --add-module=/usr/src/nginx_upstream_check_module-${UPSTREAM_CHECK_VERSION} \ - --add-module=/usr/src/ngx_devel_kit-${DEVEL_KIT_VERSION} \ --add-module=/usr/src/lua-nginx-module-${NGINX_LUA_MODULE_VERSION} \ - --add-module=/usr/src/nginx-ct-${NGINX_CT_VERSION} \ - --http-client-body-temp-path=/tmp/client_body_temp \ - --http-proxy-temp-path=/tmp/proxy_temp \ - --http-fastcgi-temp-path=/tmp/fastcgi_temp \ - --http-uwsgi-temp-path=/tmp/uwsgi_temp \ - --http-scgi-temp-path=/tmp/scgi_temp \ " # install build dependencies function _installdep(){ echo -e "\033[32minstall build dependencies...\033[0m" - yum install gcc glibc glibc-devel make pcre \ - pcre-devel zlib zlib-devel kernel-devel \ - curl gnupg libxslt libxslt-devel gd-devel \ - geoip-devel perl-devel perl-ExtUtils-Embed \ - lua lua-devel patch -y + apt install build-essential -y + apt build-dep nginx -y } # download module dependencies -function _downloadfiles(){ - echo -e "\033[32mdownload module dependencies...\033[0m" +function _download(){ + echo -e "\033[32mdownload files...\033[0m" curl -fSL http://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz -o nginx.tar.gz - curl -fSL https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz -o openssl-${OPENSSL_VERSION}.tar.gz curl -fSL https://github.com/openresty/lua-nginx-module/archive/v${NGINX_LUA_MODULE_VERSION}.tar.gz -o lua-nginx-module-v${NGINX_LUA_MODULE_VERSION}.tar.gz curl -fSL https://github.com/openresty/headers-more-nginx-module/archive/v${HEADERS_MORE_VERSION}.tar.gz -o headers-more-nginx-module-v${HEADERS_MORE_VERSION}.tar.gz - curl -fSL https://github.com/yaoweibin/nginx_upstream_check_module/archive/v${UPSTREAM_CHECK_VERSION}.tar.gz -o nginx_upstream_check_module-v${UPSTREAM_CHECK_VERSION}.tar.gz - curl -fSL https://github.com/simpl/ngx_devel_kit/archive/v${DEVEL_KIT_VERSION}.tar.gz -o ngx_devel_kit-v${DEVEL_KIT_VERSION}.tar.gz - curl -fSL http://luajit.org/download/LuaJIT-$LUAJIT_VERSION.tar.gz -o LuaJIT-$LUAJIT_VERSION.tar.gz - curl -fSL https://raw.githubusercontent.com/cloudflare/sslconfig/master/patches/openssl__chacha20_poly1305_draft_and_rfc_ossl102j.patch -o openssl__chacha20_poly1305_draft_and_rfc_ossl102j.patch - #curl -fSL https://raw.githubusercontent.com/cloudflare/sslconfig/master/patches/nginx__dynamic_tls_records.patch -o nginx__dynamic_tls_records.patch - #curl -fSL https://raw.githubusercontent.com/cloudflare/sslconfig/master/patches/nginx__http2_spdy.patch -o nginx__http2_spdy.patch - curl -fSL https://github.com/grahamedgecombe/nginx-ct/archive/v${NGINX_CT_VERSION}.tar.gz -o nginx-ct-v${NGINX_CT_VERSION}.tar.gz + curl -fSL http://luajit.org/download/LuaJIT-${LUAJIT_VERSION}.tar.gz -o LuaJIT-${LUAJIT_VERSION}.tar.gz + curl -fSL https://github.com/nginx/njs/archive/${NGINX_NJS_VERSION}.tar.gz -o njs-${NGINX_NJS_VERSION}.tar.gz tar -zxC /usr/src -f nginx.tar.gz - tar -zxC /usr/src -f openssl-${OPENSSL_VERSION}.tar.gz tar -zxC /usr/src -f lua-nginx-module-v${NGINX_LUA_MODULE_VERSION}.tar.gz tar -zxC /usr/src -f headers-more-nginx-module-v${HEADERS_MORE_VERSION}.tar.gz - tar -zxC /usr/src -f nginx_upstream_check_module-v${UPSTREAM_CHECK_VERSION}.tar.gz tar -zxC /usr/src -f lua-nginx-module-v$NGINX_LUA_MODULE_VERSION.tar.gz - tar -zxC /usr/src -f ngx_devel_kit-v${DEVEL_KIT_VERSION}.tar.gz tar -zxC /usr/src -f LuaJIT-$LUAJIT_VERSION.tar.gz - tar -zxC /usr/src -f nginx-ct-v${NGINX_CT_VERSION}.tar.gz + tar -zxC /usr/src -f njs-${NGINX_NJS_VERSION}.tar.gz rm -f nginx.tar.gz - rm -f openssl-${OPENSSL_VERSION}.tar.gz rm -f lua-nginx-module-v${NGINX_LUA_MODULE_VERSION}.tar.gz rm -f headers-more-nginx-module-v${HEADERS_MORE_VERSION}.tar.gz rm -f nginx_upstream_check_module-v${UPSTREAM_CHECK_VERSION}.tar.gz - rm -f ngx_devel_kit-v${DEVEL_KIT_VERSION}.tar.gz rm -f LuaJIT-$LUAJIT_VERSION.tar.gz - rm -f nginx-ct-v${NGINX_CT_VERSION}.tar.gz - - #mv nginx__dynamic_tls_records.patch /usr/src/nginx-${NGINX_VERSION} - #mv nginx__http2_spdy.patch /usr/src/nginx-${NGINX_VERSION} - mv openssl__chacha20_poly1305_draft_and_rfc_ossl102j.patch /usr/src/openssl-${OPENSSL_VERSION} - -} - -# patch to nginx -function _patch_nginx(){ - echo -e "\033[32mpatch to nginx...\033[0m" - cd /usr/src/nginx-$NGINX_VERSION - patch -p1 < nginx__dynamic_tls_records.patch - patch -p1 < nginx__http2_spdy.patch -} - -# patch to openssl -function _patch_openssl(){ - echo -e "\033[32mpatch to openssl...\033[0m" - cd /usr/src/openssl-${OPENSSL_VERSION} - patch -p1 < openssl__chacha20_poly1305_draft_and_rfc_ossl102j.patch -} - - -# install openssl -function install_openssl(){ - echo -e "\033[32minstall openssl $OPENSSL_VERSION ...\033[0m" - cd /usr/src/openssl-${OPENSSL_VERSION} - ./config shared zlib-dynamic - make && make install - - echo -e "\033[32mbackup old files...\033[0m" - mv /usr/bin/openssl /usr/bin/openssl.old || true - mv /usr/include/openssl /usr/include/openssl.old || true - - # link new file - ln -s /usr/local/ssl/bin/openssl /usr/bin/openssl - ln -s /usr/local/ssl/include/openssl /usr/include/openssl - - mv /usr/lib/libssl.so /usr/lib/libssl.so.old || true - mv /usr/local/lib64/libssl.so /usr/local/lib64/libssl.so.old || true - - # link new lib - ln -s /usr/local/ssl/lib/libssl.so /usr/lib/libssl.so - ln -s /usr/local/ssl/lib/libssl.so /usr/local/lib64/libssl.so + rm -f njs-${NGINX_NJS_VERSION}.tar.gz - # reload lib - echo "/usr/local/ssl/lib" >> /etc/ld.so.conf - ldconfig -v } # install Lua @@ -180,10 +118,7 @@ function _clean(){ } _installdep -_downloadfiles -#_patch_nginx -_patch_openssl -install_openssl +_download install_lua install_nginx _clean From 254e5d92647b015e944a85126ee7d6f7bf903d65 Mon Sep 17 00:00:00 2001 From: mritd Date: Sat, 4 Apr 2020 15:52:09 +0800 Subject: [PATCH 181/190] feat(init_ubuntu): show log show log Signed-off-by: mritd --- init_ubuntu.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/init_ubuntu.sh b/init_ubuntu.sh index 1496252..2deaa10 100755 --- a/init_ubuntu.sh +++ b/init_ubuntu.sh @@ -68,8 +68,7 @@ function config_vim(){ mkdir -p ~/.vim/pack/plugins/{start,opt} cd ~/.vim/pack/plugins/start for addr in `curl -fsSL ${VIM_PLUGINS_DOWNLOAD_URL}`; do - echo "git clone => ${addr}" - git clone ${addr} > /dev/null 2>&1 + git clone ${addr} done } From 8a805df91ed1ed12f3f25e137350d230ef13daf2 Mon Sep 17 00:00:00 2001 From: mritd Date: Tue, 7 Apr 2020 12:34:10 +0800 Subject: [PATCH 182/190] feat(build_nginx): update build nginx update build nginx Signed-off-by: mritd --- build_nginx.sh | 132 +++++++++++++++++++++++++++++++++++-------------- 1 file changed, 95 insertions(+), 37 deletions(-) diff --git a/build_nginx.sh b/build_nginx.sh index 0908a3e..640da43 100755 --- a/build_nginx.sh +++ b/build_nginx.sh @@ -5,8 +5,11 @@ set -e # Nginx and module dependencies NGINX_VERSION="1.17.9" NGINX_LUA_MODULE_VERSION="0.10.15" +NGINX_LUA_RESTY_CORE_VERSION="0.1.17" +NGINX_LUA_RESTY_LRUCACHE_VERSION="0.09" NGINX_NJS_VERSION="0.3.9" HEADERS_MORE_VERSION="0.33" +LUA_ENABLE="false" LUAJIT_VERSION="2.0.2" LUAJIT_MAIN_VERSION="2.0" LUAJIT_LIB="/usr/local/lib" @@ -28,6 +31,7 @@ CONFIG_ARGS="\ --http-scgi-temp-path=/var/cache/nginx/scgi_temp \ --user=nginx \ --group=nginx \ + --with-debug \ --with-compat \ --with-file-aio \ --with-threads \ @@ -59,66 +63,120 @@ CONFIG_ARGS="\ --with-http_xslt_module=dynamic \ --add-dynamic-module=/usr/src/njs-${NGINX_NJS_VERSION}/nginx \ --add-module=/usr/src/headers-more-nginx-module-${HEADERS_MORE_VERSION} \ - --add-module=/usr/src/lua-nginx-module-${NGINX_LUA_MODULE_VERSION} \ " -# install build dependencies -function _installdep(){ - echo -e "\033[32minstall build dependencies...\033[0m" - apt install build-essential -y - apt build-dep nginx -y -} - # download module dependencies -function _download(){ +function download(){ echo -e "\033[32mdownload files...\033[0m" - curl -fSL http://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz -o nginx.tar.gz - curl -fSL https://github.com/openresty/lua-nginx-module/archive/v${NGINX_LUA_MODULE_VERSION}.tar.gz -o lua-nginx-module-v${NGINX_LUA_MODULE_VERSION}.tar.gz - curl -fSL https://github.com/openresty/headers-more-nginx-module/archive/v${HEADERS_MORE_VERSION}.tar.gz -o headers-more-nginx-module-v${HEADERS_MORE_VERSION}.tar.gz - curl -fSL http://luajit.org/download/LuaJIT-${LUAJIT_VERSION}.tar.gz -o LuaJIT-${LUAJIT_VERSION}.tar.gz - curl -fSL https://github.com/nginx/njs/archive/${NGINX_NJS_VERSION}.tar.gz -o njs-${NGINX_NJS_VERSION}.tar.gz - - tar -zxC /usr/src -f nginx.tar.gz - tar -zxC /usr/src -f lua-nginx-module-v${NGINX_LUA_MODULE_VERSION}.tar.gz - tar -zxC /usr/src -f headers-more-nginx-module-v${HEADERS_MORE_VERSION}.tar.gz - tar -zxC /usr/src -f lua-nginx-module-v$NGINX_LUA_MODULE_VERSION.tar.gz - tar -zxC /usr/src -f LuaJIT-$LUAJIT_VERSION.tar.gz - tar -zxC /usr/src -f njs-${NGINX_NJS_VERSION}.tar.gz + + download_dir="nginx_src" + if [ ! -d "${download_dir}" ];then + mkdir ${download_dir} + fi + + if [ ! -f "${download_dir}/nginx-${NGINX_VERSION}.tar.gz" ]; then + curl -fSL http://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz \ + -o ${download_dir}/nginx-${NGINX_VERSION}.tar.gz + fi + if [ ! -f "${download_dir}/lua-nginx-module-v${NGINX_LUA_MODULE_VERSION}.tar.gz" ]; then + curl -fSL https://github.com/openresty/lua-nginx-module/archive/v${NGINX_LUA_MODULE_VERSION}.tar.gz \ + -o ${download_dir}/lua-nginx-module-v${NGINX_LUA_MODULE_VERSION}.tar.gz + fi + if [ ! -f "${download_dir}/headers-more-nginx-module-v${HEADERS_MORE_VERSION}.tar.gz" ]; then + curl -fSL https://github.com/openresty/headers-more-nginx-module/archive/v${HEADERS_MORE_VERSION}.tar.gz \ + -o ${download_dir}/headers-more-nginx-module-v${HEADERS_MORE_VERSION}.tar.gz + fi + if [ ! -f "${download_dir}/njs-${NGINX_NJS_VERSION}.tar.gz" ]; then + curl -fSL https://github.com/nginx/njs/archive/${NGINX_NJS_VERSION}.tar.gz \ + -o ${download_dir}/njs-${NGINX_NJS_VERSION}.tar.gz + fi + if [ ! -f "${download_dir}/LuaJIT-${LUAJIT_VERSION}.tar.gz" ] && [ "${LUA_ENABLE}" == "true" ]; then + curl -fSL http://luajit.org/download/LuaJIT-${LUAJIT_VERSION}.tar.gz \ + -o ${download_dir}/LuaJIT-${LUAJIT_VERSION}.tar.gz + fi + if [ ! -f "${download_dir}/lua-resty-core-v${NGINX_LUA_RESTY_CORE_VERSION}.tar.gz" ] && [ "${LUA_ENABLE}" == "true" ]; then + curl -fSL https://github.com/openresty/lua-resty-core/archive/v${NGINX_LUA_RESTY_CORE_VERSION}.tar.gz \ + -o ${download_dir}/lua-resty-core-v${NGINX_LUA_RESTY_CORE_VERSION}.tar.gz + fi + if [ ! -f "${download_dir}/lua-resty-lrucache-v${NGINX_LUA_RESTY_LRUCACHE_VERSION}.tar.gz" ] && [ "${LUA_ENABLE}" == "true" ]; then + curl -fSL https://github.com/openresty/lua-resty-lrucache/archive/v${NGINX_LUA_RESTY_LRUCACHE_VERSION}.tar.gz \ + -o ${download_dir}/lua-resty-lrucache-v${NGINX_LUA_RESTY_LRUCACHE_VERSION}.tar.gz + fi - rm -f nginx.tar.gz - rm -f lua-nginx-module-v${NGINX_LUA_MODULE_VERSION}.tar.gz - rm -f headers-more-nginx-module-v${HEADERS_MORE_VERSION}.tar.gz - rm -f nginx_upstream_check_module-v${UPSTREAM_CHECK_VERSION}.tar.gz - rm -f LuaJIT-$LUAJIT_VERSION.tar.gz - rm -f njs-${NGINX_NJS_VERSION}.tar.gz + tar -zxC /usr/src -f ${download_dir}/nginx-${NGINX_VERSION}.tar.gz + tar -zxC /usr/src -f ${download_dir}/headers-more-nginx-module-v${HEADERS_MORE_VERSION}.tar.gz + tar -zxC /usr/src -f ${download_dir}/njs-${NGINX_NJS_VERSION}.tar.gz + if [ "${LUA_ENABLE}" == "true" ]; then + tar -zxC /usr/src -f ${download_dir}/lua-nginx-module-v$NGINX_LUA_MODULE_VERSION.tar.gz + tar -zxC /usr/src -f ${download_dir}/LuaJIT-$LUAJIT_VERSION.tar.gz + tar -zxC /usr/src -f ${download_dir}/lua-resty-core-v${NGINX_LUA_RESTY_CORE_VERSION}.tar.gz + tar -zxC /usr/src -f ${download_dir}/lua-resty-lrucache-v${NGINX_LUA_RESTY_LRUCACHE_VERSION}.tar.gz + fi +} + +# install build dependencies +function install_build_dep(){ + echo -e "\033[32minstall build dependencies...\033[0m" + apt install build-essential -y + apt build-dep nginx -y } # install Lua function install_lua(){ - echo -e "\033[32minstall Lua $LUAJIT_VERSION ...\033[0m" - cd /usr/src/LuaJIT-$LUAJIT_VERSION + echo -e "\033[32minstall Lua ${LUAJIT_VERSION} ...\033[0m" + cd /usr/src/LuaJIT-${LUAJIT_VERSION} make -j$(getconf _NPROCESSORS_ONLN) make install } +# install lua-resty-core +function install_lua_resty_core(){ + echo -e "\033[32minstall lua-resty-core ${NGINX_LUA_RESTY_CORE_VERSION} ...\033[0m" + cd /usr/src/lua-resty-core-${NGINX_LUA_RESTY_CORE_VERSION} + make install +} + +# install lua-resty-lrucache +function install_lua_resty_lrucache(){ + echo -e "\033[32minstall lua-resty-lrucache ${NGINX_LUA_RESTY_LRUCACHE_VERSION} ...\033[0m" + cd /usr/src/lua-resty-lrucache-${NGINX_LUA_RESTY_LRUCACHE_VERSION} + make install +} + # install nginx function install_nginx(){ - echo -e "\033[32minstall nginx $NGINX_VERSION ...\033[0m" - cd /usr/src/nginx-$NGINX_VERSION - ./configure $CONFIG_ARGS --with-debug + echo -e "\033[32minstall nginx ${NGINX_VERSION} ...\033[0m" + cd /usr/src/nginx-${NGINX_VERSION} + if [ "${LUA_ENABLE}" == "true" ]; then + CONFIG_ARGS="${CONFIG_ARGS} --add-module=/usr/src/lua-nginx-module-${NGINX_LUA_MODULE_VERSION}" + fi + ./configure ${CONFIG_ARGS} make -j$(getconf _NPROCESSORS_ONLN) make install + mkdir -p /var/cache/nginx/{client_temp,proxy_temp,fastcgi_temp,uwsgi_temp,scgi_temp} +} + +function adduser(){ + echo -e "\033[32madd nginx user ...\033[0m" + getent group nginx >/dev/null || groupadd -r nginx + getent passwd nginx >/dev/null || useradd -r -g nginx -s /sbin/nologin -c "nginx user" nginx + chown -R nginx:nginx /var/cache/nginx } # clean -function _clean(){ +function clean(){ echo -e "\033[32mcleaning files...\033[0m" rm -rf /usr/src/* } -_installdep -_download -install_lua +download +install_build_dep +if [ "${LUA_ENABLE}" == "true" ]; then + install_lua + install_lua_resty_core + install_lua_resty_lrucache +fi install_nginx -_clean +adduser +clean From a3b67e9e1ee9a0ae059b79ef17d82ed9203c3f80 Mon Sep 17 00:00:00 2001 From: mritd Date: Mon, 11 May 2020 14:35:01 +0800 Subject: [PATCH 183/190] feat(init_ubuntu): support ubuntu 20.04 support ubuntu 20.04 Signed-off-by: mritd --- init_ubuntu.sh | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/init_ubuntu.sh b/init_ubuntu.sh index 2deaa10..dc649ac 100755 --- a/init_ubuntu.sh +++ b/init_ubuntu.sh @@ -73,11 +73,15 @@ function config_vim(){ } function install_docker(){ - curl -fsSL ${DOCKER_LIST_URL} | sed "s@{{OS_RELEASE}}@${OS_RELEASE}@gi" > /etc/apt/sources.list.d/docker.list - curl -fsSL http://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | apt-key add - - apt update -y - apt install docker-ce -y - mv /etc/apt/sources.list.d/docker.list /etc/apt/sources.list.d/docker.list.bak + if [ "${OS_RELEASE}" == "focal" ]; then + apt install docker.io -y + else + curl -fsSL ${DOCKER_LIST_URL} | sed "s@{{OS_RELEASE}}@${OS_RELEASE}@gi" > /etc/apt/sources.list.d/docker.list + curl -fsSL http://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | apt-key add - + apt update -y + apt install docker-ce -y + mv /etc/apt/sources.list.d/docker.list /etc/apt/sources.list.d/docker.list.bak + fi mv /lib/systemd/system/docker.service /lib/systemd/system/docker.service.bak curl -fsSL ${DOCKER_CONFIG_DOWNLOAD_URL} > /lib/systemd/system/docker.service systemctl daemon-reload @@ -138,4 +142,4 @@ install_dc install_hey install_bat install_termshark -install_osquery +#install_osquery From 16293aa22053ff3b50864ce52f1d0ce0d7983826 Mon Sep 17 00:00:00 2001 From: mritd Date: Wed, 17 Jun 2020 17:54:29 +0800 Subject: [PATCH 184/190] feat(init_ubuntu.sh): use systemd patch use systemd patch Signed-off-by: mritd --- init_ubuntu.sh | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/init_ubuntu.sh b/init_ubuntu.sh index dc649ac..94ffaf1 100755 --- a/init_ubuntu.sh +++ b/init_ubuntu.sh @@ -19,14 +19,6 @@ BAT_DOWNLOAD_URL="https://github.com/sharkdp/bat/releases/download/v0.12.1/bat-v PERF_TOOLS_DOWNLOAD_URL="https://github.com/brendangregg/perf-tools" TERMSHARK_DOWNLOAD_URL="https://github.com/gcla/termshark/releases/download/v2.1.1/termshark_2.1.1_linux_x64.tar.gz" -function disable_cloudinit(){ - for svc in 'cloud-config cloud-final cloud-init cloud-init-local'; do - systemctl is-active --quiet ${svc} \ - && systemctl stop ${svc} \ - && systemctl disable ${svc} - done -} - function setlocale(){ if [ ! -f /etc/locale.gen.bak ]; then cp /etc/locale.gen /etc/locale.gen.bak @@ -75,15 +67,16 @@ function config_vim(){ function install_docker(){ if [ "${OS_RELEASE}" == "focal" ]; then apt install docker.io -y + apt-mark hold docker.io else curl -fsSL ${DOCKER_LIST_URL} | sed "s@{{OS_RELEASE}}@${OS_RELEASE}@gi" > /etc/apt/sources.list.d/docker.list curl -fsSL http://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | apt-key add - apt update -y apt install docker-ce -y - mv /etc/apt/sources.list.d/docker.list /etc/apt/sources.list.d/docker.list.bak + apt-mark hold docker-ce fi - mv /lib/systemd/system/docker.service /lib/systemd/system/docker.service.bak - curl -fsSL ${DOCKER_CONFIG_DOWNLOAD_URL} > /lib/systemd/system/docker.service + SYSTEMD_EDITOR="curl -fsSL ${DOCKER_CONFIG_DOWNLOAD_URL} > " + systemctl edit docker systemctl daemon-reload systemctl restart docker } @@ -130,16 +123,15 @@ function install_osquery(){ apt-get install osquery -y } -disable_cloudinit setlocale sysupdate settimezone config_vim install_ohmyzsh install_docker -install_ctop install_dc -install_hey -install_bat -install_termshark +#install_ctop +#install_hey +#install_bat +#install_termshark #install_osquery From 0e08a687f22525be5cff1f32ba67cf47137a4b70 Mon Sep 17 00:00:00 2001 From: mritd Date: Wed, 17 Jun 2020 18:21:25 +0800 Subject: [PATCH 185/190] feat(init_ubuntu): fix systemctl edit fix systemctl edit Signed-off-by: mritd --- init_ubuntu.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/init_ubuntu.sh b/init_ubuntu.sh index 94ffaf1..0881ba5 100755 --- a/init_ubuntu.sh +++ b/init_ubuntu.sh @@ -75,10 +75,10 @@ function install_docker(){ apt install docker-ce -y apt-mark hold docker-ce fi - SYSTEMD_EDITOR="curl -fsSL ${DOCKER_CONFIG_DOWNLOAD_URL} > " - systemctl edit docker - systemctl daemon-reload - systemctl restart docker + + curl -fsSL ${DOCKER_CONFIG_DOWNLOAD_URL} > docker.service + SYSTEMD_EDITOR="mv docker.service" systemctl edit docker + systemctl daemon-reload && systemctl restart docker } function install_ctop(){ From fb49c5fba35e80c92ce44d04d8508ca3defe2817 Mon Sep 17 00:00:00 2001 From: mritd Date: Mon, 29 Jun 2020 22:40:42 +0800 Subject: [PATCH 186/190] feat(docker_netstat): add docker netstat add docker netstat Signed-off-by: mritd --- docker_netstat.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100755 docker_netstat.sh diff --git a/docker_netstat.sh b/docker_netstat.sh new file mode 100755 index 0000000..4414edc --- /dev/null +++ b/docker_netstat.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +CONTAINER=$1 + +if [ ! ${CONTAINER} ]; then + echo "CONTAINER is empty!" + exit 1 +fi + +docker inspect --format '{{.State.Pid}} {{printf "%.13s" .ID}} {{.Name}}' ${CONTAINER} | \ +while read CONTAINER_PID CONTAINER_ID CONTAINER_NAME; do + echo ${CONTAINER_ID} ${CONTAINER_NAME} ${CONTAINER_PID} + nsenter -t ${CONTAINER_PID} -n netstat -pan | grep ESTABLISHED +done From 0f203754bf5e56cf806e665c1892a33a1dc58535 Mon Sep 17 00:00:00 2001 From: mritd Date: Fri, 1 Jan 2021 11:49:51 +0800 Subject: [PATCH 187/190] feat(caddy): add caddy_build add caddy_build Signed-off-by: mritd --- caddy_build.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100755 caddy_build.sh diff --git a/caddy_build.sh b/caddy_build.sh new file mode 100755 index 0000000..0da21cb --- /dev/null +++ b/caddy_build.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash + +go get -u github.com/caddyserver/xcaddy/cmd/xcaddy + +xcaddy build \ + --with github.com/abiosoft/caddy-exec \ + --with github.com/caddy-dns/cloudflare \ + --with github.com/caddy-dns/dnspod \ + --with github.com/caddy-dns/duckdns \ + --with github.com/caddy-dns/gandi \ + --with github.com/caddy-dns/route53 \ + --with github.com/greenpau/caddy-auth-jwt \ + --with github.com/greenpau/caddy-auth-portal \ + --with github.com/greenpau/caddy-trace \ + --with github.com/hairyhenderson/caddy-teapot-module \ + --with github.com/kirsch33/realip \ + --with github.com/porech/caddy-maxmind-geolocation \ + --with github.com/mholt/caddy-webdav From f4631fdc6809f2f180381e5b2ad7cb7f17c0741b Mon Sep 17 00:00:00 2001 From: mritd Date: Fri, 1 Jan 2021 15:12:49 +0800 Subject: [PATCH 188/190] feat(caddy_build): add deb package add deb package Signed-off-by: mritd --- caddy_build.sh | 104 +++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 88 insertions(+), 16 deletions(-) diff --git a/caddy_build.sh b/caddy_build.sh index 0da21cb..09fdd4b 100755 --- a/caddy_build.sh +++ b/caddy_build.sh @@ -1,18 +1,90 @@ #!/usr/bin/env bash -go get -u github.com/caddyserver/xcaddy/cmd/xcaddy - -xcaddy build \ - --with github.com/abiosoft/caddy-exec \ - --with github.com/caddy-dns/cloudflare \ - --with github.com/caddy-dns/dnspod \ - --with github.com/caddy-dns/duckdns \ - --with github.com/caddy-dns/gandi \ - --with github.com/caddy-dns/route53 \ - --with github.com/greenpau/caddy-auth-jwt \ - --with github.com/greenpau/caddy-auth-portal \ - --with github.com/greenpau/caddy-trace \ - --with github.com/hairyhenderson/caddy-teapot-module \ - --with github.com/kirsch33/realip \ - --with github.com/porech/caddy-maxmind-geolocation \ - --with github.com/mholt/caddy-webdav +set -e + +VERSION=${VERSION:-"2.3.0"} +BUILD_DIR=$(mktemp) + +function clean(){ + info "Clean build dir: ${BUILD_DIR}" + rm -rf ${BUILD_DIR} +} + +function build(){ + info "Create build dir: ${BUILD_DIR}" + mkdir -p ${BUILD_DIR}/{etc/caddy,usr/{bin,share/caddy},lib/systemd/system} + info "Dir tree:" + tree ${BUILD_DIR} + + info "Install xcaddy..." + go get -u github.com/caddyserver/xcaddy/cmd/xcaddy + + info "Building caddy..." + xcaddy build v${VERSION} --output ${BUILD_DIR}/usr/bin/caddy \ + --with github.com/abiosoft/caddy-exec \ + --with github.com/caddy-dns/cloudflare \ + --with github.com/caddy-dns/dnspod \ + --with github.com/caddy-dns/duckdns \ + --with github.com/caddy-dns/gandi \ + --with github.com/caddy-dns/route53 \ + --with github.com/greenpau/caddy-auth-jwt \ + --with github.com/greenpau/caddy-auth-portal \ + --with github.com/greenpau/caddy-trace \ + --with github.com/hairyhenderson/caddy-teapot-module \ + --with github.com/kirsch33/realip \ + --with github.com/porech/caddy-maxmind-geolocation \ + --with github.com/mholt/caddy-webdav +} + +function create_config(){ + info "Clone deb config repo: https://github.com/caddyserver/dist.git" + git clone https://github.com/caddyserver/dist.git ${BUILD_DIR}/caddy_config + + info "Copy config..." + cp ${BUILD_DIR}/caddy_config/init/caddy.service ${BUILD_DIR}/lib/systemd/system/caddy.service + cp ${BUILD_DIR}/caddy_config/init/caddy-api.service ${BUILD_DIR}/lib/systemd/system/caddy-api.service + cp ${BUILD_DIR}/caddy_config/config/Caddyfile ${BUILD_DIR}/etc/caddy/Caddyfile + cp ${BUILD_DIR}/caddy_config/welcome/index.html ${BUILD_DIR}/usr/share/caddy/index.html + cp -r ${BUILD_DIR}/caddy_config/scripts ${BUILD_DIR}/scripts + rm -rf ${BUILD_DIR}/caddy_config + + info "Dir tree:" + tree ${BUILD_DIR} +} + +function package(){ + info "Create deb package..." + (cd ${BUILD_DIR} && \ + docker run --rm -it -v `pwd`:/pkg_files -w /pkg_files -v `pwd`/dist:/dist mritd/fpm \ + fpm -s dir -t deb -n caddy2 -p /dist/caddy2_v${VERSION}.deb \ + -v ${VERSION} \ + --vendor "mritd " \ + --maintainer "mritd " \ + --after-install /pkg_files/scripts/postinstall.sh \ + --before-remove /pkg_files/scripts/preremove.sh \ + --after-remove /pkg_files/scripts/postremove.sh \ + --deb-systemd /pkg_files/lib/systemd/system/caddy.service \ + --no-deb-systemd-auto-start \ + --no-deb-systemd-restart-after-upgrade \ + etc usr lib) + mv ${BUILD_DIR}/dist/caddy2_v${VERSION}.deb . +} + +function info(){ + echo -e "\033[32mINFO: $@\033[0m" +} + +function warn(){ + echo -e "\033[33mWARN: $@\033[0m" +} + +function err(){ + echo -e "\033[31mERROR: $@\033[0m" +} + + +clean +build +create_config +package +clean From 386ff218a73c50cb4706376dc4480f96d92c9ee7 Mon Sep 17 00:00:00 2001 From: mritd Date: Sat, 2 Jan 2021 11:19:50 +0800 Subject: [PATCH 189/190] feat(caddy2_build): remove pre clean remove pre clean Signed-off-by: mritd --- caddy_build.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/caddy_build.sh b/caddy_build.sh index 09fdd4b..b1417b1 100755 --- a/caddy_build.sh +++ b/caddy_build.sh @@ -83,7 +83,6 @@ function err(){ } -clean build create_config package From 8bcd3f13d4d2eae96c0d4b69ceeec434025f381c Mon Sep 17 00:00:00 2001 From: mritd Date: Sat, 2 Jan 2021 16:03:39 +0800 Subject: [PATCH 190/190] feat(caddy2): fix tempdir fix tempdir Signed-off-by: mritd --- caddy_build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/caddy_build.sh b/caddy_build.sh index b1417b1..6b26a47 100755 --- a/caddy_build.sh +++ b/caddy_build.sh @@ -3,7 +3,7 @@ set -e VERSION=${VERSION:-"2.3.0"} -BUILD_DIR=$(mktemp) +BUILD_DIR=$(mktemp -d -t caddy2_build-XXXXXXXXXX) function clean(){ info "Clean build dir: ${BUILD_DIR}"