Skip to content

Commit

Permalink
[fix] Update
Browse files Browse the repository at this point in the history
  • Loading branch information
bypanelcom committed Oct 2, 2021
1 parent a668866 commit c267cea
Show file tree
Hide file tree
Showing 58 changed files with 515 additions and 173 deletions.
20 changes: 20 additions & 0 deletions config/nginx.conf
Expand Up @@ -62,6 +62,26 @@ http {
#open_file_cache_min_uses 2;
#open_file_cache_errors on;

log_format json escape=json '{"@timestamp":"$time_iso8601",'
'"server_addr":"$server_addr",'
'"remote_addr":"$remote_addr",'
'"scheme":"$scheme",'
'"request_method":"$request_method",'
'"request_uri": "$request_uri",'
'"request_length": "$request_length",'
'"uri": "$uri", '
'"request_time":$request_time,'
'"body_bytes_sent":$body_bytes_sent,'
'"bytes_sent":$bytes_sent,'
'"status":"$status",'
'"upstream_time":"$upstream_response_time",'
'"upstream_host":"$upstream_addr",'
'"upstream_status":"$upstream_status",'
'"host":"$host",'
'"http_referer":"$http_referer",'
'"http_user_agent":"$http_user_agent"'
'}';

######################## default ############################
server {
listen 80;
Expand Down
20 changes: 20 additions & 0 deletions config/nginx_apache.conf
Expand Up @@ -62,6 +62,26 @@ http {
#open_file_cache_min_uses 2;
#open_file_cache_errors on;

log_format json escape=json '{"@timestamp":"$time_iso8601",'
'"server_addr":"$server_addr",'
'"remote_addr":"$remote_addr",'
'"scheme":"$scheme",'
'"request_method":"$request_method",'
'"request_uri": "$request_uri",'
'"request_length": "$request_length",'
'"uri": "$uri", '
'"request_time":$request_time,'
'"body_bytes_sent":$body_bytes_sent,'
'"bytes_sent":$bytes_sent,'
'"status":"$status",'
'"upstream_time":"$upstream_response_time",'
'"upstream_host":"$upstream_addr",'
'"upstream_status":"$upstream_status",'
'"host":"$host",'
'"http_referer":"$http_referer",'
'"http_user_agent":"$http_user_agent"'
'}';

######################## default ############################
server {
listen 80;
Expand Down
20 changes: 20 additions & 0 deletions config/nginx_tomcat.conf
Expand Up @@ -62,6 +62,26 @@ http {
#open_file_cache_min_uses 2;
#open_file_cache_errors on;

log_format json escape=json '{"@timestamp":"$time_iso8601",'
'"server_addr":"$server_addr",'
'"remote_addr":"$remote_addr",'
'"scheme":"$scheme",'
'"request_method":"$request_method",'
'"request_uri": "$request_uri",'
'"request_length": "$request_length",'
'"uri": "$uri", '
'"request_time":$request_time,'
'"body_bytes_sent":$body_bytes_sent,'
'"bytes_sent":$bytes_sent,'
'"status":"$status",'
'"upstream_time":"$upstream_response_time",'
'"upstream_host":"$upstream_addr",'
'"upstream_status":"$upstream_status",'
'"host":"$host",'
'"http_referer":"$http_referer",'
'"http_user_agent":"$http_user_agent"'
'}';

######################## default ############################
server {
listen 80;
Expand Down
12 changes: 9 additions & 3 deletions include/apache.sh
Expand Up @@ -53,9 +53,14 @@ Install_Apache() {
rm -rf nghttp2-${nghttp2_ver}
fi

if openssl version | grep -Eqi 'OpenSSL 1.1'; then
with_ssl="--with-ssl"
else
with_old_ssl_flag='y'
with_ssl="--with-ssl=${openssl_install_dir}"
fi
pushd httpd-${apache_ver} > /dev/null
[ ! -d "${apache_install_dir}" ] && mkdir -p ${apache_install_dir}
LDFLAGS=-ldl ./configure --prefix=${apache_install_dir} --enable-mpms-shared=all --with-pcre --with-apr=${apr_install_dir} --with-apr-util=${apr_install_dir} --enable-headers --enable-mime-magic --enable-deflate --enable-proxy --enable-so --enable-dav --enable-rewrite --enable-remoteip --enable-expires --enable-static-support --enable-suexec --enable-mods-shared=most --enable-nonportable-atomics=yes --enable-ssl --with-ssl=${openssl_install_dir} --enable-http2 --with-nghttp2=/usr/local
LDFLAGS=-ldl ./configure --prefix=${apache_install_dir} --enable-mpms-shared=all --with-pcre --with-apr=${apr_install_dir} --with-apr-util=${apr_install_dir} --enable-headers --enable-mime-magic --enable-deflate --enable-proxy --enable-so --enable-dav --enable-rewrite --enable-remoteip --enable-expires --enable-static-support --enable-suexec --enable-mods-shared=most --enable-nonportable-atomics=yes --enable-ssl ${with_ssl} --enable-http2 --with-nghttp2=/usr/local
make -j ${THREAD} && make install
popd > /dev/null
unset LDFLAGS
Expand All @@ -65,7 +70,7 @@ Install_Apache() {
else
rm -rf ${apache_install_dir}
echo "${CFAILURE}Apache install failed, Please contact the author! ${CEND}" && lsb_release -a
kill -9 $$
kill -9 $$; exit 1;
fi

[ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=${apache_install_dir}/bin:\$PATH" >> /etc/profile
Expand Down Expand Up @@ -194,6 +199,7 @@ EOF
sed -i "s@LogFormat \"%h %l@LogFormat \"%h %a %l@g" ${apache_install_dir}/conf/httpd.conf
fi
ldconfig
[ "${with_old_ssl_flag}" == 'y' ] && sed -i "s@^export LD_LIBRARY_PATH.*@export LD_LIBRARY_PATH=${openssl_install_dir}/lib:\$LD_LIBRARY_PATH@" ${apache_install_dir}/bin/envvars
service httpd start
popd > /dev/null
}
51 changes: 27 additions & 24 deletions include/check_download.sh
Expand Up @@ -17,21 +17,19 @@ checkDownload() {
fi

# General system utils

# openssl
if [[ "${tomcat_option}" =~ ^[1-4]$ ]] || [ "${apache_flag}" == 'y' ] || [[ "${php_flag}" == 'y' ]] || "${mphp_flag}" == 'y' || [[ "${nginx_option}" =~ ^[1-3]$ ]]; then
# Only the deprecated PHP5 requires openssl 1.0.2
if [[ "${php_option}" =~ ^[1-4]$ ]] || [[ "${mphp_ver}" =~ ^5[3-6]$ ]]; then
echo "Download openSSL 1.0.2..."
src_url=https://www.openssl.org/source/old/1.0.2/openssl-${openssl_ver}.tar.gz && Download_src
else
echo "Download openSSL 1.1..."
src_url=https://www.openssl.org/source/openssl-${openssl11_ver}.tar.gz && Download_src
fi
if [[ ${tomcat_option} =~ ^[1-4]$ ]] || [ "${apache_flag}" == 'y' ] || [[ ${php_option} =~ ^[1-9]$|^1[0-1]$ ]]; then
echo "Download openSSL..."
src_url=https://www.openssl.org/source/old/1.0.2/openssl-${openssl_ver}.tar.gz && Download_src
echo "Download cacert.pem..."
src_url=https://curl.se/ca/cacert.pem && Download_src
fi

# openssl1.1
if [[ ${nginx_option} =~ ^[1-3]$ ]]; then
echo "Download openSSL1.1..."
src_url=https://www.openssl.org/source/openssl-${openssl11_ver}.tar.gz && Download_src
fi

# jemalloc
if [[ ${nginx_option} =~ ^[1-3]$ ]] || [[ "${db_option}" =~ ^[1-9]$|^1[0-2]$ ]]; then
echo "Download jemalloc..."
Expand Down Expand Up @@ -159,7 +157,7 @@ checkDownload() {
done
if [ "${tryDlCount}" == '6' ]; then
echo "${CFAILURE}${FILE_NAME} download failed, Please contact the author! ${CEND}"
kill -9 $$
kill -9 $$; exit 1;
fi
;;
2)
Expand Down Expand Up @@ -194,7 +192,7 @@ checkDownload() {
done
if [ "${tryDlCount}" == '6' ]; then
echo "${CFAILURE}${FILE_NAME} download failed, Please contact the author! ${CEND}"
kill -9 $$
kill -9 $$; exit 1;
fi
;;
3)
Expand Down Expand Up @@ -229,7 +227,7 @@ checkDownload() {
done
if [ "${tryDlCount}" == '6' ]; then
echo "${CFAILURE}${FILE_NAME} download failed, Please contact the author! ${CEND}"
kill -9 $$
kill -9 $$; exit 1;
fi
;;
4)
Expand Down Expand Up @@ -265,7 +263,7 @@ checkDownload() {
done
if [ "${tryDlCount}" == '6' ]; then
echo "${CFAILURE}${FILE_NAME} download failed, Please contact the author! ${CEND}"
kill -9 $$
kill -9 $$; exit 1;
fi
;;
[5-8])
Expand Down Expand Up @@ -318,7 +316,7 @@ checkDownload() {
done
if [ "${tryDlCount}" == '6' ]; then
echo "${CFAILURE}${FILE_NAME} download failed, Please contact the author! ${CEND}"
kill -9 $$
kill -9 $$; exit 1;
fi
;;
9)
Expand Down Expand Up @@ -350,7 +348,7 @@ checkDownload() {
done
if [ "${tryDlCount}" == '6' ]; then
echo "${CFAILURE}${FILE_NAME} download failed, Please contact the author! ${CEND}"
kill -9 $$
kill -9 $$; exit 1;
fi
;;
10)
Expand Down Expand Up @@ -382,7 +380,7 @@ checkDownload() {
done
if [ "${tryDlCount}" == '6' ]; then
echo "${CFAILURE}${FILE_NAME} download failed, Please contact the author! ${CEND}"
kill -9 $$
kill -9 $$; exit 1;
fi
;;
11)
Expand Down Expand Up @@ -415,7 +413,7 @@ checkDownload() {
done
if [ "${tryDlCount}" == '6' ]; then
echo "${CFAILURE}${FILE_NAME} download failed, Please contact the author! ${CEND}"
kill -9 $$
kill -9 $$; exit 1;
fi
;;
12)
Expand Down Expand Up @@ -448,7 +446,7 @@ checkDownload() {
done
if [ "${tryDlCount}" == '6' ]; then
echo "${CFAILURE}${FILE_NAME} download failed, Please contact the author! ${CEND}"
kill -9 $$
kill -9 $$; exit 1;
fi
;;
13)
Expand All @@ -472,7 +470,7 @@ checkDownload() {
done
if [ "${tryDlCount}" == '6' ]; then
echo "${CFAILURE}${FILE_NAME} download failed, Please contact the author! ${CEND}"
kill -9 $$
kill -9 $$; exit 1;
fi
;;
14)
Expand All @@ -496,14 +494,14 @@ checkDownload() {
done
if [ "${tryDlCount}" == '6' ]; then
echo "${CFAILURE}${FILE_NAME} download failed, Please contact the author! ${CEND}"
kill -9 $$
kill -9 $$; exit 1;
fi
;;
esac
fi

# PHP
if [[ "${php_option}" =~ ^[1-9]$|^10$ ]] || [[ "${mphp_ver}" =~ ^5[3-6]$|^7[0-4]$|^80$ ]]; then
if [[ "${php_option}" =~ ^[1-9]$|^1[0-1]$ ]] || [[ "${mphp_ver}" =~ ^5[3-6]$|^7[0-4]$|^8[0-1]$ ]]; then
echo "PHP common..."
src_url=${mirrorLink}/libiconv-${libiconv_ver}.tar.gz && Download_src
src_url=https://curl.haxx.se/download/curl-${curl_ver}.tar.gz && Download_src
Expand Down Expand Up @@ -548,6 +546,11 @@ checkDownload() {
src_url=http://mirrors.linuxeye.com/oneinstack/src/argon2-${argon2_ver}.tar.gz && Download_src
src_url=http://mirrors.linuxeye.com/oneinstack/src/libsodium-${libsodium_ver}.tar.gz && Download_src
src_url=http://mirrors.linuxeye.com/oneinstack/src/libzip-${libzip_ver}.tar.gz && Download_src
elif [ "${php_option}" == '11' ] || [ "${mphp_ver}" == '81' ]; then
src_url=https://secure.php.net/distributions/php-${php81_ver}.tar.gz && Download_src
src_url=http://mirrors.linuxeye.com/oneinstack/src/argon2-${argon2_ver}.tar.gz && Download_src
src_url=http://mirrors.linuxeye.com/oneinstack/src/libsodium-${libsodium_ver}.tar.gz && Download_src
src_url=http://mirrors.linuxeye.com/oneinstack/src/libzip-${libzip_ver}.tar.gz && Download_src
fi

# PHP OPCache
Expand Down Expand Up @@ -727,7 +730,7 @@ checkDownload() {
# phpMyAdmin
if [ "${phpmyadmin_flag}" == 'y' ]; then
echo "Download phpMyAdmin..."
if [[ "${php_option}" =~ ^[1-5]$ ]]; then
if [[ "${php_option}" =~ ^[1-5]$ ]] || [[ "${mphp_ver}" =~ ^5[3-6]$|^70$ ]]; then
src_url=https://files.phpmyadmin.net/phpMyAdmin/${phpmyadmin_oldver}/phpMyAdmin-${phpmyadmin_oldver}-all-languages.tar.gz && Download_src
else
src_url=https://files.phpmyadmin.net/phpMyAdmin/${phpmyadmin_ver}/phpMyAdmin-${phpmyadmin_ver}-all-languages.tar.gz && Download_src
Expand Down
14 changes: 6 additions & 8 deletions include/check_os.sh
Expand Up @@ -19,11 +19,7 @@ if [ -e "/usr/bin/yum" ]; then
if [ -e "/etc/euleros-release" ]; then
yum -y install euleros-lsb
elif [ -e "/etc/openEuler-release" -o -e "/etc/openeuler-release" ]; then
if [ -n "$(grep -w '"20.03"' /etc/os-release)" ]; then
rpm -Uvh https://repo.openeuler.org/openEuler-20.03-LTS-SP1/everything/aarch64/Packages/openeuler-lsb-5.0-1.oe1.aarch64.rpm
else
yum -y install openeuler-lsb
fi
yum -y install openeuler-lsb
else
yum -y install redhat-lsb-core
fi
Expand All @@ -36,15 +32,17 @@ if [ -e "/usr/bin/apt-get" ]; then
command -v lsb_release >/dev/null 2>&1 || { apt-get -y update > /dev/null; apt-get -y install lsb-release; clear; }
fi

command -v lsb_release >/dev/null 2>&1 || { echo "${CFAILURE}${PM} source failed! ${CEND}"; kill -9 $$; }
command -v lsb_release >/dev/null 2>&1 || { echo "${CFAILURE}${PM} source failed! ${CEND}"; kill -9 $$; exit 1; }
[ -e "/etc/anolis-release" ] && { command -v lsb_release >/dev/null 2>&1 || yum -y install system-lsb-core; }

# Get OS Version
OS=$(lsb_release -is)
if [[ "${OS}" =~ ^CentOS$|^CentOSStream$|^RedHat$|^Rocky$|^Fedora$|^Amazon$|^AlibabaCloud$|^AlibabaCloud\(AliyunLinux\)$|^EulerOS$|^openEuler$ ]]; then
if [[ "${OS}" =~ ^CentOS$|^CentOSStream$|^RedHat$|^Rocky$|^Fedora$|^Amazon$|^AlibabaCloud$|^AlibabaCloud\(AliyunLinux\)$|^AnolisOS$|^EulerOS$|^openEuler$ ]]; then
LikeOS=RHEL
RHEL_ver=$(lsb_release -rs | awk -F. '{print $1}' | awk '{print $1}')
[[ "${OS}" =~ ^Fedora$ ]] && [ ${RHEL_ver} -ge 19 >/dev/null 2>&1 ] && { RHEL_ver=7; Fedora_ver=$(lsb_release -rs); }
[[ "${OS}" =~ ^Amazon$|^EulerOS$|^openEuler$ ]] && RHEL_ver=7
[[ "${OS}" =~ ^openEuler$ ]] && [[ "${RHEL_ver}" =~ ^21$ ]] && RHEL_ver=8
[[ "${OS}" =~ ^AlibabaCloud$|^AlibabaCloud\(AliyunLinux\)$ ]] && [[ "${RHEL_ver}" =~ ^2$ ]] && RHEL_ver=7
[[ "${OS}" =~ ^AlibabaCloud$|^AlibabaCloud\(AliyunLinux\)$ ]] && [[ "${RHEL_ver}" =~ ^3$ ]] && RHEL_ver=8
elif [[ "${OS}" =~ ^Debian$|^Deepin$|^Uos$|^Kali$ ]]; then
Expand All @@ -69,7 +67,7 @@ fi
# Check OS Version
if [ ${RHEL_ver} -lt 6 >/dev/null 2>&1 ] || [ ${Debian_ver} -lt 8 >/dev/null 2>&1 ] || [ ${Ubuntu_ver} -lt 16 >/dev/null 2>&1 ]; then
echo "${CFAILURE}Does not support this OS, Please install CentOS 6+,Debian 8+,Ubuntu 16+ ${CEND}"
kill -9 $$
kill -9 $$; exit 1;
fi

command -v gcc > /dev/null 2>&1 || $PM -y install gcc
Expand Down
6 changes: 3 additions & 3 deletions include/check_sw.sh
Expand Up @@ -46,7 +46,7 @@ installDepsDebian() {
;;
*)
echo "${CFAILURE}Your system Debian ${Debian_ver} are not supported!${CEND}"
kill -9 $$
kill -9 $$; exit 1;
;;
esac
for Package in ${pkgList}; do
Expand Down Expand Up @@ -82,7 +82,7 @@ installDepsRHEL() {

echo "${CMSG}Installing dependencies packages...${CEND}"
# Install needed packages
pkgList="deltarpm gcc gcc-c++ make cmake autoconf libjpeg libjpeg-devel libjpeg-turbo libjpeg-turbo-devel libpng libpng-devel libxml2 libxml2-devel zlib zlib-devel libzip libzip-devel glibc glibc-devel krb5-devel libc-client libc-client-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel libaio numactl numactl-libs readline-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5-devel libidn libidn-devel openssl openssl-devel net-tools libxslt-devel libicu-devel libevent-devel libtool libtool-ltdl bison gd-devel vim-enhanced pcre-devel libmcrypt libmcrypt-devel mhash mhash-devel mcrypt zip unzip ntpdate sqlite-devel sysstat patch bc expect expat-devel oniguruma oniguruma-devel libtirpc-devel nss rsync rsyslog git lsof lrzsz psmisc wget which libatomic tmux"
pkgList="deltarpm gcc gcc-c++ make cmake autoconf libjpeg libjpeg-devel libjpeg-turbo libjpeg-turbo-devel libpng libpng-devel libxml2 libxml2-devel zlib zlib-devel libzip libzip-devel glibc glibc-devel krb5-devel libc-client libc-client-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel libaio numactl numactl-libs readline-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5-devel libidn libidn-devel openssl openssl-devel net-tools libxslt-devel libicu-devel libevent-devel libtool libtool-ltdl bison gd-devel vim-enhanced pcre-devel libmcrypt libmcrypt-devel mhash mhash-devel mcrypt zip unzip ntpdate sqlite-devel sysstat patch bc expect expat-devel oniguruma oniguruma-devel libtirpc-devel nss libnsl rsync rsyslog git lsof lrzsz psmisc wget which libatomic tmux"
for Package in ${pkgList}; do
yum -y install ${Package}
done
Expand Down Expand Up @@ -149,7 +149,7 @@ installDepsBySrc() {
echo 'already initialize' > ~/.oneinstack
else
echo "${CFAILURE}${PM} config error parsing file failed${CEND}"
kill -9 $$
kill -9 $$; exit 1;
fi

popd > /dev/null
Expand Down
2 changes: 1 addition & 1 deletion include/download.sh
Expand Up @@ -12,6 +12,6 @@ Download_src() {
[ -s "${src_url##*/}" ] && echo "[${CMSG}${src_url##*/}${CEND}] found" || { wget --limit-rate=100M --tries=6 -c --no-check-certificate ${src_url}; sleep 1; }
if [ ! -e "${src_url##*/}" ]; then
echo "${CFAILURE}Auto download failed! You can manually download ${src_url} into the oneinstack/src directory.${CEND}"
kill -9 $$
kill -9 $$; exit 1;
fi
}
14 changes: 8 additions & 6 deletions include/get_ipaddr_state.py
Expand Up @@ -10,14 +10,16 @@
try:
socket.setdefaulttimeout(5)
if len(sys.argv) == 1:
apiurl = "http://ip-api.com/json"
apiurl = "http://ip.geo.iqiyi.com/cityjson?format=json"
elif len(sys.argv) == 2:
apiurl = "http://ip-api.com/json/%s" % sys.argv[1]
apiurl = "http://ip.geo.iqiyi.com/cityjson?format=json&ip=%s" % sys.argv[1]
content = request.urlopen(apiurl).read().decode('utf-8')
content = json.JSONDecoder().decode(content)
if content['status'] == 'success':
print(content['countryCode'])
else:
print("CN")
#print(content)
if content['code'] == 'A00000':
if content['data']['country_id'] == 48:
print("CN")
else:
print(content['data']['country'])
except:
print("Usage:%s IP" % sys.argv[0])
2 changes: 1 addition & 1 deletion include/jdk-1.6.sh
Expand Up @@ -30,7 +30,7 @@ Install_JDK16() {
echo "${CSUCCESS}$JDK_NAME installed successfully! ${CEND}"
else
echo "${CFAILURE}JDK install failed, Please contact the author! ${CEND}" && lsb_release -a
kill -9 $$
kill -9 $$; exit 1;
fi
popd
}
2 changes: 1 addition & 1 deletion include/jdk-1.7.sh
Expand Up @@ -29,7 +29,7 @@ Install_JDK17() {
else
rm -rf $JAVA_dir
echo "${CFAILURE}JDK install failed, Please contact the author! ${CEND}" && lsb_release -a
kill -9 $$
kill -9 $$; exit 1;
fi
popd
}

0 comments on commit c267cea

Please sign in to comment.