Commit 70d73b11 authored by tywldx's avatar tywldx

f

parent a96eb6b4
...@@ -14,5 +14,5 @@ if [ -z "$project_name" ];then ...@@ -14,5 +14,5 @@ if [ -z "$project_name" ];then
fi fi
if [ "$project_type" = "java" ]; then if [ "$project_type" = "java" ]; then
sh $pwd_path/base_script/restartJava.sh $project_name $config_server $project_path " " "\"$wechat_config\"" sh $pwd_path/base_script/restartJava.sh $project_name $config_server $project_path " " "$wechat_config"
fi fi
#!/bin/bash
pwd_path="/home/qa-deploy-utils/qa_shell_script"
config_shell_path="$pwd_path"
config_server="$pwd_path/config_server"
nginxname="/usr/local/openresty/nginx/conf/conf.d"
pwd_path_0="/home/qa-deploy-utils"
dockernamespace=`cat $pwd_path/ngrok/docker_env_name.sh`
ips=`cat $config_server/get_env_ip.sh`
rm -rf $filename
rm -rf $nginxname/*
function createNginxHttpAndSSLConf()
{
project_name=$1
cus_domain=$2
cus_ip=$3
http_port=$4
https_port=$5
file_name=$6
touch $file_name
echo "############----${project_name}----############" >> $file_name
echo "server {" >> $file_name
echo " listen 8000;" >> $file_name
echo " server_name $cus_domain.q-gp.com;" >> $file_name
echo " proxy_set_header Host \$host;" >> $file_name
echo "" >> $file_name
echo " location / {" >> $file_name
echo " proxy_pass http://$cus_ip:$http_port;" >> $file_name
echo " }" >> $file_name
echo "}" >> $file_name
echo "" >> $file_name
echo "server {" >> $file_name
echo " listen 443 ssl;" >> $file_name
echo " server_name $cus_domain.q-gp.com;" >> $file_name
echo "" >> $file_name
echo " ssl_certificate /home/q-gp/ssl/certificate.crt;" >> $file_name
echo " ssl_certificate_key /home/q-gp/ssl/private.key;" >> $file_name
echo "" >> $file_name
echo " ssl_session_cache shared:SSL:1m;" >> $file_name
echo " ssl_session_timeout 5m;" >> $file_name
echo "" >> $file_name
echo " ssl_ciphers HIGH:!aNULL:!MD5;" >> $file_name
echo " ssl_prefer_server_ciphers on;" >> $file_name
echo " proxy_set_header Host \$host;" >> $file_name
echo "" >> $file_name
echo " location / {" >> $file_name
echo " proxy_pass http://$cus_ip:$https_port;" >> $file_name
echo " }" >> $file_name
echo "}" >> $file_name
}
# addFrpcSub h5 http 192.168.4 25 7051 h5 $filename
# addFrpcSub mock http 192.168.4 27 80 mock $filename
# addFrpcSub atm http 192.168.4 18 3000 atm $filename
# addFrpcSub auth-center http 192.168.4 193 8099 auth-center-38 $filename
# addFrpcSub company http 192.168.4 27 10087 company-241 $filename
# addFrpcSub bp http 192.168.4 27 10084 bp $filename
# addFrpcSub qahelp http 192.168.4 27 8000 qahelp $filename
# addFrpcSub h5sp http 192.168.4 25 7057 h5sp-25 $filename
# addFrpcSub qg1 http 192.168.4 21 9019 qg1-21 $filename
# addFrpcSub uanguang http 192.168.4 124 80 uanguang $filename
# createNginxSSLConf store 192.168.4.27 9000 $nginxname/store.conf
createNginxSSLConf h5 h5 192.168.4.25 7051 7051 $nginxname/base.conf
createNginxSSLConf mock mock 192.168.4.27 80 80 $nginxname/base.conf
createNginxSSLConf atm atm 192.168.4.18 3000 3000 $nginxname/base.conf
createNginxSSLConf auth-center auth-center-38 192.168.4.193 8099 8099 $nginxname/base.conf
createNginxSSLConf company company-241 192.168.4.27 10087 10087 $nginxname/base.conf
createNginxSSLConf bp bp 192.168.4.27 10084 10084 $nginxname/base.conf
createNginxSSLConf qahelp qahelp 192.168.4.27 8000 8000 $nginxname/base.conf
createNginxSSLConf h5sp h5sp-25 192.168.4.25 7057 7057 $nginxname/base.conf
createNginxSSLConf qg1 qg1-21 192.168.4.21 9019 9019 $nginxname/base.conf
createNginxSSLConf qahelp qahelp 192.168.4.27 8000 8000 $nginxname/base.conf
for ip_last in ${ips[@]}
do
IP_host=`sh $pwd_path_0/get-ip.sh $ip_last`
ip_arr=(${IP_host//./ })
ipfirst="${ip_arr[0]}.${ip_arr[1]}.${ip_arr[2]}"
iplast="${ip_arr[3]}"
projectAndPorts=`node $config_server/get_project_config.js -type multi -attr port -attr2 true`
for projectAndPort in ${projectAndPorts[@]}
do
var=(${projectAndPort//|/ })
ip_last_repeat=${ip_last//./-}
project_name="${var[0]}"
sub_doman="${var[0]}-${ip_last}"
target_ip="$ipfirst.$iplast"
http_port="${var[1]}"
https_port="${var[1]}"
file_name="$nginxname/$target_ip.conf"
# createNginxHttpAndSSLConf 服务名称 二级域名 目标IP HTTP端口 HTTPS端口 目标文件
if [[ ${var[0]} != "xyqb-ui" ]] && [[ ${var[0]} != "paycenter-ui" ]];then
createNginxSSLConf $project_name $sub_doman $target_ip $http_port $https_port $file_name
fi
done
done
for host_name in ${dockernamespace[@]}
do
projectAndPorts=`node $config_server/get_project_config.js -type multi -attr port/url -attr2 true`
for projectAndPort in ${projectAndPorts[@]}
do
var=(${projectAndPort//|/ })
namespace=(${host_name//|/ })
# echo "${var[2]}/${namespace[0]}/${namespace[1]}/${namespace[2]}/${namespace[3]}"
project_name="${var[0]}"
sub_doman="${var[2]}-${namespace[0]}"
target_ip="${namespace[1]}"
http_port="${namespace[2]}"
https_port="${namespace[3]}"
file_name="$nginxname/${namespace[0]}.conf"
# createNginxHttpAndSSLConf 服务名称 二级域名 目标IP HTTP端口 HTTPS端口 目标文件
if [[ ${var[0]} != "xyqb-ui" ]] && [[ ${var[0]} != "paycenter-ui" ]];then
createNginxSSLConf $project_name $sub_doman $target_ip $http_port $https_port $file_name
fi
done
done
nginx -s reload
sh ${frp_file_path}/restart.sh
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment