Compare commits
No commits in common. "master" and "docker_tools-1.2.0" have entirely different histories.
master
...
docker_too
@ -1,12 +1,3 @@
|
||||
------------------------------------------------------------------------------------------------------------------------------------
|
||||
Rx3-Docker/Docker Tools V 1.3.0 - A. GIBERT - 2024/11/xx
|
||||
------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
- Improve docker_service_add function.
|
||||
- Warning: API break!
|
||||
|
||||
|
||||
|
||||
------------------------------------------------------------------------------------------------------------------------------------
|
||||
Rx3-Docker/Docker Tools V 1.2.0 - A. GIBERT - 2024/11/15
|
||||
------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -26,141 +26,6 @@ function dynvar_export
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
function docker_service_add
|
||||
{
|
||||
varible_prefix="$1"
|
||||
shift
|
||||
|
||||
for var in target_url_prefix target_name target_name_full target_version from_url_prefix from_name from_version module_name module_version port_main_ext port_main_int port_admin_ext port_admin_int user_name_id group_name_id
|
||||
do
|
||||
eval ${var}=\"${1}\"
|
||||
shift
|
||||
done
|
||||
|
||||
|
||||
if [[ "${module_name}" == "-" ]]
|
||||
then
|
||||
module_name="${target_name}"
|
||||
fi
|
||||
|
||||
|
||||
# Global Image variables
|
||||
|
||||
dynvar_export "${varible_prefix}_IMG_NAME" "${target_name}"
|
||||
dynvar_export "${varible_prefix}_IMG_NAME_FULL" "${target_name_full}"
|
||||
dynvar_export "${varible_prefix}_IMG_VERSION" "${target_version}"
|
||||
dynvar_export "${varible_prefix}_IMG_MAINTAINER" "\${ORG_MAINTAINER}"
|
||||
dynvar_export "${varible_prefix}_IMG_URL" "${target_url_prefix}/${target_name}:${target_version}"
|
||||
|
||||
if [[ "${HOST_NAME_PREFIX}" == "" ]]
|
||||
then
|
||||
prefix=""
|
||||
else
|
||||
prefix="${HOST_NAME_PREFIX}-"
|
||||
fi
|
||||
|
||||
dynvar_export "${varible_prefix}_HOST_NAME" "${prefix}${target_name}"
|
||||
|
||||
|
||||
# Building
|
||||
|
||||
if [[ "${target_name_full}" != "-" ]]
|
||||
then
|
||||
# Build
|
||||
|
||||
dynvar_export "${varible_prefix}_MODULE_NAME" "${module_name}"
|
||||
dynvar_export "${varible_prefix}_MODULE_PATH" "src/${module_name}"
|
||||
dynvar_export "${varible_prefix}_MODULE_VERSION" "${module_version}"
|
||||
|
||||
dynvar_export "${varible_prefix}_IMG_FROM_URL" "${from_url_prefix}/${from_name}:${from_version}"
|
||||
fi
|
||||
|
||||
|
||||
# Volume Directories
|
||||
|
||||
if [[ "${APPL_NAME}" != "" ]]
|
||||
then
|
||||
log_ext_suffix="-${target_name}"
|
||||
else
|
||||
log_ext_suffix=""
|
||||
fi
|
||||
|
||||
dynvar_export "${varible_prefix}_LIB_INT" "/var/lib/${module_name}"
|
||||
dynvar_export "${varible_prefix}_LIB_EXT" "./var/lib/${module_name}"
|
||||
|
||||
dynvar_export "${varible_prefix}_LOG_INIT_INT" "/var/log/init"
|
||||
dynvar_export "${varible_prefix}_LOG_INIT_EXT" "./var/log/init${log_ext_suffix}"
|
||||
dynvar_export "${varible_prefix}_LOG_SV_INT" "/var/log/supervisor"
|
||||
dynvar_export "${varible_prefix}_LOG_SV_EXT" "./var/log/supervisor${log_ext_suffix}"
|
||||
dynvar_export "${varible_prefix}_LOG_POST_INT" "/var/log/supervisor"
|
||||
dynvar_export "${varible_prefix}_LOG_POST_EXT" "./var/log/supervisor${log_ext_suffix}"
|
||||
dynvar_export "${varible_prefix}_LOG_MAIN_INT" "/var/log/${module_name}"
|
||||
dynvar_export "${varible_prefix}_LOG_MAIN_EXT" "./var/log/${module_name}"
|
||||
|
||||
dynvar_export "${varible_prefix}_IMG_URL" "${target_url_prefix}/${target_name}:${target_version}"
|
||||
|
||||
|
||||
# Ports
|
||||
|
||||
dynvar_export "${varible_prefix}_PORT_MAIN_INT" "${port_main_int}"
|
||||
dynvar_export "${varible_prefix}_PORT_MAIN_EXT" "\$(( ${port_main_ext} + ${PORT_ENV_OFFSET}))"
|
||||
dynvar_export "${varible_prefix}_PORT_SV_INT" "9001"
|
||||
dynvar_export "${varible_prefix}_PORT_SV_EXT" "\$(( \${${varible_prefix}_PORT_MAIN_EXT} + ${PORT_SV_OFFSET}))"
|
||||
|
||||
|
||||
if [[ "${port_admin_int}" != "-" ]]
|
||||
then
|
||||
dynvar_export "${varible_prefix}_PORT_ADMIN_INT" "${port_admin_int}"
|
||||
dynvar_export "${varible_prefix}_PORT_ADMIN_EXT" "\$(( ${port_admin_ext} + ${PORT_ENV_OFFSET}))"
|
||||
fi
|
||||
|
||||
|
||||
# User & Group
|
||||
|
||||
if [[ "${user_name_id}" == "-" ]]
|
||||
then
|
||||
user_name="-"
|
||||
user_id="-"
|
||||
else
|
||||
if [[ "${user_name_id}" =~ ^[0-9]+$ ]]
|
||||
then
|
||||
user_name="-"
|
||||
user_id="${user_name_id}"
|
||||
else
|
||||
user_name="${user_name_id}"
|
||||
user_id="$( id -u "${user_name}")"
|
||||
fi
|
||||
fi
|
||||
|
||||
dynvar_export "${varible_prefix}_USER_NAME" "${user_name}"
|
||||
dynvar_export "${varible_prefix}_USER_ID" "${user_id}"
|
||||
|
||||
|
||||
if [[ "${group_name_id}" == "-" ]]
|
||||
then
|
||||
group_name="-"
|
||||
group_id="-"
|
||||
else
|
||||
if [[ "${group_name_id}" =~ ^[0-9]+$ ]]
|
||||
then
|
||||
group_name="-"
|
||||
group_id="${group_name_id}"
|
||||
else
|
||||
group_name="${group_name_id}"
|
||||
group_id="$( getent group "${group_name}" | cut -d: -f3)"
|
||||
fi
|
||||
fi
|
||||
|
||||
dynvar_export "${varible_prefix}_GROUP_NAME" "${group_name}"
|
||||
dynvar_export "${varible_prefix}_GROUP_ID" "${group_id}"
|
||||
|
||||
|
||||
dynvar_export "${varible_prefix}_CONTEXT_PATH" "/${APPL_NAME}/${target_name}/"
|
||||
}
|
||||
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
function zdocker_service_add
|
||||
{
|
||||
varible_prefix="$1"
|
||||
shift
|
||||
@ -172,17 +37,17 @@ function zdocker_service_add
|
||||
done
|
||||
|
||||
|
||||
dynvar_export "${varible_prefix}_LOG_INIT_INT" "/var/log/init"
|
||||
dynvar_export "${varible_prefix}_LOG_INIT_EXT" "./var/log/init-\${${varible_prefix}_NAME}"
|
||||
dynvar_export "${varible_prefix}_LOG_SV_INT" "/var/log/supervisor"
|
||||
dynvar_export "${varible_prefix}_LOG_SV_EXT" "./var/log/supervisor-\${${varible_prefix}_NAME}"
|
||||
dynvar_export "${varible_prefix}_LOG_INT_INIT_DIR" "/var/log/init"
|
||||
dynvar_export "${varible_prefix}_LOG_EXT_INIT_DIR" "./var/log/init-\${${varible_prefix}_NAME}"
|
||||
dynvar_export "${varible_prefix}_LOG_INT_SV_DIR" "/var/log/supervisor"
|
||||
dynvar_export "${varible_prefix}_LOG_EXT_SV_DIR" "./var/log/supervisor-\${${varible_prefix}_NAME}"
|
||||
|
||||
if [[ $( eval echo \${${varible_prefix}_APPL_NAME}) != "-" ]]
|
||||
then
|
||||
dynvar_export "${varible_prefix}_LIB_INT" "/var/lib/\${${varible_prefix}_APPL_NAME}"
|
||||
dynvar_export "${varible_prefix}_LIB_EXT" "./var/lib/\${${varible_prefix}_APPL_NAME}"
|
||||
dynvar_export "${varible_prefix}_LOG_MAIN_INT" "/var/log/\${${varible_prefix}_APPL_NAME}"
|
||||
dynvar_export "${varible_prefix}_LOG_MAIN_EXT" "./var/log/\${${varible_prefix}_APPL_NAME}"
|
||||
dynvar_export "${varible_prefix}_LIB_INT_DIR" "/var/lib/\${${varible_prefix}_APPL_NAME}"
|
||||
dynvar_export "${varible_prefix}_LIB_EXT_DIR" "./var/lib/\${${varible_prefix}_APPL_NAME}"
|
||||
dynvar_export "${varible_prefix}_LOG_INT_MAIN_DIR" "/var/log/\${${varible_prefix}_APPL_NAME}"
|
||||
dynvar_export "${varible_prefix}_LOG_EXT_MAIN_DIR" "./var/log/\${${varible_prefix}_APPL_NAME}"
|
||||
fi
|
||||
|
||||
if [[ $( eval echo \${${varible_prefix}_IMG_NAME}) != "-" ]]
|
||||
|
Loading…
Reference in New Issue
Block a user