- Move repo from Rx3/docker_tools to Rx3-Docker/docker_tools,

- docker_service_add:
    - Add *_LOG_* variable generation.
This commit is contained in:
Arnaud G. GIBERT 2024-11-15 19:58:26 +01:00
parent 67101865a7
commit 1fa43fbdb1
3 changed files with 41 additions and 17 deletions

View File

@ -1,8 +1,8 @@
Welcome to Docker Tools! Welcome to Rx3-Docker/Docker Tools!
This is project aims to give some basic tools to be used by others Rx3 docker packaging projects. This project aims to give some basic tools to be used by other Rx3 docker packaging projects.
Features: Features:
- docker_mk_env command to compile env file into .env file, - docker_mk_env command to compile env file into .env file,
@ -16,4 +16,4 @@ Your Docker Tools Team.
-- --
arnaud@rx3.net arnaud@rx3.net
https://git.rx3.org/gitea/rx3/docker_tools https://git.rx3.org/gitea/rx3-docker/docker_tools

View File

@ -1,3 +1,13 @@
------------------------------------------------------------------------------------------------------------------------------------
Rx3-Docker/Docker Tools V 1.2.0 - A. GIBERT - 2024/11/15
------------------------------------------------------------------------------------------------------------------------------------
- Move repo from Rx3/docker_tools to Rx3-Docker/docker_tools,
- docker_service_add:
- Add *_LOG_* variable generation.
------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------
Docker Tools V 1.1.0 - A. GIBERT - 2024/11/03 Docker Tools V 1.1.0 - A. GIBERT - 2024/11/03
------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------

View File

@ -30,47 +30,61 @@ function docker_service_add
varible_prefix="$1" varible_prefix="$1"
shift shift
for var in NAME NAME_FULL URL_PREFIX IMG_NAME VERSION_EXT VERSION_INT PORT_MAIN_EXT PORT_MAIN_INT PORT_ADMIN_EXT PORT_ADMIN_INT USER_NAME GROUP_NAME for var in NAME NAME_FULL URL_PREFIX IMG_NAME APPL_NAME VERSION_EXT VERSION_INT PORT_MAIN_EXT PORT_MAIN_INT PORT_ADMIN_EXT PORT_ADMIN_INT USER_NAME GROUP_NAME
do do
dynvar_export "${varible_prefix}_${var}" "$1" dynvar_export "${varible_prefix}_${var}" "$1"
shift shift
done done
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_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}) != "-" ]] if [[ $( eval echo \${${varible_prefix}_IMG_NAME}) != "-" ]]
then then
# No Build # No Build
dynvar_export "${varible_prefix}_IMG_URL" "\${${varible_prefix}_URL_PREFIX}/\${${varible_prefix}_IMG_NAME}:\${${varible_prefix}_VERSION_INT}" dynvar_export "${varible_prefix}_IMG_URL" "\${${varible_prefix}_URL_PREFIX}/\${${varible_prefix}_IMG_NAME}:\${${varible_prefix}_VERSION_EXT}"
else else
# Build # Build
dynvar_export "${varible_prefix}_IMG_URL" "\${${varible_prefix}_URL_PREFIX}/\${${varible_prefix}_NAME}:\${${varible_prefix}_VERSION_INT}" dynvar_export "${varible_prefix}_IMG_URL" "\${${varible_prefix}_URL_PREFIX}/\${${varible_prefix}_NAME}:\${${varible_prefix}_VERSION_EXT}"
dynvar_export "${varible_prefix}_MODULE_NAME" "\${${varible_prefix}_NAME}" dynvar_export "${varible_prefix}_MODULE_NAME" "\${${varible_prefix}_NAME}"
dynvar_export "${varible_prefix}_MODULE_PATH" "src/\${${varible_prefix}_NAME}" dynvar_export "${varible_prefix}_MODULE_PATH" "src/\${${varible_prefix}_NAME}"
fi fi
dynvar_export "${varible_prefix}_CONTAINER_NAME" "${CONTAINER_NAME_PREFIX}-\${${varible_prefix}_NAME}" dynvar_export "${varible_prefix}_CONTAINER_NAME" "${CONTAINER_NAME_PREFIX}-\${${varible_prefix}_NAME}"
dynvar_export "${varible_prefix}_HOST" "\${${varible_prefix}_CONTAINER_NAME}" dynvar_export "${varible_prefix}_HOST" "\${${varible_prefix}_CONTAINER_NAME}"
dynvar_export "${varible_prefix}_PORT_MAIN_EXT" "\$(( \${${varible_prefix}_PORT_MAIN_EXT} + ${PORT_ENV_OFFSET}))" dynvar_export "${varible_prefix}_PORT_MAIN_EXT" "\$(( \${${varible_prefix}_PORT_MAIN_EXT} + ${PORT_ENV_OFFSET}))"
dynvar_export "${varible_prefix}_PORT_SV_EXT" "\$(( \${${varible_prefix}_PORT_MAIN_EXT} + ${PORT_SV_OFFSET}))" dynvar_export "${varible_prefix}_PORT_SV_EXT" "\$(( \${${varible_prefix}_PORT_MAIN_EXT} + ${PORT_SV_OFFSET}))"
dynvar_export "${varible_prefix}_PORT_SV_INT" "9001" dynvar_export "${varible_prefix}_PORT_SV_INT" "9001"
if [[ $( eval echo \${${varible_prefix}_PORT_ADMIN_EXT}) != "-" ]] if [[ $( eval echo \${${varible_prefix}_PORT_ADMIN_EXT}) != "-" ]]
then then
dynvar_export "${varible_prefix}_PORT_ADMIN_EXT" "\$(( \${${varible_prefix}_PORT_ADMIN_EXT} + ${PORT_ENV_OFFSET}))" dynvar_export "${varible_prefix}_PORT_ADMIN_EXT" "\$(( \${${varible_prefix}_PORT_ADMIN_EXT} + ${PORT_ENV_OFFSET}))"
fi fi
if [[ $( eval echo \${${varible_prefix}_USER_NAME}) == "-" ]] if [[ $( eval echo \${${varible_prefix}_USER_NAME}) == "-" ]]
then then
dynvar_export "${varible_prefix}_USER_ID" "-" dynvar_export "${varible_prefix}_USER_ID" "-"
else else
if [[ $( eval echo \${${varible_prefix}_USER_NAME}) =~ ^[0-9]+$ ]] if [[ $( eval echo \${${varible_prefix}_USER_NAME}) =~ ^[0-9]+$ ]]
then then
dynvar_export "${varible_prefix}_USER_ID" "\${${varible_prefix}_USER_NAME}" dynvar_export "${varible_prefix}_USER_ID" "\${${varible_prefix}_USER_NAME}"
else else
dynvar_export "${varible_prefix}_USER_ID" "\$( id -u \${${varible_prefix}_USER_NAME})" dynvar_export "${varible_prefix}_USER_ID" "\$( id -u \${${varible_prefix}_USER_NAME})"
fi fi
fi fi