From 295f2a9716eb72eb8b0124cf8625c6e8afb45308 Mon Sep 17 00:00:00 2001 From: edulucio Date: Fri, 16 Jun 2017 15:35:13 -0300 Subject: [PATCH] Várias melhorias e correções! By Questor --- .directory | 6 +++--- LBGenerator.tar.gz | Bin 2431474 -> 0 bytes ez_i.bash | 144 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- install.bash | 192 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------------------------------------------------------------------------------------------------- liblightbase.tar.gz | Bin 767103 -> 0 bytes other-srcs-n-apps/lbg.conf-ngix-uwsgi-dist | 6 +++--- py-packs-LBGenerator.bash | 2 +- py-packs-liblightbase.bash | 2 +- py-packs-supervisor.bash | 2 +- py-packs-uwsgi.bash | 2 +- 10 files changed, 227 insertions(+), 129 deletions(-) diff --git a/.directory b/.directory index 4a3b926..ed63c19 100755 --- a/.directory +++ b/.directory @@ -1,5 +1,5 @@ [Dolphin] -Timestamp=2017,3,7,14,56,41 -Version=3 +Timestamp=2017,6,16,15,30,52 +Version=4 ViewMode=1 -VisibleRoles=Details_text,Details_size,Details_date,Details_type,CustomizedDetails +VisibleRoles=Details_text,Details_size,Details_modificationtime,Details_type,CustomizedDetails diff --git a/LBGenerator.tar.gz b/LBGenerator.tar.gz index 37f442d..1fe58f1 100644 Binary files a/LBGenerator.tar.gz and b/LBGenerator.tar.gz differ diff --git a/ez_i.bash b/ez_i.bash index 3b50cfb..681d774 100755 --- a/ez_i.bash +++ b/ez_i.bash @@ -1257,7 +1257,7 @@ f_srv_memory() { : 'Informar sobre a memória do servidor. Returns: - F_SRV_MEMORY_R (int): Quantidade de memória RAM do servidor em KBs. + F_SRV_MEMORY_R (int): Quantidade de memória RAM do servidor em KB. ' f_get_stderr_stdout "cat /proc/meminfo" @@ -1268,6 +1268,148 @@ f_srv_memory() { F_SRV_MEMORY_R=$F_STR_TRIM_R } +F_GET_PERCENT_FROM_R=0 +f_get_percent_from() { + : 'Obter percentagem de um valor informado. + + Args: + VAL_GET_PERCENT_P (int): Valor a partir do qual será obtida a + percentagem. + PERCENT_VAL_P (int): Valor de percentagem a ser obtido. + REM_FLOAT_POINT_P (Optional[int]): 0 - Não remove ponto flutuante; 1 - + remove ponto flutuante (se o valor obtido for maior ou igual a 1). + Padrão 1. + + Returns: + F_GET_PERCENT_FROM_R (int): Porcentagem obtida. + ' + + VAL_GET_PERCENT_P=$1 + PERCENT_VAL_P=$2 + REM_FLOAT_POINT_P=$3 + if [ -z "$REM_FLOAT_POINT_P" ] ; then + REM_FLOAT_POINT_P=1 + fi + + # NOTA: A estratégia abaixo foi utilizada pq o bash por padrão não + # permite cálculo de ponto flutuante! By Questor + F_GET_PERCENT_FROM_R=$(awk '{printf("%.5f\n",($1*($2/100)))}' <<<" $VAL_GET_PERCENT_P $PERCENT_VAL_P ") + + F_GET_PERCENT_FROM_R=${F_GET_PERCENT_FROM_R} + if [ ${REM_FLOAT_POINT_P} -eq 1 ] ; then + + # NOTA: Técnica para comparar valores com ponto flutuante! By Questor + if [ $(awk '{printf($1 >= $2) ? 1 : 0}' <<<" $VAL_GET_PERCENT_P 1 ") -eq 1 ] ; then + + # NOTA: A estratégia abaixo foi utilizada para arredondar o valor + # (remover o ponto flutuante)! By Questor + F_GET_PERCENT_FROM_R=${F_GET_PERCENT_FROM_R%\.*} + fi + fi +} + +F_BYTES_N_UNITS_R=0 +f_bytes_n_units() { + : 'Converter bytes entre suas diversas unidades. + + Args: + F_VAL_TO_CONV (int): Valor em bytes a se convertido. + F_FROM_UNIT (str): Unidade em que o valor está (B, KB, MB, GB, TB e PB). + F_TO_UNIT (str): Unidade para a qual se quer converter o valor (B, KB, + MB, GB, TB e PB). + + Returns: + F_BYTES_N_UNITS_R (int/float): Valor convertido para a unidade desejada. + ' + + # NOTE: + # Unit Equivalent + # 1 kilobyte (KB) 1,024 bytes + # 1 megabyte (MB) 1,048,576 bytes + # 1 gigabyte (GB) 1,073,741,824 bytes + # 1 terabyte (TB) 1,099,511,627,776 bytes + # 1 petabyte (PB) 1,125,899,906,842,624 bytes + # By Questor + + F_VAL_TO_CONV=$1 + F_FROM_UNIT=$2 + F_TO_UNIT=$3 + + CONV_LOOPS=0 + UNIT_FACTOR_0=0 + while [ ${CONV_LOOPS} -le 1 ] ; do + UNIT_FACTOR=0 + if [ ${CONV_LOOPS} -eq 0 ] ; then + UNIT_NOW=$F_FROM_UNIT + else + UNIT_NOW=$F_TO_UNIT + fi + case "$UNIT_NOW" in + B) + UNIT_FACTOR=0 + ;; + KB) + UNIT_FACTOR=1 + ;; + MB) + UNIT_FACTOR=2 + ;; + GB) + UNIT_FACTOR=3 + ;; + TB) + UNIT_FACTOR=4 + ;; + PB) + UNIT_FACTOR=5 + ;; + esac + if [ ${CONV_LOOPS} -eq 0 ] ; then + UNIT_FACTOR_0=$UNIT_FACTOR + else + UNIT_FACTOR=$(awk '{printf($1-$2)}' <<<" $UNIT_FACTOR_0 $UNIT_FACTOR ") + F_VAL_TO_CONV=$(awk '{printf("%.5f\n",($1*(1024^$2)))}' <<<" $F_VAL_TO_CONV $UNIT_FACTOR ") + fi + ((CONV_LOOPS++)) + done + + # NOTE: Remover zeros denecessários (Ex.: 0.05000 -> 0.05)! + F_VAL_TO_CONV=$(echo $F_VAL_TO_CONV | sed 's/0\{1,\}$//') + + # NOTE: Remover ponto flutuante quando não necessário (Ex.: 5.00000 -> 5)! + if [ $(echo $F_VAL_TO_CONV | awk '$0-int($0){print 0;next}{print 1}') -eq 1 ] ; then + F_VAL_TO_CONV=${F_VAL_TO_CONV%\.*} + fi + + F_BYTES_N_UNITS_R=$F_VAL_TO_CONV +} + +F_PROCS_QTT_R=0 +f_procs_qtt() { + : 'Determine the amount of processes on a server. + + Args: + F_MULT_FACTOR (Optional[int]): Multiplying factor over the number of + processes on the server. Default 1. + + Returns: + F_PROCS_QTT_R (int): Number of server processes multiplied by a factor + if informed. + ' + + F_MULT_FACTOR=$1 + if [ -z "$F_MULT_FACTOR" ] ; then + F_MULT_FACTOR=1 + fi + f_get_stderr_stdout "nproc" + if [[ $F_GET_STDERR_R == "" ]]; then + F_PROCS_QTT_R=$(( F_GET_STDOUT_R * F_MULT_FACTOR )) + else + f_enter_to_cont "An error occurred when trying to determine an appropriate amount of processes to use on this server! ERROR: \"$F_GET_STDERR_R$F_GET_STDOUT_R\"." + f_error_exit + fi +} + # < -------------------------------------------------------------------------- # > -------------------------------------------------------------------------- diff --git a/install.bash b/install.bash index 1bd4295..2e09cc9 100755 --- a/install.bash +++ b/install.bash @@ -25,7 +25,7 @@ LBG - LBGenerator Installer EOF read -d '' VERSION_F <<"EOF" -0.7.0.0 +0.8.0.0 EOF # NOTE: Para versionamento usar "MAJOR.MINOR.REVISION.BUILDNUMBER"! @@ -1056,41 +1056,6 @@ f_create_ve32() { # < ----------------------------------------- # > ----------------------------------------- -# Determine an appropriate amount of processes! - -PROCESSES_QTT=0 -f_num_for_procs() { - : 'Determine an appropriate amount of processes.' - - if (( PROCESSES_QTT == 0 )) ; then - f_get_stderr_stdout "nproc" - if [[ $F_GET_STDERR_R == "" ]]; then - - # NOTE: Esse é o cálculo recomendado segundo algumas fontes. Eu - # preferi fazer pelo dobro da quantidade de "cores" obtidas! - # By Questor - # (2 Workers * CPU Cores) + 1 - # --------------------------- - # Para 1 core -> (2*1)+1 = 3 - # Para 2 cores -> (2*2)+1 = 5 - # Para 4 cores -> (2*4)+1 = 9 - PROCESSES_QTT=$(( F_GET_STDOUT_R * 2 )) - f_div_section - f_get_usr_input "The recommended amount of processes to use on this server is \"$PROCESSES_QTT\". -Use empty for \"$PROCESSES_QTT\" (recommended)!" 1 - if [ -n "$GET_USR_INPUT_R" ] ; then - PROCESSES_QTT=$GET_USR_INPUT_R - fi - else - f_enter_to_cont "An error occurred when trying to determine an appropriate amount of processes to use on this server! ERROR: \"$F_GET_STDERR_R$F_GET_STDOUT_R\"." - f_error_exit - fi - fi -} - -# < ----------------------------------------- - -# > ----------------------------------------- # Instalar o NGINX (nginx)! NGINX_INST=0 @@ -1193,8 +1158,9 @@ f_inst_nginx() { \cp "$SCRIPTDIR_V/other-srcs-n-apps/nginx.conf-dist" "/etc/nginx/nginx.conf" # NOTE: Determinar um número adequado de processos! By Questor - f_num_for_procs - f_ez_sed "" "$PROCESSES_QTT" "/etc/nginx/nginx.conf" + f_procs_qtt 2 + + f_ez_sed "" "$F_PROCS_QTT_R" "/etc/nginx/nginx.conf" f_ez_sed "" "$NGINX_PORT" "/etc/nginx/nginx.conf" if [[ "$DISTRO_TYPE" == "DEB" ]] ; then f_ez_sed "" "\n include /etc/nginx/sites-enabled/*;" "/etc/nginx/nginx.conf" @@ -1565,13 +1531,13 @@ f_inst_lib() { f_yes_no "Install the LIB - liblightbase?" if [ ${EZ_I_SKIP_ON_V} -eq 1 ] || [ ${YES_NO_R} -eq 1 ] ; then EZ_I_SKIP_ON_V=$FAST_INST - f_inst_lib_py_packs 1 f_chk_by_path_hlp "$BASE_INST_DIR_V/ve32/src/liblightbase" "d" "\"liblightbase\" already installed in \"$BASE_INST_DIR_V/ve32/src\"!" F_BAK_MD_R=1 if [ ${F_CHK_BY_PATH_HLP_R} -eq 1 ] ; then f_ez_mv_bak "$BASE_INST_DIR_V/ve32/src/liblightbase" "Backup old version and update? (\"y\" recommended)" fi if [ ${F_BAK_MD_R} -eq 1 ] ; then + f_inst_lib_py_packs 1 cd "$SCRIPTDIR_V" tar -zxvf liblightbase.tar.gz mv "$SCRIPTDIR_V/liblightbase" "$BASE_INST_DIR_V/ve32/src/" @@ -1834,10 +1800,8 @@ f_inst_supervisor(){ f_yes_no "Install supervisor?" if [ ${EZ_I_SKIP_ON_V} -eq 1 ] || [ ${YES_NO_R} -eq 1 ] ; then EZ_I_SKIP_ON_V=$FAST_INST - f_inst_ve_py2X 1 f_create_ve2X 1 - f_chk_by_path_hlp "$BASE_INST_DIR_V/$VE_2_X/src/supervisor" "d" "\"supervisor\" already installed in \"$BASE_INST_DIR_V/$VE_2_X/src/supervisor\"!" UP_SUPERVISOR=1 if [ ${F_CHK_BY_PATH_HLP_R} -eq 1 ] ; then @@ -1855,12 +1819,12 @@ f_inst_supervisor(){ f_ez_mv_bak "$BASE_INST_DIR_V/$VE_2_X/src/supervisor/apps/lbg.conf" "" 1 0 1 \cp "$SCRIPTDIR_V/other-srcs-n-apps/supervisord.conf-dist" "$BASE_INST_DIR_V/$VE_2_X/src/supervisor/supervisord.conf" \cp "$SCRIPTDIR_V/other-srcs-n-apps/lbg.conf-supervisord-dist" "$BASE_INST_DIR_V/$VE_2_X/src/supervisor/apps/lbg.conf" - f_ez_sed "" "$BASE_INST_DIR_V/ve32" "$BASE_INST_DIR_V/$VE_2_X/src/supervisor/apps/lbg.conf" 1 # NOTE: Determinar um número adequado de processos! By Questor - f_num_for_procs - f_ez_sed "" "$PROCESSES_QTT" "$BASE_INST_DIR_V/$VE_2_X/src/supervisor/apps/lbg.conf" + f_procs_qtt 2 + + f_ez_sed "" "$F_PROCS_QTT_R" "$BASE_INST_DIR_V/$VE_2_X/src/supervisor/apps/lbg.conf" QUESTION_F="Enter the port number for Supervisor service. Use empty for \"$SVISOR_PORT\" (recommended)!" f_div_section @@ -1893,7 +1857,7 @@ Use empty for \"$SVISOR_PWD\"!" # NOTE: Calcula o máximo de memória que o LBG - LBGenerator pode usar do # servidor! By Questor f_div_section - f_get_usr_input "Enter the LBG - LBGenerator MAXIMUM PERCENT server RAM memory usage (numbers only, integers only, 0~100). + f_get_usr_input "Enter the LBG - LBGenerator MAXIMUM PERCENT server RAM memory usage (numbers only, integers only). Use empty for \"$PROC_MAX_MEM_PERC\" (good for most cases)! * Higher values will cause server instability, crash and other unexpected results; * Lower values will cause LBG - LBGenerator service instability, crash and other unexpected results." 1 @@ -1901,15 +1865,8 @@ Use empty for \"$PROC_MAX_MEM_PERC\" (good for most cases)! PROC_MAX_MEM_PERC=$GET_USR_INPUT_R fi f_srv_memory - - # NOTA: A estratégia abaixo foi utilizada pq o bash por padrão não - # permite cálculo de ponto flutuante! By Questor - PROC_MAX_MEM=$(awk '{printf("%.8f\n",(($1/100)*$2))}' <<<" $F_SRV_MEMORY_R $PROC_MAX_MEM_PERC ") - - # NOTA: A estratégia abaixo foi utilizada para arredondar o valor - # (remover o ponto flutuante)! By Questor - PROC_MAX_MEM=${PROC_MAX_MEM%\.*} - + f_get_percent_from "$F_SRV_MEMORY_R" "$PROC_MAX_MEM_PERC" + PROC_MAX_MEM=$F_GET_PERCENT_FROM_R f_ez_sed "" "$PROC_MAX_MEM" "$BASE_INST_DIR_V/$VE_2_X/src/supervisor/supervisord.conf" rm -f "/etc/init.d/supervisord" if [[ "$DISTRO_TYPE" == "RH" ]] ; then @@ -2112,90 +2069,84 @@ Use empty for \"$APP_ROOT_F\" (will result in http:///$APP_R if [ -n "$GET_USR_INPUT_R" ] ; then APP_ROOT_F=$GET_USR_INPUT_R fi - SQLA_POOL_SIZE=0 - - # NOTA: A estratégia abaixo foi utilizada pq o bash por padrão não - # permite cálculo de ponto flutuante! By Questor - SQLA_POOL_SIZE=$(awk '{printf("%.8f\n",($1*0.8))}' <<<" $PG_CONNECTIONS ") - - # NOTA: A estratégia abaixo foi utilizada para arredondar o valor - # (remover o ponto flutuante)! By Questor - SQLA_POOL_SIZE=${SQLA_POOL_SIZE%\.*} + SQLA_POOL_SIZE_MAX_OVERFLOW=0 + f_get_percent_from "$PG_CONNECTIONS" "48" + SQLA_POOL_SIZE=$F_GET_PERCENT_FROM_R + SQLA_POOL_SIZE_MAX_OVERFLOW=$SQLA_POOL_SIZE # NOTE: Seta uma quantidade de threads adequada para o pool do # sqlalchemy! By Questor f_div_section f_get_usr_input "Enter the LBG - LBGenerator SQLALCHEMY POOL SIZE (numbers only, integers only). Use empty for \"$SQLA_POOL_SIZE\" (good for most cases)! -* Use at most 80% of the number of PostgreSQL connections; +* Use at most 48% of the number of PostgreSQL connections; * Decrease the value if you have other applications using PostgreSQL; * Higher values will cause LBG - LBGenerator and PostgreSQL services instability, crash and other unexpected results." 1 if [ -n "$GET_USR_INPUT_R" ] ; then SQLA_POOL_SIZE=$GET_USR_INPUT_R + SQLA_POOL_SIZE_MAX_OVERFLOW=$SQLA_POOL_SIZE + fi + LBI_LBINDEX_URL="http://127.0.0.1:6543/" + QUESTION_F="Enter the LBI - LBIndex http service URL. +Use empty for \"$LBI_LBINDEX_URL\"!" + f_div_section + f_get_usr_input "$QUESTION_F" 1 + QUESTION_F="" + if [ -n "$GET_USR_INPUT_R" ] ; then + LBI_LBINDEX_URL=$GET_USR_INPUT_R fi - if [[ "$HTTP_SRV_WSGI" == "u" ]] ; then eval "cp -f \"$BASE_INST_DIR_V/ve32/src/LBGenerator/production.ini.uwsgi-dist\" \"$BASE_INST_DIR_V/ve32/src/LBGenerator/production.ini\"" f_ez_sed "" "$SQLA_POOL_SIZE" "$BASE_INST_DIR_V/ve32/src/LBGenerator/production.ini" 1 - f_ez_sed "" "$PG_CFG_F" "$BASE_INST_DIR_V/ve32/src/LBGenerator/production.ini" 1 + f_ez_sed "" "$SQLA_POOL_SIZE" "$BASE_INST_DIR_V/ve32/src/LBGenerator/production.ini" 1 + f_ez_sed "" "$LBI_LBINDEX_URL" "$BASE_INST_DIR_V/ve32/src/LBGenerator/production.ini" + f_ez_sed "" "$PG_CFG_F" "$BASE_INST_DIR_V/ve32/src/LBGenerator/production.ini" 1 f_ez_sed "" "$BASE_INST_DIR_V/ve32" "$BASE_INST_DIR_V/ve32/src/LBGenerator/production.ini" 1 f_ez_sed "" "$APP_ROOT_F" "$BASE_INST_DIR_V/ve32/src/LBGenerator/production.ini" - f_num_for_procs - f_ez_sed "" "$PROCESSES_QTT" "$BASE_INST_DIR_V/ve32/src/LBGenerator/production.ini" - - THREADS_QTT=0 - - # NOTA: A estratégia abaixo foi utilizada pq o bash por padrão não - # permite cálculo de ponto flutuante! By Questor - THREADS_QTT=$(awk '{printf("%.8f\n",(($1*0.8)/$2))}' <<<" $PG_CONNECTIONS $PROCESSES_QTT ") - - # NOTA: A estratégia abaixo foi utilizada para arredondar o valor - # (remover o ponto flutuante)! By Questor - THREADS_QTT=${THREADS_QTT%\.*} - - # NOTE: Seta uma quantidade de threads adequada para o uWSGI! By Questor - f_div_section - f_get_usr_input "Enter the LBG - LBGenerator THREADS QUANTITY (numbers only, integers only). -Use empty for \"$THREADS_QTT\" (good for most cases)! -* Use at most 80% of the number of PostgreSQL connections divided by the number of uWSGI processes; -* Decrease the value if you have other applications using PostgreSQL; -* Higher values will cause LBG - LBGenerator and PostgreSQL services instability, crash and other unexpected results." 1 - if [ -n "$GET_USR_INPUT_R" ] ; then - THREADS_QTT=$GET_USR_INPUT_R - fi - - f_ez_sed "" "$THREADS_QTT" "$BASE_INST_DIR_V/ve32/src/LBGenerator/production.ini" - + f_procs_qtt 4 + f_ez_sed "" "$F_PROCS_QTT_R" "$BASE_INST_DIR_V/ve32/src/LBGenerator/production.ini" + REQ_TIMEOUT=0 f_srv_memory - - # NOTA: A estratégia abaixo foi utilizada pq o bash por padrão não - # permite cálculo de ponto flutuante! By Questor - REQ_TIMEOUT=$(awk '{printf("%.8f\n",(($1/25550)*$2))}' <<<" $F_SRV_MEMORY_R $PROCESSES_QTT ") - - # NOTA: A estratégia abaixo foi utilizada para arredondar o valor - # (remover o ponto flutuante)! By Questor - REQ_TIMEOUT=${REQ_TIMEOUT%\.*} - - TOO_LOW_REQ_TIMEOUT="" - if (( ${REQ_TIMEOUT} < 150 )) ; then - TOO_LOW_REQ_TIMEOUT=" -* WARNING: THE INSTALLER HAS CALCULATED A TOO LOW TIMEOUT VALUE FOR THIS SERVER. TIMEOUTS BELOW 150 SECONDS ARE CONSIDERED TOO LOW. CONSIDER USING A SERVER WITH MORE PROCESSORS AND/OR MEMORY." + f_bytes_n_units "$F_SRV_MEMORY_R" "KB" "MB" + F_SRV_MEMORY_R_IN_MB=$F_BYTES_N_UNITS_R + f_get_percent_from "$F_SRV_MEMORY_R_IN_MB" "44" + REQ_TIMEOUT=$F_GET_PERCENT_FROM_R + TOO_LOW_REQ_TIMEOUT=" (good for most cases)!" + if (( ${REQ_TIMEOUT} < 400 )) ; then + TOO_LOW_REQ_TIMEOUT=". + +* WARNING: THE INSTALLER HAS CALCULATED A TOO LOW TIMEOUT VALUE FOR THIS SERVER. TIMEOUTS BELOW 400 SECONDS ARE CONSIDERED TOO LOW. CONSIDER USING A SERVER WITH MORE RAM! +" fi - # NOTE: Seta um valor adequado para "request timeout" conforme a - # quantidade de núcleos e de memória da máquina! By Questor + # NOTE: Calcula um valor de timeout conforme a quantidade de + # memória RAM! By Questor f_div_section - f_get_usr_input "Enter the LBG - LBGenerator REQUEST TIMEOUT (numbers only, integers only). -Use empty for \"$REQ_TIMEOUT\" (good for most cases and highly recommended)! -* Decrease the value if you have application performance and server instability problems; -* Higher values will cause server instability, crash and other unexpected results.$TOO_LOW_REQ_TIMEOUT" 1 + f_get_usr_input "Enter the HTTP REQUEST TIMEOUT (numbers only, integers only). +Use empty for \"$REQ_TIMEOUT\"$TOO_LOW_REQ_TIMEOUT +* Use a numeric value equivalent at most 44% of your server RAM in MB; +* Decrease the value if you have other applications using your server; +* Higher values will cause LBG - LBGenerator and PostgreSQL services instability, crash and other unexpected results." 1 if [ -n "$GET_USR_INPUT_R" ] ; then REQ_TIMEOUT=$GET_USR_INPUT_R fi - - f_ez_sed "" "$REQ_TIMEOUT" "$BASE_INST_DIR_V/ve32/src/LBGenerator/production.ini" - + f_ez_sed "" "$REQ_TIMEOUT" "$BASE_INST_DIR_V/ve32/src/LBGenerator/production.ini" 1 + f_get_percent_from "$F_SRV_MEMORY_R_IN_MB" "150" + UWSGI_POST_BUFFERING=$F_GET_PERCENT_FROM_R + f_ez_sed "" "$UWSGI_POST_BUFFERING" "$BASE_INST_DIR_V/ve32/src/LBGenerator/production.ini" + f_get_percent_from "$F_SRV_MEMORY_R_IN_MB" "70" + UWSGI_RELOAD_ON_AS=$F_GET_PERCENT_FROM_R + f_ez_sed "" "$UWSGI_RELOAD_ON_AS" "$BASE_INST_DIR_V/ve32/src/LBGenerator/production.ini" + f_get_percent_from "$F_SRV_MEMORY_R_IN_MB" "65" + UWSGI_RELOAD_ON_RSS=$F_GET_PERCENT_FROM_R + f_ez_sed "" "$UWSGI_RELOAD_ON_RSS" "$BASE_INST_DIR_V/ve32/src/LBGenerator/production.ini" + f_get_percent_from "$F_SRV_MEMORY_R_IN_MB" "85" + UWSGI_EVIL_RELOAD_ON_AS=$F_GET_PERCENT_FROM_R + f_ez_sed "" "$UWSGI_EVIL_RELOAD_ON_AS" "$BASE_INST_DIR_V/ve32/src/LBGenerator/production.ini" + f_get_percent_from "$F_SRV_MEMORY_R_IN_MB" "75" + UWSGI_EVIL_RELOAD_ON_RSS=$F_GET_PERCENT_FROM_R + f_ez_sed "" "$UWSGI_EVIL_RELOAD_ON_RSS" "$BASE_INST_DIR_V/ve32/src/LBGenerator/production.ini" f_chk_by_path_hlp "$NGINX_CONF_PATH/lbg.conf" "f" "\"lbg.conf\" already created in \"$NGINX_CONF_PATH/lbg.conf\"!" F_BAK_MD_R=1 if [ ${F_CHK_BY_PATH_HLP_R} -eq 1 ] ; then @@ -2227,7 +2178,9 @@ Use empty for \"$REQ_TIMEOUT\" (good for most cases and highly recommended)! elif [[ "$HTTP_SRV_WSGI" == "p" ]] ; then eval "cp -f \"$BASE_INST_DIR_V/ve32/src/LBGenerator/production.ini.pserver-dist\" \"$BASE_INST_DIR_V/ve32/src/LBGenerator/production.ini\"" f_ez_sed "" "$SQLA_POOL_SIZE" "$BASE_INST_DIR_V/ve32/src/LBGenerator/production.ini" 1 - f_ez_sed "" "$PG_CFG_F" "$BASE_INST_DIR_V/ve32/src/LBGenerator/production.ini" 1 + f_ez_sed "" "$SQLA_POOL_SIZE" "$BASE_INST_DIR_V/ve32/src/LBGenerator/production.ini" 1 + f_ez_sed "" "$LBI_LBINDEX_URL" "$BASE_INST_DIR_V/ve32/src/LBGenerator/production.ini" + f_ez_sed "" "$PG_CFG_F" "$BASE_INST_DIR_V/ve32/src/LBGenerator/production.ini" 1 f_ez_sed "" "$APP_ROOT_F" "$BASE_INST_DIR_V/ve32/src/LBGenerator/production.ini" 1 f_chk_by_path_hlp "$NGINX_CONF_PATH/lbg.conf" "f" "\"lbg.conf\" already created in \"$NGINX_CONF_PATH/lbg.conf\"!" F_BAK_MD_R=1 @@ -2238,9 +2191,10 @@ Use empty for \"$REQ_TIMEOUT\" (good for most cases and highly recommended)! \cp "$SCRIPTDIR_V/other-srcs-n-apps/lbg.conf-ngix-pserve-dist" "$NGINX_CONF_PATH/lbg.conf" # NOTE: Determinar um número adequado de processos! By Questor - f_num_for_procs + f_procs_qtt 2 + UPSTREAM_LBG="" - for (( i=0; i < PROCESSES_QTT; i++ )) ; do + for (( i=0; i < F_PROCS_QTT_R; i++ )) ; do UPSTREAM_LBG=$UPSTREAM_LBG" server 127.0.0.1:500$i;\n" done f_ez_sed "" "$UPSTREAM_LBG" "$NGINX_CONF_PATH/lbg.conf" @@ -2257,7 +2211,9 @@ Use empty for \"$REQ_TIMEOUT\" (good for most cases and highly recommended)! f_ez_sed "" "$BASE_INST_DIR_V/ve32" "$BASE_INST_DIR_V/ve32/src/LBGenerator/lbgenerator.wsgi" eval "cp -f \"$BASE_INST_DIR_V/ve32/src/LBGenerator/production.ini.apache-dist\" \"$BASE_INST_DIR_V/ve32/src/LBGenerator/production.ini\"" f_ez_sed "" "$SQLA_POOL_SIZE" "$BASE_INST_DIR_V/ve32/src/LBGenerator/production.ini" 1 - f_ez_sed "" "$PG_CFG_F" "$BASE_INST_DIR_V/ve32/src/LBGenerator/production.ini" 1 + f_ez_sed "" "$SQLA_POOL_SIZE" "$BASE_INST_DIR_V/ve32/src/LBGenerator/production.ini" 1 + f_ez_sed "" "$LBI_LBINDEX_URL" "$BASE_INST_DIR_V/ve32/src/LBGenerator/production.ini" + f_ez_sed "" "$PG_CFG_F" "$BASE_INST_DIR_V/ve32/src/LBGenerator/production.ini" 1 f_chk_by_path_hlp "$HTTPD_CONF_PATH/lbg.conf" "f" "\"lbg.conf\" already created in \"$HTTPD_CONF_PATH/lbg.conf\"!" F_BAK_MD_R=1 if [ ${F_CHK_BY_PATH_HLP_R} -eq 1 ] ; then diff --git a/liblightbase.tar.gz b/liblightbase.tar.gz index ae6b2df..7062ddb 100644 Binary files a/liblightbase.tar.gz and b/liblightbase.tar.gz differ diff --git a/other-srcs-n-apps/lbg.conf-ngix-uwsgi-dist b/other-srcs-n-apps/lbg.conf-ngix-uwsgi-dist index 7621d6b..ff5d007 100755 --- a/other-srcs-n-apps/lbg.conf-ngix-uwsgi-dist +++ b/other-srcs-n-apps/lbg.conf-ngix-uwsgi-dist @@ -27,10 +27,10 @@ server { proxy_set_header X-Real-IP $remote_addr; proxy_temp_file_write_size 64k; send_timeout 600; # Timeout 10 minutes. - uwsgi_connect_timeout 1800; # Timeout 30 minutes. + uwsgi_connect_timeout 3600; # Timeout 60 minutes. uwsgi_param SCRIPT_NAME ""; uwsgi_pass unix:///tmp/lbg.sock; - uwsgi_read_timeout 1800; # Timeout 30 minutes. - uwsgi_send_timeout 1800; # Timeout 30 minutes. + uwsgi_read_timeout 3600; # Timeout 60 minutes. + uwsgi_send_timeout 3600; # Timeout 60 minutes. } } diff --git a/py-packs-LBGenerator.bash b/py-packs-LBGenerator.bash index 5ab7b59..3bb9143 100755 --- a/py-packs-LBGenerator.bash +++ b/py-packs-LBGenerator.bash @@ -18,7 +18,7 @@ if [ -z "$BASE_INST_DIR_V" ] ; then BASE_INST_DIR_V="/usr/local/lb" QUESTION_F="Enter the installation directory. - Use empty for \"$BASE_INST_DIR_V\"!" +Use empty for \"$BASE_INST_DIR_V\"!" f_get_usr_input "$QUESTION_F" 1 QUESTION_F="" diff --git a/py-packs-liblightbase.bash b/py-packs-liblightbase.bash index 2dfe115..01ec394 100755 --- a/py-packs-liblightbase.bash +++ b/py-packs-liblightbase.bash @@ -18,7 +18,7 @@ if [ -z "$BASE_INST_DIR_V" ] ; then BASE_INST_DIR_V="/usr/local/lb" QUESTION_F="Enter the installation directory. - Use empty for \"$BASE_INST_DIR_V\"!" +Use empty for \"$BASE_INST_DIR_V\"!" f_get_usr_input "$QUESTION_F" 1 QUESTION_F="" diff --git a/py-packs-supervisor.bash b/py-packs-supervisor.bash index 4b6a165..2c481ca 100755 --- a/py-packs-supervisor.bash +++ b/py-packs-supervisor.bash @@ -18,7 +18,7 @@ if [ -z "$BASE_INST_DIR_V" ] ; then BASE_INST_DIR_V="/usr/local/lb" QUESTION_F="Enter the installation directory. - Use empty for \"$BASE_INST_DIR_V\"!" +Use empty for \"$BASE_INST_DIR_V\"!" f_get_usr_input "$QUESTION_F" 1 QUESTION_F="" diff --git a/py-packs-uwsgi.bash b/py-packs-uwsgi.bash index 6825559..5cf934e 100755 --- a/py-packs-uwsgi.bash +++ b/py-packs-uwsgi.bash @@ -18,7 +18,7 @@ if [ -z "$BASE_INST_DIR_V" ] ; then BASE_INST_DIR_V="/usr/local/lb" QUESTION_F="Enter the installation directory. - Use empty for \"$BASE_INST_DIR_V\"!" +Use empty for \"$BASE_INST_DIR_V\"!" f_get_usr_input "$QUESTION_F" 1 QUESTION_F="" -- libgit2 0.21.2