Commit 4c19647d authored by tywldx's avatar tywldx

fix

parent 27cedbd8
...@@ -2,14 +2,13 @@ ...@@ -2,14 +2,13 @@
pwd_path="/home/qa-deploy-utils/qa_shell_script" pwd_path="/home/qa-deploy-utils/qa_shell_script"
config_shell_path="$pwd_path" config_shell_path="$pwd_path"
config_server="$pwd_path/config_server" config_server="$pwd_path/config_server"
filename=/home/quant_group/frp_0.12.0_linux_amd64/frpc_custom_new_1.ini filename="/home/quant_group/frp_0.12.0_linux_amd64/frpc_custom_new_1.ini"
nginxname=/usr/local/openresty/nginx/conf/nginx_new.conf nginxname="/usr/local/openresty/nginx/conf/conf.d"
IP_host_first="192.168.4."
ips=`cat $config_server/get_env_ip.sh` ips=`cat $config_server/get_env_ip.sh`
rm -rf $filename rm -rf $filename
function addFileHead() function addFrpcHead()
{ {
rm -rf $1
echo "[common]" >> $1 echo "[common]" >> $1
echo "server_addr = 127.0.0.1" >> $1 echo "server_addr = 127.0.0.1" >> $1
echo "server_port = 7000" >> $1 echo "server_port = 7000" >> $1
...@@ -18,93 +17,80 @@ function addFileHead() ...@@ -18,93 +17,80 @@ function addFileHead()
echo "log_level = info" >> $1 echo "log_level = info" >> $1
echo "log_max_days = 3" >> $1 echo "log_max_days = 3" >> $1
echo "" >> $1 echo "" >> $1
echo "[atm]" >> $1
echo "type = http" >> $1
echo "local_ip = 192.168.4.18" >> $1
echo "local_port = 3000" >> $1
echo "subdomain = atm" >> $1
echo "" >> $1
echo "[qg-mock]" >> $1
echo "type = http" >> $1
echo "local_ip = 172.30.199.2" >> $1
echo "local_port = 8080" >> $1
echo "subdomain = mock" >> $1
echo "" >> $1
echo "[store]" >> $1
echo "type = http" >> $1
echo "local_ip = 172.30.199.2" >> $1
echo "local_port = 9000" >> $1
echo "subdomain = store" >> $1
echo "" >> $1
echo "[h5]" >> $1
echo "type = http" >> $1
echo "local_ip = 192.168.4.15" >> $1
echo "local_port = 7051" >> $1
echo "subdomain = h5" >> $1
echo "" >> $1
echo "[local]" >> $1
echo "type = http" >> $1
echo "local_port = 8000" >> $1
echo "custom_domains = q-gp.com" >> $1
echo "locations = /" >> $1
echo "" >> $1
echo "" >> $1
echo "[localhttps]" >> $1
echo "type = https" >> $1
echo "local_port = 8001" >> $1
echo "custom_domains = q-gp.com" >> $1
echo "locations = /" >> $1
echo " [app-241]" >> $1
echo "type=http" >> $1
echo "local_ip=192.168.4.241" >> $1
echo "local_port=10087" >> $1
echo "subdomain=app-241" >> $1
echo "" >> $1
echo "[auth-center-193]" >> $1
echo "type = http" >> $1
echo "local_ip = 192.168.4.193" >> $1
echo "local_port = 8099" >> $1
echo "subdomain = auth-center-38" >> $1
} }
addFrpcHead $filename
addFileHead $filename function addFrpcSub()
function addFile2()
{ {
echo "$1 $2 $3 $4" sub_domain=$1
echo "[web-$2-$1-http]" >> $4 sub_type=$2
echo "type = http" >> $4 sub_ip_first=$3
echo "local_ip = 192.168.4.$1" >> $4 sub_ip_last=$4
echo "local_port = 1$3" >> $4 sub_port=$5
echo "subdomain = $2" >> $4 sub_custom_domain=$6
echo "[web-$2-$1-https]" >> $4 sub_file=$7
echo "type = https" >> $4
echo "local_ip = 192.168.4.$1" >> $4 echo "" >>$sub_file
echo "local_port = 2$3" >> $4 echo "[$sub_domain-$sub_ip_last]" >> $sub_file
echo "subdomain = $2" >> $4 echo "type = $sub_type" >> $sub_file
echo "local_ip = $sub_ip_first.$sub_ip_last" >> $sub_file
echo "local_port = $sub_port" >> $sub_file
echo "subdomain = $sub_custom_domain" >> $sub_file
} }
function addFrpcLoc()
{
sub_domain=$1
sub_type=$2
sub_port=$3
cus_domain=$4
sub_loc=$5
sub_file=$6
echo "" >> $sub_file
echo "[$sub_domain]" >> $sub_file
echo "type = $sub_type" >> $sub_file
echo "local_port = $sub_port" >> $sub_file
echo "custom_domains = $cus_domain" >> $sub_file
echo "locations = $sub_loc" >> $sub_file
}
#projectAndPort=`node $config_server/get_project_config.js -type multi -attr port` addFrpcLoc local_ http 8000 q-gp.com $filename
#for projectAndPort in ${projectAndPort[@]}
#do addFrpcSub h5 http 192.168.4 15 7051 h5-15 $filename
# var=${projectAndPort//|/ } addFrpcSub mock http 172.30.199 2 8080 mock $filename
# addFile2 25 $var $filename addFrpcSub atm http 192.168.4 18 3000 atm $filename
#done addFrpcSub auth-center http 192.168.4 193 8099 auth-center-38 $filename
function addFile()
{
echo "$1 $2 $3 $4"
echo "[web-$2-$1]" >> $4
echo "type = http" >> $4
echo "local_ip = 192.168.4.$1" >> $4
echo "local_port = $3" >> $4
echo "subdomain = $2-$1" >> $4
}
function createNginxSSLConf() function createNginxSSLConf()
{ {
cus_domain=$1
cus_ip=$2
cus_port=$3
file_name=$4
rm -rf $file_name
touch $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 "" >> $file_name
echo " location / {" >> $file_name
echo " proxy_pass http://$cus_ip:$cus_port;" >> $file_name
echo " }" >> $file_name
echo "}" >> $file_name
rm -rf
} }
# projectAndPort=`node $config_server/get_project_config.js -type multi -attr port` # projectAndPort=`node $config_server/get_project_config.js -type multi -attr port`
...@@ -114,8 +100,9 @@ do ...@@ -114,8 +100,9 @@ do
projectAndPort=`node $config_server/get_project_config.js -type multi -attr port` projectAndPort=`node $config_server/get_project_config.js -type multi -attr port`
for projectAndPort in ${projectAndPort[@]} for projectAndPort in ${projectAndPort[@]}
do do
var=${projectAndPort//|/ } var=(${projectAndPort//|/ })
addFile $ip_last $var $filename addFrpcSub ${var[0]} http 192.168.4 $ip_last ${var[1]} ${var[0]}-${ip_last} $filename
createNginxSSLConf ${var[0]}-${ip_last} 192.168.4.$ip_last ${var[1]} $nginxname/${var[0]}-${ip_last}.conf
done done
done done
......
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