- Add DOCKER_TOOLS_EXEPTION_LOGS env variable support.

This commit is contained in:
Arnaud G. GIBERT 2025-01-04 20:30:12 +01:00
parent ae36bab6ec
commit 7278a536fd
2 changed files with 51 additions and 6 deletions

View File

@ -1,4 +1,11 @@
------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------
Rx3-Docker/Docker Tools V 1.3.3 - A. GIBERT - 2025/01/04
------------------------------------------------------------------------------------------------------------------------------------
- Add DOCKER_TOOLS_EXEPTION_LOGS env variable support.
Rx3-Docker/Docker Tools V 1.3.2 - A. GIBERT - 2024/12/27 Rx3-Docker/Docker Tools V 1.3.2 - A. GIBERT - 2024/12/27
------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------
@ -20,7 +27,7 @@ Rx3-Docker/Docker Tools V 1.3.0 - A. GIBERT - 2024/11/26
- Improve docker_service_add function, - Improve docker_service_add function,
- Switch by default to splited volume mode, - Switch by default to splited volume mode,
- Add DOCKER_TOOLS_DEBUG, DOCKER_TOOLS_VOLUME & DOCKER_TOOLS_EXECPTION_LIBS env variable support. - Add DOCKER_TOOLS_DEBUG, DOCKER_TOOLS_VOLUME & DOCKER_TOOLS_EXEPTION_LIBS env variable support.
- Warning: API break! - Warning: API break!

View File

@ -11,7 +11,10 @@
# SPLITED: By service volume mode + No service suffix # SPLITED: By service volume mode + No service suffix
# #
# DOCKER_TOOLS_EXEPTION_LIBS="module_name:lib_dir_name ..." # DOCKER_TOOLS_EXEPTION_LIBS="module_name:lib_dir_name ..."
# Example: postgres:pgsq # Example: "postgres:pgsq httpd:/var/www/html"
#
# DOCKER_TOOLS_EXEPTION_LOGS="module_name:log_dir_name ..."
# Example: "postgres:web-server:httpd"
# #
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
@ -81,6 +84,25 @@ function module_lib_name_get
#-------------------------------------------------------------------------------
function module_log_name_get
{
module=$1
for tup in ${DOCKER_TOOLS_EXEPTION_LOGS}
do
if [[ "${module}" == "${tup/:*}" ]]
then
echo ${tup/*:}
return
fi
done
echo "${module}"
}
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
function docker_service_add function docker_service_add
{ {
@ -182,11 +204,23 @@ function docker_service_add
path_prefix="" path_prefix=""
fi fi
module_lib_path=${path_prefix}${module_lib_name} module_lib_path=${path_prefix}${module_lib_name}
module_log_name="$( module_log_name_get "${module_name}")"
if [[ "${module_log_name}" != /* ]]
then
path_prefix="/var/log/"
else
path_prefix=""
fi
module_log_path=${path_prefix}${module_log_name}
dynvar_export "${varible_prefix}_LIB_INT" "${module_lib_path}" dynvar_export "${varible_prefix}_LIB_INT" "${module_lib_path}"
dynvar_export "${varible_prefix}_LIB_EXT" "$( psfix_cat "${volume_prefix}${module_lib_path}" "-" "${volume_suffix_ext}")" dynvar_export "${varible_prefix}_LIB_EXT" "$( psfix_cat "${volume_prefix}${module_lib_path}" "-" "${volume_suffix_ext}")"
# dynvar_export "${varible_prefix}_LIB_INT" "/var/lib/${module_lib_name}" # dynvar_export "${varible_prefix}_LIB_INT" "/var/lib/${module_lib_name}"
@ -198,8 +232,12 @@ function docker_service_add
dynvar_export "${varible_prefix}_LOG_SV_INT" "/var/log/supervisor" dynvar_export "${varible_prefix}_LOG_SV_INT" "/var/log/supervisor"
dynvar_export "${varible_prefix}_LOG_SV_EXT" "$( psfix_cat "${volume_prefix}/var/log/supervisor" "-" "${volume_suffix_ext}")" dynvar_export "${varible_prefix}_LOG_SV_EXT" "$( psfix_cat "${volume_prefix}/var/log/supervisor" "-" "${volume_suffix_ext}")"
dynvar_export "${varible_prefix}_LOG_MAIN_INT" "/var/log/${module_name}" dynvar_export "${varible_prefix}_LOG_MAIN_INT" "${module_log_path}"
dynvar_export "${varible_prefix}_LOG_MAIN_EXT" "$( psfix_cat "${volume_prefix}/var/log/${module_name}" "-" "${volume_suffix_ext}")" dynvar_export "${varible_prefix}_LOG_MAIN_EXT" "$( psfix_cat "${volume_prefix}${module_log_path}" "-" "${volume_suffix_ext}")"
# dynvar_export "${varible_prefix}_LOG_MAIN_INT" "/var/log/${module_name}"
# dynvar_export "${varible_prefix}_LOG_MAIN_EXT" "$( psfix_cat "${volume_prefix}/var/log/${module_name}" "-" "${volume_suffix_ext}")"
# Ports # Ports