Internal port

This commit is contained in:
Bob Mottram 2018-02-07 10:13:29 +00:00
parent a4cd59a1df
commit 08a14be3f6
1 changed files with 19 additions and 6 deletions

View File

@ -40,7 +40,8 @@ app_repo_commit='TODO'
app_php= app_php=
app_node= app_node=
app_onion_only= app_onion_only=
app_port='' app_port=
app_port_internal=
app_daemon= app_daemon=
app_dir= app_dir=
your_name='' your_name=''
@ -62,6 +63,7 @@ function show_help {
echo $' -r --repo [url] Git repo url for the app' echo $' -r --repo [url] Git repo url for the app'
echo $' -c --commit [hash] Git commit' echo $' -c --commit [hash] Git commit'
echo $' --port [number] Port number for the app' echo $' --port [number] Port number for the app'
echo $' --portinternal [number] Internal port between a daemon and the web server'
echo $' --node [yes|no] Is this a nodejs app?' echo $' --node [yes|no] Is this a nodejs app?'
echo $' -o --onion [yes|no] Is this app only available on an onion address?' echo $' -o --onion [yes|no] Is this app only available on an onion address?'
echo $' -p --php [yes|no] Is this a PHP app?' echo $' -p --php [yes|no] Is this a PHP app?'
@ -131,6 +133,10 @@ do
shift shift
app_port="$1" app_port="$1"
;; ;;
--portinternal|--portint)
shift
app_port_internal="$1"
;;
--dir) --dir)
shift shift
app_dir="$1" app_dir="$1"
@ -220,11 +226,18 @@ fi
echo '' echo ''
echo "${app_name_upper}_DOMAIN_NAME=" echo "${app_name_upper}_DOMAIN_NAME="
echo "${app_name_upper}_CODE=" echo "${app_name_upper}_CODE="
if [ $app_port ]; then
echo "${app_name_upper}_PORT=$app_port"
fi
echo "${app_name_upper}_ONION_PORT=$(( ( RANDOM % 1000 ) + 9010 ))" echo "${app_name_upper}_ONION_PORT=$(( ( RANDOM % 1000 ) + 9010 ))"
echo "${app_name_upper}_REPO=\"${app_repo}\"" echo "${app_name_upper}_REPO=\"${app_repo}\""
echo "${app_name_upper}_COMMIT='${app_repo_commit}'" echo "${app_name_upper}_COMMIT='${app_repo_commit}'"
if [ $app_daemon ]; then if [ $app_daemon ]; then
echo "${app_name_upper}_PORT=TODO" if [ ! $app_port_internal ]; then
echo "${app_name_upper}_PORT_INTERNAL=TODO"
else
echo "${app_name_upper}_PORT_INTERNAL=$app_port_internal"
fi
fi fi
echo '' echo ''
echo "${app_name}=(ONION_ONLY" echo "${app_name}=(ONION_ONLY"
@ -551,7 +564,7 @@ echo ' fi'
echo " remove_app ${app_name}" echo " remove_app ${app_name}"
echo " remove_completion_param install_${app_name}" echo " remove_completion_param install_${app_name}"
echo " sed -i '/${app_name}/d' \$COMPLETION_FILE" echo " sed -i '/${app_name}/d' \$COMPLETION_FILE"
if [ ${#app_port} -gt 0 ]; then if [ $app_port ]; then
echo '' echo ''
echo " firewall_remove ${app_port} tcp" echo " firewall_remove ${app_port} tcp"
fi fi
@ -677,7 +690,7 @@ if [ $app_onion_only ]; then
if [ ! $app_daemon ]; then if [ ! $app_daemon ]; then
echo " echo ' try_files \$uri \$uri/ /index.html;' >> \$${app_name}_nginx_site" echo " echo ' try_files \$uri \$uri/ /index.html;' >> \$${app_name}_nginx_site"
else else
echo " echo \" proxy_pass http://localhost:\$${app_name_upper}_PORT;\" >> \$${app_name}_nginx_site" echo " echo \" proxy_pass http://localhost:\$${app_name_upper}_PORT_INTERNAL;\" >> \$${app_name}_nginx_site"
fi fi
echo " echo ' }' >> \$${app_name}_nginx_site" echo " echo ' }' >> \$${app_name}_nginx_site"
echo " echo '}' >> \$${app_name}_nginx_site" echo " echo '}' >> \$${app_name}_nginx_site"
@ -719,7 +732,7 @@ echo " nginx_limits \$${app_name_upper}_DOMAIN_NAME '15m'"
if [ ! $app_daemon ]; then if [ ! $app_daemon ]; then
echo " echo ' try_files \$uri \$uri/ index.html;' >> \$${app_name}_nginx_site" echo " echo ' try_files \$uri \$uri/ index.html;' >> \$${app_name}_nginx_site"
else else
echo " echo \" proxy_pass http://localhost:\$${app_name_upper}_PORT;\" >> \$${app_name}_nginx_site" echo " echo \" proxy_pass http://localhost:\$${app_name_upper}_PORT_INTERNAL;\" >> \$${app_name}_nginx_site"
fi fi
echo " echo ' }' >> \$${app_name}_nginx_site" echo " echo ' }' >> \$${app_name}_nginx_site"
echo " echo '}' >> \$${app_name}_nginx_site" echo " echo '}' >> \$${app_name}_nginx_site"
@ -772,7 +785,7 @@ echo ' systemctl restart nginx'
echo '' echo ''
echo " \${PROJECT_NAME}-pass -u \$MY_USERNAME -a ${app_name} -p \"\$${app_name_upper}_ADMIN_PASSWORD\"" echo " \${PROJECT_NAME}-pass -u \$MY_USERNAME -a ${app_name} -p \"\$${app_name_upper}_ADMIN_PASSWORD\""
echo " set_completion_param \"${app_name} domain\" \"\$${app_name_upper}_DOMAIN_NAME\"" echo " set_completion_param \"${app_name} domain\" \"\$${app_name_upper}_DOMAIN_NAME\""
if [ ${#app_port} -gt 0 ]; then if [ $app_port ]; then
echo '' echo ''
echo " firewall_add ${app_name} ${app_port} tcp" echo " firewall_add ${app_name} ${app_port} tcp"
fi fi