From 443c8f85d1eca9e5324e4b02719ecd0ab24921eb Mon Sep 17 00:00:00 2001 From: casjay Date: Fri, 7 Nov 2025 08:06:19 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=97=83=EF=B8=8F=20Update=20codebase=20?= =?UTF-8?q?=F0=9F=97=83=EF=B8=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit rootfs/usr/local/bin/entrypoint.sh rootfs/usr/local/bin/pkmgr rootfs/usr/local/etc/docker/functions/entrypoint.sh rootfs/usr/local/share/template-files/config/env/default.sample rootfs/usr/local/share/template-files/config/env/examples/00-directory.sh rootfs/usr/local/share/template-files/config/env/examples/addresses.sh rootfs/usr/local/share/template-files/config/env/examples/certbot.sh rootfs/usr/local/share/template-files/config/env/examples/couchdb.sh rootfs/usr/local/share/template-files/config/env/examples/dockerd.sh rootfs/usr/local/share/template-files/config/env/examples/global.sh rootfs/usr/local/share/template-files/config/env/examples/healthcheck.sh rootfs/usr/local/share/template-files/config/env/examples/mariadb.sh rootfs/usr/local/share/template-files/config/env/examples/mongodb.sh rootfs/usr/local/share/template-files/config/env/examples/networking.sh rootfs/usr/local/share/template-files/config/env/examples/other.sh rootfs/usr/local/share/template-files/config/env/examples/php.sh rootfs/usr/local/share/template-files/config/env/examples/postgres.sh rootfs/usr/local/share/template-files/config/env/examples/redis.sh rootfs/usr/local/share/template-files/config/env/examples/services.sh rootfs/usr/local/share/template-files/config/env/examples/ssl.sh rootfs/usr/local/share/template-files/config/env/examples/supabase.sh rootfs/usr/local/share/template-files/config/env/examples/webservers.sh rootfs/usr/local/share/template-files/config/env/examples/zz-entrypoint.sh --- rootfs/usr/local/bin/entrypoint.sh | 309 +++++++++--------- rootfs/usr/local/bin/pkmgr | 12 +- .../local/etc/docker/functions/entrypoint.sh | 232 ++++++------- .../template-files/config/env/default.sample | 50 +-- .../config/env/examples/00-directory.sh | 4 +- .../config/env/examples/addresses.sh | 4 +- .../config/env/examples/certbot.sh | 4 +- .../config/env/examples/couchdb.sh | 4 +- .../config/env/examples/dockerd.sh | 4 +- .../config/env/examples/global.sh | 6 +- .../config/env/examples/healthcheck.sh | 4 +- .../config/env/examples/mariadb.sh | 4 +- .../config/env/examples/mongodb.sh | 4 +- .../config/env/examples/networking.sh | 4 +- .../config/env/examples/other.sh | 4 +- .../template-files/config/env/examples/php.sh | 4 +- .../config/env/examples/postgres.sh | 4 +- .../config/env/examples/redis.sh | 4 +- .../config/env/examples/services.sh | 4 +- .../template-files/config/env/examples/ssl.sh | 6 +- .../config/env/examples/supabase.sh | 4 +- .../config/env/examples/webservers.sh | 4 +- .../config/env/examples/zz-entrypoint.sh | 8 +- 23 files changed, 355 insertions(+), 332 deletions(-) diff --git a/rootfs/usr/local/bin/entrypoint.sh b/rootfs/usr/local/bin/entrypoint.sh index 979ce9f..d1bdfdd 100755 --- a/rootfs/usr/local/bin/entrypoint.sh +++ b/rootfs/usr/local/bin/entrypoint.sh @@ -1,13 +1,13 @@ #!/usr/bin/env bash # shellcheck shell=bash -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -##@Version : 202509161148-git +# - - - - - - - - - - - - - - - - - - - - - - - - - +##@Version : 202511070804-git # @@Author : Jason Hempstead # @@Contact : jason@casjaysdev.pro -# @@License : LICENSE.md +# @@License : WTFPL # @@ReadME : entrypoint.sh --help # @@Copyright : Copyright: (c) 2025 Jason Hempstead, Casjays Developments -# @@Created : Tuesday, Sep 16, 2025 11:48 EDT +# @@Created : Friday, Nov 07, 2025 08:04 EST # @@File : entrypoint.sh # @@Description : Entrypoint file for lenpaste # @@Changelog : New script @@ -17,33 +17,30 @@ # @@Terminal App : no # @@sudo/root : no # @@Template : other/docker-entrypoint -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # shellcheck disable=SC1001,SC1003,SC2001,SC2003,SC2016,SC2031,SC2120,SC2155,SC2199,SC2317,SC2329 -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -set -e -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # run trap command on exit -trap 'echo "❌ Fatal error, killing container"; kill -TERM 1' ERR -trap 'retVal=$?;[ "$SERVICE_IS_RUNNING" != "yes" ] && [ -f "$SERVICE_PID_FILE" ] && rm -Rf "$SERVICE_PID_FILE";exit $retVal' SIGINT SIGTERM SIGPWR -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +trap 'retVal=$?;[ "$SERVICE_IS_RUNNING" != "yes" ] && [ -f "$SERVICE_PID_FILE" ] && rm -Rf "$SERVICE_PID_FILE";exit $retVal' INT TERM PWR +# - - - - - - - - - - - - - - - - - - - - - - - - - # setup debugging - https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html [ -f "/config/.debug" ] && [ -z "$DEBUGGER_OPTIONS" ] && export DEBUGGER_OPTIONS="$(<"/config/.debug")" || DEBUGGER_OPTIONS="${DEBUGGER_OPTIONS:-}" { [ "$DEBUGGER" = "on" ] || [ -f "/config/.debug" ]; } && echo "Enabling debugging" && set -o pipefail -x$DEBUGGER_OPTIONS && export DEBUGGER="on" || set -o pipefail -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - PATH="/usr/local/etc/docker/bin:/usr/local/bin:/usr/bin:/usr/sbin:/bin:/sbin" -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # Set bash options SCRIPT_FILE="$0" CONTAINER_NAME="lenpaste" SCRIPT_NAME="$(basename -- "$SCRIPT_FILE" 2>/dev/null)" CONTAINER_NAME="${ENV_CONTAINER_NAME:-$CONTAINER_NAME}" -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # remove whitespaces from beginning argument while :; do [ "$1" = " " ] && shift 1 || break; done -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - [ "$1" = "$SCRIPT_FILE" ] && shift 1 [ "$1" = "$SCRIPT_NAME" ] && shift 1 -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # import the functions file if [ -f "/usr/local/etc/docker/functions/entrypoint.sh" ]; then . "/usr/local/etc/docker/functions/entrypoint.sh" @@ -51,7 +48,7 @@ else echo "Can not load functions from /usr/local/etc/docker/functions/entrypoint.sh" exit 1 fi -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - case "$1" in # Help message -h | --help) @@ -65,60 +62,60 @@ case "$1" in shift ;; esac -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # Create the default env files __create_env_file "/config/env/default.sh" "/root/env.sh" &>/dev/null -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # import variables from files for set_env in "/root/env.sh" "/usr/local/etc/docker/env"/*.sh "/config/env"/*.sh; do [ -f "$set_env" ] && . "$set_env" done unset set_env -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # User to use to launch service - IE: postgres RUNAS_USER="root" # normally root -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # Set user and group from env SERVICE_USER="${PUID:-$SERVICE_USER}" SERVICE_GROUP="${PGID:-$SERVICE_GROUP}" -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # Set user and group ID SERVICE_UID="${SERVICE_UID:-0}" # set the user id SERVICE_GID="${SERVICE_GID:-0}" # set the group id -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # User and group in which the service switches to - IE: nginx,apache,mysql,postgres -SERVICE_USER="${SERVICE_USER:-$lenpaste}" # execute command as another user +SERVICE_USER="${SERVICE_USER:-lenpaste}" # execute command as another user SERVICE_GROUP="${SERVICE_GROUP:-lenpaste}" # Set the service group -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # Secondary ports SERVER_PORTS="" # specifiy other ports -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # Primary server port- will be added to server ports WEB_SERVER_PORT="" # port : 80,443 -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # Healthcheck variables HEALTH_ENABLED="yes" # enable healthcheck [yes/no] -SERVICES_LIST="tini" # comma seperated list of processes for the healthcheck +SERVICES_LIST="tini" # comma separated list of processes for the healthcheck HEALTH_ENDPOINTS="" # url endpoints: [http://localhost/health,http://localhost/test] -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # Update path var export PATH RUNAS_USER SERVICE_USER SERVICE_GROUP SERVICE_UID SERVICE_GID WWW_ROOT_DIR DATABASE_DIR -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # Custom variables -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # show message __run_message() { return } -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - ################## END OF CONFIGURATION ##################### # Lets get containers ip address IP4_ADDRESS="$(__get_ip4)" IP6_ADDRESS="$(__get_ip6)" CONTAINER_IP4_ADDRESS="${CONTAINER_IP4_ADDRESS:-$IP4_ADDRESS}" -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # Startup variables export INIT_DATE="${INIT_DATE:-$(date)}" export CONTAINER_INIT="${CONTAINER_INIT:-no}" @@ -128,14 +125,14 @@ export ENTRYPOINT_FIRST_RUN="${ENTRYPOINT_FIRST_RUN:-yes}" export DATA_DIR_INITIALIZED="${DATA_DIR_INITIALIZED:-no}" export CONFIG_DIR_INITIALIZED="${CONFIG_DIR_INITIALIZED:-no}" export CONTAINER_NAME="${ENV_CONTAINER_NAME:-$CONTAINER_NAME}" -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # System export LANG="${LANG:-C.UTF-8}" export LC_ALL="${LANG:-C.UTF-8}" export TZ="${TZ:-${TIMEZONE:-America/New_York}}" export HOSTNAME="$(hostname -s)" export DOMAINNAME="$(hostname -d)" -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # Default directories export SSL_DIR="${SSL_DIR:-/config/ssl}" export SSL_CA="${SSL_CERT:-/config/ssl/ca.crt}" @@ -145,12 +142,12 @@ export LOCAL_BIN_DIR="${LOCAL_BIN_DIR:-/usr/local/bin}" export DEFAULT_DATA_DIR="${DEFAULT_DATA_DIR:-/usr/local/share/template-files/data}" export DEFAULT_CONF_DIR="${DEFAULT_CONF_DIR:-/usr/local/share/template-files/config}" export DEFAULT_TEMPLATE_DIR="${DEFAULT_TEMPLATE_DIR:-/usr/local/share/template-files/defaults}" -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # Backup settings export BACKUP_MAX_DAYS="${BACKUP_MAX_DAYS:-}" export BACKUP_RUN_CRON="${BACKUP_RUN_CRON:-}" export BACKUP_DIR="${BACKUP_DIR:-/data/backups}" -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # Additional export PHP_INI_DIR="${PHP_INI_DIR:-$(__find_php_ini)}" export PHP_BIN_DIR="${PHP_BIN_DIR:-$(__find_php_bin)}" @@ -163,7 +160,7 @@ export ENTRYPOINT_PID_FILE="${ENTRYPOINT_PID_FILE:-$ENTRYPOINT_PID_FILE}" export ENTRYPOINT_INIT_FILE="${ENTRYPOINT_INIT_FILE:-/config/.entrypoint.done}" export ENTRYPOINT_DATA_INIT_FILE="${ENTRYPOINT_DATA_INIT_FILE:-/data/.docker_has_run}" export ENTRYPOINT_CONFIG_INIT_FILE="${ENTRYPOINT_CONFIG_INIT_FILE:-/config/.docker_has_run}" -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - if [ -n "$CONTAINER_WEB_SERVER_WWW_REPO" ]; then www_temp_dir="/tmp/git/$(basename -- "$CONTAINER_WEB_SERVER_WWW_REPO")" rm -Rf "${WWW_ROOT_DIR:?}"/* "${www_temp_dir:?}"/* @@ -173,42 +170,42 @@ if [ -n "$CONTAINER_WEB_SERVER_WWW_REPO" ]; then rsync -ra "$www_temp_dir/" "$WWW_ROOT_DIR" --delete >/dev/null 2>&1 rm -Rf "$www_temp_dir" fi -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # variables based on env/files [ -f "/config/enable/ssl" ] && SSL_ENABLED="yes" [ -f "/config/enable/ssh" ] && SSH_ENABLED="yes" [ "$WEB_SERVER_PORT" = "443" ] && SSL_ENABLED="yes" [ "$CONTAINER_WEB_SERVER_PROTOCOL" = "https" ] && SSL_ENABLED="yes" -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # export variables -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # is already Initialized [ -f "$ENTRYPOINT_DATA_INIT_FILE" ] && DATA_DIR_INITIALIZED="yes" || DATA_DIR_INITIALIZED="no" [ -f "$ENTRYPOINT_CONFIG_INIT_FILE" ] && CONFIG_DIR_INITIALIZED="yes" || CONFIG_DIR_INITIALIZED="no" { [ -f "$ENTRYPOINT_PID_FILE" ] || [ -f "$ENTRYPOINT_INIT_FILE" ]; } && ENTRYPOINT_FIRST_RUN="no" || ENTRYPOINT_FIRST_RUN="yes" -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # clean ENV_PORTS variables ENV_PORTS="${ENV_PORTS//,/ }" # ENV_PORTS="${ENV_PORTS//\/*/}" # -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # clean SERVER_PORTS variables SERVER_PORTS="${SERVER_PORTS//,/ }" # SERVER_PORTS="${SERVER_PORTS//\/*/}" # -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # clean WEB_SERVER_PORTS variables WEB_SERVER_PORTS="${WEB_SERVER_PORT//\/*/}" # WEB_SERVER_PORTS="${WEB_SERVER_PORTS//\/*/}" # WEB_SERVER_PORTS="${WEB_SERVER_PORT//,/ } ${ENV_WEB_SERVER_PORTS//,/ }" # -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # rewrite and merge variables ENV_PORTS="$(__format_variables "$ENV_PORTS" || false)" WEB_SERVER_PORTS="$(__format_variables "$WEB_SERVER_PORTS" || false)" ENV_PORTS="$(__format_variables "$SERVER_PORTS" "$WEB_SERVER_PORTS" "$ENV_PORTS" "$SERVER_PORTS" || false)" -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # Remove the commas from env HEALTH_ENDPOINTS="${HEALTH_ENDPOINTS//,/ }" -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # create required directories mkdir -p "/run" mkdir -p "/tmp" @@ -221,11 +218,11 @@ mkdir -p "/run/init.d" mkdir -p "/config/enable" mkdir -p "/config/secure" mkdir -p "/usr/local/etc/docker/exec" -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # create required files touch "/data/logs/start.log" touch "/data/logs/entrypoint.log" -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # fix permissions chmod -f 777 "/run" chmod -f 777 "/tmp" @@ -239,48 +236,40 @@ chmod -f 777 "/config/enable" chmod -f 777 "/config/secure" chmod -f 777 "/data/logs/entrypoint.log" chmod -f 777 "/usr/local/etc/docker/exec" -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # lets ensure everyone can write to std* [ -f "/dev/stdin" ] && chmod -f 777 "/dev/stdin" [ -f "/dev/stderr" ] && chmod -f 777 "/dev/stderr" [ -f "/dev/stdout" ] && chmod -f 777 "/dev/stdout" -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - cat </dev/null export LANG="\${LANG:-C.UTF-8}" export LC_ALL="\${LANG:-C.UTF-8}" export TZ="\${TZ:-\${TIMEZONE:-America/New_York}}" EOF -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # Create the backup dir [ -n "$BACKUP_DIR" ] && { [ -d "$BACKUP_DIR" ] || mkdir -p "$BACKUP_DIR"; } -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -if [ -f "$ENTRYPOINT_PID_FILE" ]; then - START_SERVICES="no" - touch "$ENTRYPOINT_PID_FILE" -else - echo "$$" >"$ENTRYPOINT_PID_FILE" - # Clean any stale PID files on first run - rm -f /run/init.d/*.pid 2>/dev/null || true -fi +# - - - - - - - - - - - - - - - - - - - - - - - - - if [ -f "$ENTRYPOINT_INIT_FILE" ]; then ENTRYPOINT_MESSAGE="no" ENTRYPOINT_FIRST_RUN="no" fi -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - if [ "$ENTRYPOINT_FIRST_RUN" != "no" ]; then # Show start message if [ "$CONFIG_DIR_INITIALIZED" = "no" ] || [ "$DATA_DIR_INITIALIZED" = "no" ]; then [ "$ENTRYPOINT_MESSAGE" = "yes" ] && echo "Executing entrypoint script for lenpaste" fi - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + # - - - - - - - - - - - - - - - - - - - - - - - - - # Set reusable variables { { [ -w "/etc" ] && [ ! -f "/etc/hosts" ]; } || [ -w "/etc/hosts" ]; } && UPDATE_FILE_HOSTS="yes" && touch "/etc/hosts" { { [ -w "/etc" ] && [ ! -f "/etc/timezone" ]; } || [ -w "/etc/timezone" ]; } && UPDATE_FILE_TZ="yes" && touch "/etc/timezone" { { [ -w "/etc" ] && [ ! -f "/etc/resolv.conf" ]; } || [ -w "/etc/resolv.conf" ]; } && UPDATE_FILE_RESOLV="yes" && touch "/etc/resolv.conf" - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + # - - - - - - - - - - - - - - - - - - - - - - - - - # Set timezone [ -n "$TZ" ] && [ "$UPDATE_FILE_TZ" = "yes" ] && echo "$TZ" >"/etc/timezone" [ -f "/usr/share/zoneinfo/$TZ" ] && [ "$UPDATE_FILE_TZ" = "yes" ] && ln -sf "/usr/share/zoneinfo/$TZ" "/etc/localtime" - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + # - - - - - - - - - - - - - - - - - - - - - - - - - # if ipv6 add it to /etc/hosts if [ "$UPDATE_FILE_HOSTS" = "yes" ]; then echo "# known hostname mappings" >"/etc/hosts" @@ -291,98 +280,104 @@ if [ "$ENTRYPOINT_FIRST_RUN" != "no" ]; then __printf_space "40" "127.0.0.1" "localhost" >>"/etc/hosts" fi fi - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + # - - - - - - - - - - - - - - - - - - - - - - - - - # add .internal domain if [ "$UPDATE_FILE_HOSTS" = "yes" ] && [ -n "$HOSTNAME" ]; then __grep_test " $HOSTNAME" "/etc/hosts" || __printf_space "40" "${CONTAINER_IP4_ADDRESS:-127.0.0.1}" "$HOSTNAME" >>"/etc/hosts" __grep_test " ${HOSTNAME%%.*}.internal" "/etc/hosts" || __printf_space "40" "${CONTAINER_IP4_ADDRESS:-127.0.0.1}" "${HOSTNAME%%.*}.internal" >>"/etc/hosts" fi - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + # - - - - - - - - - - - - - - - - - - - - - - - - - # add domainname if [ "$UPDATE_FILE_HOSTS" = "yes" ] && [ "$DOMAINNAME" != "internal" ] && [ -n "$DOMAINNAME" ] && [ "$HOSTNAME.$DOMAINNAME" != "$DOMAINNAME" ]; then __grep_test " ${HOSTNAME%%.*}.$DOMAINNAME" "/etc/hosts" || __printf_space "40" "${CONTAINER_IP4_ADDRESS:-127.0.0.1}" "${HOSTNAME%%.*}.$DOMAINNAME" >>"/etc/hosts" fi - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + # - - - - - - - - - - - - - - - - - - - - - - - - - # Set containers hostname [ -n "$HOSTNAME" ] && [ "$UPDATE_FILE_HOSTS" = "yes" ] && echo "$HOSTNAME" >"/etc/hostname" - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + # - - - - - - - - - - - - - - - - - - - - - - - - - if [ -f "/etc/hostname" ]; then [ -n "$(type -P hostname)" ] && hostname -F "/etc/hostname" &>/dev/null || HOSTNAME="$(<"/etc/hostname")" export HOSTNAME fi - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + # - - - - - - - - - - - - - - - - - - - - - - - - - # import hosts file into container [ -f "/usr/local/etc/hosts" ] && [ "$UPDATE_FILE_HOSTS" = "yes" ] && cat "/usr/local/etc/hosts" | grep -vF "$HOSTNAME" >>"/etc/hosts" - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + # - - - - - - - - - - - - - - - - - - - - - - - - - # import resolv.conf file into container [ "$CUSTOM_DNS" != "yes" ] && [ -f "/usr/local/etc/resolv.conf" ] && [ "$UPDATE_FILE_RESOLV" = "yes" ] && cat "/usr/local/etc/resolv.conf" >"/etc/resolv.conf" - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + # - - - - - - - - - - - - - - - - - - - - - - - - - if [ -n "$HOME" ] && [ -d "/usr/local/etc/skel" ]; then [ -d "$HOME" ] && cp -Rf "/usr/local/etc/skel/." "$HOME/" fi -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - fi -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # Delete any .gitkeep files [ -d "/data" ] && rm -Rf "/data/.gitkeep" "/data"/*/*.gitkeep [ -d "/config" ] && rm -Rf "/config/.gitkeep" "/config"/*/*.gitkeep [ -f "/usr/local/bin/.gitkeep" ] && rm -Rf "/usr/local/bin/.gitkeep" -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # Setup bin directory - /config/bin > /usr/local/bin __initialize_custom_bin_dir -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # Copy default system configs - /usr/local/share/template-files/defaults > /config/ __initialize_default_templates -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # Copy custom config files - /usr/local/share/template-files/config > /config/ __initialize_config_dir -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # Copy custom data files - /usr/local/share/template-files/data > /data/ __initialize_data_dir -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - __initialize_ssl_certs -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - if [ -f "$ENTRYPOINT_INIT_FILE" ]; then ENTRYPOINT_FIRST_RUN="no" fi -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - if [ -d "/config" ]; then echo "Initialized on: $INIT_DATE" >"$ENTRYPOINT_INIT_FILE" fi -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # Check if this is a new container if [ -f "$ENTRYPOINT_DATA_INIT_FILE" ]; then DATA_DIR_INITIALIZED="yes" fi -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - if [ -d "/data" ]; then echo "Initialized on: $INIT_DATE" >"$ENTRYPOINT_DATA_INIT_FILE" fi -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - if [ -f "$ENTRYPOINT_CONFIG_INIT_FILE" ]; then CONFIG_DIR_INITIALIZED="yes" fi -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - if [ -d "/config" ]; then echo "Initialized on: $INIT_DATE" >"$ENTRYPOINT_CONFIG_INIT_FILE" fi -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - if [ "$ENTRYPOINT_FIRST_RUN" != "no" ]; then # setup the smtp server __setup_mta fi -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # if no pid assume container restart - clean stale files on restart -if [ ! -f "$ENTRYPOINT_PID_FILE" ]; then - START_SERVICES="yes" - # Clean stale pid files from previous container runs +if [ -f "$ENTRYPOINT_PID_FILE" ]; then + START_SERVICES="no" + touch "$ENTRYPOINT_PID_FILE" +else + START_SERVICES=yes + # Clean any stale PID files on first run rm -f /run/__start_init_scripts.pid /run/init.d/*.pid /run/*.pid 2>/dev/null || true -elif [ ! -f "/run/__start_init_scripts.pid" ]; then - START_SERVICES="yes" fi -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -[ "$ENTRYPOINT_MESSAGE" = "yes" ] && __printf_space "40" "Container ip address is:" "$CONTAINER_IP4_ADDRESS" -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - +if [ ! -f "/run/__start_init_scripts.pid" ]; then + START_SERVICES="yes" + touch /run/__start_init_scripts.pid +fi +# - - - - - - - - - - - - - - - - - - - - - - - - - +[ "$ENTRYPOINT_MESSAGE" = "yes" ] && __printf_space "40" "The containers ip address is:" "$CONTAINER_IP4_ADDRESS" +# - - - - - - - - - - - - - - - - - - - - - - - - - # Show configured listing processes if [ "$ENTRYPOINT_MESSAGE" = "yes" ] && [ -n "$ENV_PORTS" ]; then show_port="" @@ -390,34 +385,45 @@ if [ "$ENTRYPOINT_MESSAGE" = "yes" ] && [ -n "$ENV_PORTS" ]; then __printf_space "40" "The following ports are open:" "$show_port" unset port show_port fi -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # execute init script if [ -f "/tmp/init" ]; then sh "/tmp/init"; fi -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # create user if needed __create_service_user "$SERVICE_USER" "$SERVICE_GROUP" "${WORK_DIR:-/home/$SERVICE_USER}" "${SERVICE_UID:-}" "${SERVICE_GID:-}" -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # Modify user if needed __set_user_group_id $SERVICE_USER ${SERVICE_UID:-} ${SERVICE_GID:-} -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # Show message __run_message -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # Just start services START_SERVICES="${START_SERVICES:-SYSTEM_INIT}" -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - +# Never start services for these options +[ "$1" = "cron" ] && START_SERVICES="no" +[ "$1" = "tail" ] && START_SERVICES="no" +[ "$1" = "logs" ] && START_SERVICES="no" +[ "$1" = "cron" ] && START_SERVICES="no" +[ "$1" = "backup" ] && START_SERVICES="no" +[ "$1" = "healthcheck" ] && START_SERVICES="no" +[ "$1" = "init" ] && START_SERVICES="no" && CONTAINER_INIT="yes" +[ "$2" = "init" ] && START_SERVICES="no" && CONTAINER_INIT="yes" +echo "$1" | grep -qE '^(sh|bash)$|*/(sh|bash)$' && START_SERVICES="no" +# - - - - - - - - - - - - - - - - - - - - - - - - - # Start all services if no pidfile -if [ "$START_SERVICES" = "yes" ] && [ "$1" != "backup" ] && [ "$1" != "healthcheck" ] && [ "$1" != "cron" ] && [ "$1" != "tail" ] && [ "$1" != "logs" ] && [ "$1" != "cron" ]; then +if [ "$START_SERVICES" = "yes" ] || [ -z "$1" ]; then [ "$1" = "start" ] && shift 1 [ "$1" = "all" ] && shift 1 - [ "$1" = "init" ] && export CONTAINER_INIT="yes" + rm -Rf "/run"/*/*pid 2>/dev/null || true echo "$$" >"$ENTRYPOINT_PID_FILE" - rm -Rf "/run"/*/*pid __start_init_scripts "/usr/local/etc/docker/init.d" START_SERVICES="no" CONTAINER_INIT="${CONTAINER_INIT:-no}" fi -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +export START_SERVICES CONTAINER_INIT ENTRYPOINT_PID_FILE +# - - - - - - - - - - - - - - - - - - - - - - - - - # Begin options case "$1" in init) @@ -477,50 +483,57 @@ backup) ;; # Docker healthcheck healthcheck) - arguments="$*" - healthStatus=0 - healthEnabled="${HEALTH_ENABLED:-}" - healthPorts="${WEB_SERVER_PORTS:-}" - healthEndPoints="${HEALTH_ENDPOINTS:-}" - SERVICES_LIST="${arguments:-$SERVICES_LIST}" - services="$(echo "${SERVICES_LIST//,/ }")" - healthMessage="Everything seems to be running" - [ "$healthEnabled" = "yes" ] || exit 0 - if [ -d "/run/healthcheck" ] && [ "$(ls -A "/run/healthcheck" | wc -l)" -ne 0 ]; then - for service in /run/healthcheck/*; do - name=$(basename -- $service) - services+="$name " + shift 1 + case "$1" in + init | test) + exit 0 + ;; + *) + arguments="$*" + healthStatus=0 + healthEnabled="${HEALTH_ENABLED:-}" + healthPorts="${WEB_SERVER_PORTS:-}" + healthEndPoints="${HEALTH_ENDPOINTS:-}" + SERVICES_LIST="${arguments:-$SERVICES_LIST}" + services="$(echo "${SERVICES_LIST//,/ }")" + healthMessage="Everything seems to be running" + [ "$healthEnabled" = "yes" ] || exit 0 + if [ -d "/run/healthcheck" ] && [ "$(ls -A "/run/healthcheck" | wc -l)" -ne 0 ]; then + for service in /run/healthcheck/*; do + name=$(basename -- $service) + services+="$name " + done + fi + services="$(echo "$services" | tr ' ' '\n' | sort -u | grep -v '^$')" + for proc in $services; do + if [ -n "$proc" ]; then + if ! __pgrep "$proc"; then + echo "$proc is not running" >&2 + healthStatus=$((healthStatus + 1)) + fi + fi done - fi - services="$(echo "$services" | tr ' ' '\n' | sort -u | grep -v '^$')" - { [ "$1" = "init" ] || [ "$1" = "test" ]; } && exit 0 - for proc in $services; do - if [ -n "$proc" ]; then - if ! __pgrep "$proc"; then - echo "$proc is not running" >&2 - healthStatus=$((healthStatus + 1)) + for port in $ports; do + if [ -n "$(type -P netstat)" ] && [ -n "$port" ]; then + if ! netstat -taupln | grep -q ":$port "; then + echo "$port isn't open" >&2 + healthStatus=$((healthStatus + 1)) + fi fi - fi - done - for port in $ports; do - if [ -n "$(type -P netstat)" ] && [ -n "$port" ]; then - if ! netstat -taupln | grep -q ":$port "; then - echo "$port isn't open" >&2 - healthStatus=$((healthStatus + 1)) + done + for endpoint in $healthEndPoints; do + if [ -n "$endpoint" ]; then + if ! __curl "$endpoint"; then + echo "Can not connect to $endpoint" >&2 + healthStatus=$((healthStatus + 1)) + fi fi - fi - done - for endpoint in $healthEndPoints; do - if [ -n "$endpoint" ]; then - if ! __curl "$endpoint"; then - echo "Can not connect to $endpoint" >&2 - healthStatus=$((healthStatus + 1)) - fi - fi - done - [ "$healthStatus" -eq 0 ] || healthMessage="Errors reported see: docker logs --follow $CONTAINER_NAME" - [ -n "$healthMessage" ] && echo "$healthMessage" - exit $healthStatus + done + [ "$healthStatus" -eq 0 ] || healthMessage="Errors reported see: docker logs --follow $CONTAINER_NAME" + [ -n "$healthMessage" ] && echo "$healthMessage" + exit $healthStatus + ;; + esac ;; # show open ports ports) @@ -603,8 +616,8 @@ start) exit $? ;; esac -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # end of entrypoint -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # ex: ts=2 sw=2 et filetype=sh diff --git a/rootfs/usr/local/bin/pkmgr b/rootfs/usr/local/bin/pkmgr index 205c2b0..fbd269a 100755 --- a/rootfs/usr/local/bin/pkmgr +++ b/rootfs/usr/local/bin/pkmgr @@ -1,10 +1,10 @@ #!/usr/bin/env sh # shellcheck shell=sh # shellcheck disable=SC2016 -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - USER_UID="$(id -u)" USER_GID="$(id -g)" -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - if [ -x "$(command -v apt 2>/dev/null)" ]; then export DEBIAN_FRONTEND=noninteractive pkmgr_cmd="apt" @@ -58,7 +58,7 @@ else pkmgr_update_cmd="$pkmgr_cmd" pkmgr_install_cmd="$pkmgr_cmd" fi -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - if [ -f "/config/pkmgr/settings.conf" ]; then . "/config/pkmgr/settings.conf" elif [ -f "/etc/pkmgr/settings.conf" ]; then @@ -73,9 +73,9 @@ pkmgr_install_cmd="$pkmgr_install_cmd" pkmgr_mkcache_cmd="$pkmgr_mkcache_cmd" EEOF fi -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - [ -n "$pkmgr_cmd" ] || { echo "Can not determine the package manager" && exit 1; } -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - case "$1" in pip) shift 1 @@ -138,5 +138,5 @@ clean) exit $? ;; esac -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # end diff --git a/rootfs/usr/local/etc/docker/functions/entrypoint.sh b/rootfs/usr/local/etc/docker/functions/entrypoint.sh index b44ed1b..b9584d0 100644 --- a/rootfs/usr/local/etc/docker/functions/entrypoint.sh +++ b/rootfs/usr/local/etc/docker/functions/entrypoint.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash # shellcheck shell=bash -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - ##@Version : 202407241259-git # @@Author : Jason Hempstead # @@Contact : git-admin@casjaysdev.pro @@ -17,15 +17,15 @@ # @@Terminal App : no # @@sudo/root : no # @@Template : functions/docker-entrypoint -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # shellcheck disable=SC1001,SC1003,SC2001,SC2003,SC2016,SC2031,SC2120,SC2155,SC2199,SC2317,SC2329 -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # setup debugging - https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html -[ -f "/config/.debug" ] && [ -z "$DEBUGGER_OPTIONS" ] && export DEBUGGER_OPTIONS="$(<"/config/.debug")" || DEBUGGER_OPTIONS="${DEBUGGER_OPTIONS:-}" -{ [ "$DEBUGGER" = "on" ] || [ -f "/config/.debug" ]; } && echo "Enabling debugging" && set -xo pipefail -x$DEBUGGER_OPTIONS && export DEBUGGER="on" || set -o pipefail -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +[ -f "/config/.debug" ] && [ -z "$DEBUGGER_OPTIONS" ] && export DEBUGGER_OPTIONS="$(<"/config/.debug")" || true +{ [ "$DEBUGGER" = "on" ] || [ -f "/config/.debug" ]; } && set -xo pipefail -x$DEBUGGER_OPTIONS && export DEBUGGER="on" || set -o pipefail +# - - - - - - - - - - - - - - - - - - - - - - - - - __remove_extra_spaces() { sed 's/\( \)*/\1/g;s|^ ||g'; } -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - __printf_space() { local pad=$(printf '%0.1s' " "{1..60}) local padlength=$1 @@ -37,7 +37,8 @@ __printf_space() { message+="$(printf '%s\n' "$string2") " printf '%s\n' "$message" } -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - +__mkdir() { [ -n "$1" ] && mkdir -p "$@" || return 1; } __rm() { [ -n "$1" ] && [ -e "$1" ] && rm -Rf "${1:?}"; } __grep_test() { grep -sh "$1" "$2" | grep -qwF "${3:-$1}" || return 1; } __netstat() { [ -f "$(type -P netstat)" ] && netstat "$@" || return 10; } @@ -52,7 +53,8 @@ __ps() { [ -f "$(type -P ps)" ] && ps "$@" 2>/dev/null | sed 's|:||g' | grep -Fw __is_dir_empty() { if [ -n "$1" ]; then [ "$(ls -A "$1" 2>/dev/null | wc -l)" -eq 0 ] && return 0 || return 1; else return 1; fi; } __get_ip6() { ip a 2>/dev/null | grep -w 'inet6' | awk '{print $2}' | grep -vE '^::1|^fe' | sed 's|/.*||g' | head -n1 | grep '.' || echo ''; } __get_ip4() { ip a 2>/dev/null | grep -w 'inet' | awk '{print $2}' | grep -vE '^127.0.0' | sed 's|/.*||g' | head -n1 | grep '.' || echo '127.0.0.1'; } -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +__find_and_remove() { find "${2:-/etc}" -iname "$1" -exec rm -Rfv {} \; 2>/dev/null; } +# - - - - - - - - - - - - - - - - - - - - - - - - - __pgrep() { local count=3 local srvc="${1:-SERVICE_NAME}" @@ -64,28 +66,28 @@ __pgrep() { done return 10 } -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - __find_file_relative() { [ -e "$1" ] || return 0 find "$1"/* -not -path '*env/*' -not -path '.git*' -type f 2>/dev/null | sed 's|'$1'/||g' | sort -u | grep -v '^$' | grep '.' || false } -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - __find_directory_relative() { [ -d "$1" ] || return 0 find "$1"/* -not -path '*env/*' -not -path '.git*' -type d 2>/dev/null | sed 's|'$1'/||g' | sort -u | grep -v '^$' | grep '.' || false } -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -__pid_exists() { +# - - - - - - - - - - - - - - - - - - - - - - - - - +__pid_exists() { local result="" result="$(ps -ax --no-header 2>/dev/null | sed 's/^[[:space:]]*//g' | awk -F' ' '{print $1}' | sed 's|:||g' | grep '[0-9]' | sort -uV | grep "^$1$" 2>/dev/null || echo '')" [ -n "$result" ] && return 0 || return 1 } -__is_running() { +__is_running() { local result="" result="$(ps -eo args --no-header 2>/dev/null | awk '{print $1,$2,$3}' | sed 's|:||g' | sort -u | grep -vE 'grep|COMMAND|awk|tee|ps|sed|sort|tail' | grep "$1" | grep "${2:-^}" 2>/dev/null || echo '')" [ -n "$result" ] && return 0 || return 1 } -__get_pid() { +__get_pid() { local result="" result="$(ps -ax --no-header 2>/dev/null | sed 's/^[[:space:]]*//g;s|;||g;s|:||g' | awk '{print $1,$5}' | sed 's|:||g' | grep "$1$" | grep -v 'grep' | awk -F' ' '{print $1}' | grep '[0-9]' | sort -uV | head -n1 | grep '.' 2>/dev/null || echo '')" if [ -n "$result" ]; then @@ -95,9 +97,9 @@ __get_pid() { return 1 fi } -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - __format_variables() { printf '%s\n' "${@//,/ }" | tr ' ' '\n' | sort -RVu | grep -v '^$' | tr '\n' ' ' | __clean_variables | grep '.' || return 0; } -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - __clean_variables() { local var="$*" var="${var#"${var%%[![:space:]]*}"}" # remove leading whitespace characters @@ -105,7 +107,7 @@ __clean_variables() { var="$(printf '%s\n' "$var" | sed 's/\( \)*/\1/g;s|^ ||g')" printf '%s' "$var" | grep -v '^$' } -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - __no_exit() { local monitor_interval="${SERVICE_MONITOR_INTERVAL:-60}" local failure_threshold="${SERVICE_FAILURE_THRESHOLD:-3}" @@ -145,7 +147,7 @@ __no_exit() { wait " } -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - __trim() { local var="${*//;/ }" var="${var#"${var%%[![:space:]]*}"}" # remove leading whitespace characters @@ -153,14 +155,14 @@ __trim() { var="$(echo "$var" | __remove_extra_spaces | sed "s| |; |g;s|;$| |g" | __remove_extra_spaces)" printf '%s' "$var" | sed 's|;||g' | grep -v '^$' } -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - __banner() { local message="$*" local total_width=80 local content_width=$((total_width - 14)) # Account for "# - - - " and " - - - #" printf '# - - - %-*s - - - #\n' "$content_width" "$message" } -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - __service_banner() { local icon="${1:-🔧}" local message="${2:-Processing}" @@ -172,23 +174,23 @@ __service_banner() { local text_width=$((content_width - icon_width * 2 - 2)) # Account for both icons and spaces printf '# - - - %s %-*s %s - - - #\n' "$icon" "$text_width" "$full_message" "$icon" } -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - __find_php_bin() { find -L '/usr'/*bin -maxdepth 4 -name 'php-fpm*' 2>/dev/null | head -n1 | grep '.' || echo ''; } __find_php_ini() { find -L '/etc' -maxdepth 4 -name 'php.ini' 2>/dev/null | head -n1 | sed 's|/php.ini||g' | grep '.' || echo ''; } -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - __find_nginx_conf() { find -L '/etc' -maxdepth 4 -name 'nginx.conf' 2>/dev/null | head -n1 | grep '.' || echo ''; } __find_caddy_conf() { find -L '/etc' -maxdepth 4 -type f -iname 'caddy.conf' 2>/dev/null | head -n1 | grep '.' || echo ''; } __find_lighttpd_conf() { find -L '/etc' -maxdepth 4 -type f -iname 'lighttpd.conf' 2>/dev/null | head -n1 | grep '.' || echo ''; } __find_cherokee_conf() { find -L '/etc' -maxdepth 4 -type f -iname 'cherokee.conf' 2>/dev/null | head -n1 | grep '.' || echo ''; } __find_httpd_conf() { find -L '/etc' -maxdepth 4 -type f -iname 'httpd.conf' -o -iname 'apache2.conf' 2>/dev/null | head -n1 | grep '.' || echo ''; } -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - __find_mysql_conf() { find -L '/etc' -maxdepth 4 -type f -name 'my.cnf' 2>/dev/null | head -n1 | grep '.' || echo ''; } __find_pgsql_conf() { find -L '/var/lib' '/etc' -maxdepth 8 -type f -name 'postgresql.conf' 2>/dev/null | head -n1 | grep '.' || echo ''; } __find_couchdb_conf() { return; } __find_mongodb_conf() { return; } -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - __random_password() { cat "/dev/urandom" | tr -dc '0-9a-zA-Z' | head -c${1:-16} && echo ""; } -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - __init_working_dir() { local service_name="$SERVICE_NAME" # get service name local workdir="$(eval echo "${WORK_DIR:-}")" # expand variables @@ -206,15 +208,15 @@ __init_working_dir() { [ -n "$workdir" ] && { [ -d "$workdir" ] || mkdir -p "$workdir"; } [ "$SERVICE_USER" = "root" ] || [ -d "$home" ] && chmod -f 777 "$home" [ "$SERVICE_USER" = "root" ] || [ -d "$workdir" ] && chmod -f 777 "$workdir" - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + # - - - - - - - - - - - - - - - - - - - - - - - - - # cd to dir __cd "${workdir:-$home}" - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + # - - - - - - - - - - - - - - - - - - - - - - - - - echo "Setting the working directory to: $PWD" - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + # - - - - - - - - - - - - - - - - - - - - - - - - - export WORK_DIR="$workdir" HOME="$home" } -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - __exec_service() { local count=6 echo "Starting $1" @@ -224,7 +226,7 @@ __exec_service() { __pgrep $1 && touch "/run/init.d/$1.pid" && break || count=$((count - 1)) done } -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - __update_ssl_certs() { [ -f "/config/env/ssl.sh" ] && . "/config/env/ssl.sh" if [ -f "$SSL_CERT" ] && [ -f "$SSL_KEY" ]; then @@ -234,7 +236,7 @@ __update_ssl_certs() { [ -f "$SSL_CERT" ] && cp -Rf "$SSL_CERT" "/etc/ssl/$SSL_CERT" fi } -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - __certbot() { [ -n "$(type -P 'certbot')" ] || return 1 local options="$1" @@ -295,7 +297,7 @@ __certbot() { [ $statusCode -eq 0 ] && __update_ssl_certs return $statusCode } -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - __display_user_info() { if [ -n "$user_name" ] || [ -n "$user_pass" ] || [ -n "$root_user_name" ] || [ -n "$root_user_pass" ]; then __banner "User info" @@ -306,7 +308,7 @@ __display_user_info() { __banner "" fi } -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - __init_config_etc() { local copy="no" local name="$(find "/etc/$SERVICE_NAME" -maxdepth 0 2>/dev/null | head -n1)" @@ -321,7 +323,7 @@ __init_config_etc() { __copy_templates "$etc_dir" "$conf_dir" fi fi - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + # - - - - - - - - - - - - - - - - - - - - - - - - - } __create_ssl_cert() { local SSL_DIR="${SSL_DIR:-/etc/ssl}" @@ -353,7 +355,7 @@ __create_ssl_cert() { return 2 fi } -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - __init_apache() { local etc_dir="" conf_dir="" conf_dir="" www_dir="" apache_bin="" etc_dir="/etc/${1:-apache2}" @@ -363,7 +365,7 @@ __init_apache() { # return 0 } -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - __init_nginx() { local etc_dir="/etc/${1:-nginx}" local conf_dir="/config/${1:-nginx}" @@ -371,14 +373,14 @@ __init_nginx() { local nginx_bin="$(type -P 'nginx')" return 0 } -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - __init_php() { local etc_dir="/etc/${1:-php}" local conf_dir="/config/${1:-php}" local php_bin="${PHP_BIN_DIR:-$(__find_php_bin)}" return 0 } -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - __init_mysql() { local db_dir="/data/db/mysql" local etc_dir="${home:-/etc/${1:-mysql}}" @@ -391,28 +393,28 @@ __init_mysql() { local mysqld_bin="$(type -P 'mysqld')" return 0 } -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - __init_mongodb() { local home="${MONGODB_CONFIG_FILE:-$(__find_mongodb_conf)}" local user_name="${INITDB_ROOT_USERNAME:-root}" local user_pass="${MONGO_INITDB_ROOT_PASSWORD:-$_ROOT_PASSWORD}" return } -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - __init_postgres() { local home="${PGSQL_CONFIG_FILE:-$(__find_pgsql_conf)}" local user_name="${POSTGRES_USER:-root}" local user_pass="${POSTGRES_PASSWORD:-$POSTGRES_ROOT_PASSWORD}" return } -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - __init_couchdb() { local home="${COUCHDB_CONFIG_FILE:-$(__find_couchdb_conf)}" local user_name="${COUCHDB_USER:-root}" local user_pass="${COUCHDB_PASSWORD:-$SET_RANDOM_PASS}" return } -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # Show available init functions __init_help() { echo ' @@ -422,7 +424,7 @@ __create_ssl_cert ' return } -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - __run_once() { if [ "$CONFIG_DIR_INITIALIZED" = "false" ] || [ "$DATA_DIR_INITIALIZED" = "false" ] || [ ! -f "/config/.docker_has_run" ]; then return 0 @@ -430,7 +432,7 @@ __run_once() { return 1 fi } -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # run program ever n minutes __cron() { trap 'retVal=$?;[ -f "/run/cron/$bin.run" ] && rm -Rf "/run/cron/$bin.run";[ -f "/run/cron/$bin.pid" ] && rm -Rf "/run/cron/$bin.pid";exit ${retVal:-0}' SIGINT ERR EXIT @@ -449,19 +451,19 @@ __cron() { [ -f "/run/cron/$bin.run" ] || break done 2>/dev/stderr >>"/data/logs/cron.log" } -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - __replace() { local search="$1" replace="$2" file="${3:-$2}" [ -e "$file" ] || return 1 __sed "$search" "$replace" "$file" || return 0 } -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - __find_replace() { local search="$1" replace="$2" file="${3:-$2}" [ -e "$file" ] || return 1 find "$file" -type f -not -path '.git*' -exec sed -i "s|$search|$replace|g" {} \; 2>/dev/null } -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # /config > /etc __copy_templates() { local from="$1" to="$2" @@ -471,7 +473,7 @@ __copy_templates() { __file_copy "$from" "$to" fi } -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # /config/file > /etc/file __symlink() { local from="$1" to="$2" @@ -480,7 +482,7 @@ __symlink() { ln -sf "$to" "$from" && echo "Created symlink to $from > $to" fi } -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - __file_copy() { local from="$1" local dest="$2" @@ -510,7 +512,7 @@ __file_copy() { fi fi } -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - __generate_random_uids() { local set_random_uid="$(seq 100 999 | sort -R | head -n 1)" while :; do @@ -522,7 +524,7 @@ __generate_random_uids() { fi done } -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - __setup_directories() { APPLICATION_DIRS="${APPLICATION_DIRS//,/ }" APPLICATION_FILES="${APPLICATION_FILES//,/ }" @@ -555,7 +557,7 @@ __setup_directories() { fi done } -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # set user on files/folders __fix_permissions() { change_user="${1:-${SERVICE_USER:-root}}" @@ -580,14 +582,14 @@ __fix_permissions() { fi fi } -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - __get_gid() { grep "^$1:" /etc/group | awk -F ':' '{print $3}' || false; } __get_uid() { grep "^$1:" /etc/passwd | awk -F ':' '{print $3}' || false; } __check_for_uid() { cat "/etc/passwd" 2>/dev/null | awk -F ':' '{print $3}' | sort -u | grep -q "^$1$" || false; } __check_for_guid() { cat "/etc/group" 2>/dev/null | awk -F ':' '{print $3}' | sort -u | grep -q "^$1$" || false; } __check_for_user() { cat "/etc/passwd" 2>/dev/null | awk -F ':' '{print $1}' | sort -u | grep -q "^$1$" || false; } __check_for_group() { cat "/etc/group" 2>/dev/null | awk -F ':' '{print $1}' | sort -u | grep -q "^$1$" || false; } -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # check if process is already running __proc_check() { cmd_bin="$(type -P "${1:-$EXEC_CMD_BIN}")" @@ -601,7 +603,7 @@ __proc_check() { fi } -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - __set_user_group_id() { local exitStatus=0 local set_user="${1:-$SERVICE_USER}" @@ -614,16 +616,16 @@ __set_user_group_id() { [ -n "$set_user" ] && [ "$set_user" != "root" ] || return if grep -shq "^$set_user:" "/etc/passwd" "/etc/group"; then if __check_for_guid "$set_gid"; then - groupmod -g "${set_gid}" $set_user 2>/dev/stderr | tee -p -a "/data/logs/init.txt" >/dev/null && chown -Rf ":$set_gid" + groupmod -g "${set_gid}" $set_user 2>/dev/stderr | tee -p -a "/data/logs/init.txt" >/dev/null fi if __check_for_uid "$set_uid"; then - usermod -u "${set_uid}" -g "${set_gid}" $set_user 2>/dev/stderr | tee -p -a "/data/logs/init.txt" >/dev/null && chown -Rf $set_uid:$set_gid + usermod -u "${set_uid}" -g "${set_gid}" $set_user 2>/dev/stderr | tee -p -a "/data/logs/init.txt" >/dev/null fi fi export SERVICE_UID="$set_uid" export SERVICE_GID="$set_gid" } -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - __create_service_user() { local exitStatus=0 local create_user="${1:-$SERVICE_USER}" @@ -634,7 +636,9 @@ __create_service_user() { local random_id="$(__generate_random_uids)" local create_home_dir="${create_home_dir:-/home/$create_user}" grep -shq "^$create_user:" "/etc/passwd" && grep -shq "^$create_group:" "/etc/group" && return - [ "$create_user" = "root" ] && [ "$create_group" = "root" ] && return 0 + if [ "$create_user" = "root" ] && [ "$create_group" = "root" ]; then + return 0 + fi if [ "$RUNAS_USER" != "root" ] && [ "$RUNAS_USER" != "" ]; then create_user="$RUNAS_USER" create_group="$RUNAS_USER" @@ -653,17 +657,17 @@ __create_service_user() { break fi done - if ! __check_for_group "$create_group"; then + if [ -n "$create_group" ] && ! __check_for_group "$create_group"; then echo "creating system group $create_group" - groupadd --force --system -g $create_gid $create_group 2>/dev/stderr | tee -p -a "/data/logs/init.txt" >/dev/null + groupadd --force --system -g $create_gid $create_group 2>/dev/stderr | tee -a "/data/logs/init.txt" >/dev/null + grep -shq "$create_group" "/etc/group" || exitStatus=$((exitStatus + 1)) fi - if ! __check_for_user "$create_user"; then + if [ -n "$create_user" ] && ! __check_for_user "$create_user"; then echo "creating system user $create_user" - useradd --system -u $create_uid -g $create_group -c "Account for $create_user" -d "$create_home_dir" -s /bin/false $create_user 2>/dev/stderr | tee -p -a "/data/logs/init.txt" >/dev/null + useradd --system --uid $create_uid --gid $create_group --comment "Account for $create_user" --home-dir "$create_home_dir" --shell /bin/false $create_user 2>/dev/stderr | tee -a "/data/logs/init.txt" >/dev/null + grep -shq "$create_user" "/etc/passwd" || exitStatus=$((exitStatus + 1)) fi - grep -shq "$create_group" "/etc/group" || exitStatus=$((exitStatus + 1)) - grep -shq "$create_user" "/etc/passwd" || exitStatus=$((exitCode + 1)) - if [ $exitStatus -eq 0 ]; then + if [ $exitStatus -eq 0 ] && [ -n "$create_group" ] && [ -n "$create_user" ]; then export WORK_DIR="${create_home_dir:-}" if [ -n "$WORK_DIR" ]; then [ -d "$WORK_DIR" ] || mkdir -p "$WORK_DIR" @@ -674,20 +678,22 @@ __create_service_user() { elif [ -f "/etc/sudoers" ] && ! grep -qs "$create_user" "/etc/sudoers"; then echo "$create_user ALL=(ALL) NOPASSWD: ALL" >"/etc/sudoers" fi - export SERVICE_UID="$create_uid" - export SERVICE_GID="$create_gid" - export SERVICE_USER="$create_user" - export SERVICE_GROUP="$create_group" + exitStatus=0 + SERVICE_UID="$create_uid" + SERVICE_GID="$create_gid" + SERVICE_USER="$create_user" + SERVICE_GROUP="$create_group" else - export USER_UID=0 - export USER_GID=0 - export SERVICE_USER=root - export SERVICE_GROUP=root + SERVICE_UID=0 + SERVICE_GID=0 + SERVICE_USER=root + SERVICE_GROUP=root exitStatus=2 fi + export SERVICE_UID SERVICE_GID SERVICE_USER SERVICE_GROUP return $exitStatus } -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - __create_env_file() { local dir="" local envStatus=0 @@ -707,7 +713,7 @@ EOF rm -f "$sample_file" return $envStatus } -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - __exec_command() { local bin="" local arg=("$@") @@ -730,7 +736,7 @@ __exec_command() { fi return $exitCode } -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # Setup the server init scripts __start_init_scripts() { [ "$1" = " " ] && shift 1 @@ -741,6 +747,7 @@ __start_init_scripts() { local retstatus="0" local initStatus="0" local critical_failures="0" + local pidFile="/run/__start_init_scripts.pid" local init_dir="${1:-/usr/local/etc/docker/init.d}" local init_count="$(ls -A "$init_dir"/* 2>/dev/null | grep -v '\.sample' | wc -l)" local exit_on_failure="${EXIT_ON_SERVICE_FAILURE:-true}" @@ -751,7 +758,7 @@ __start_init_scripts() { rm -f /run/*.pid /run/init.d/*.pid 2>/dev/null || true fi - touch /run/__start_init_scripts.pid + touch "$pidFile" if [ "$init_count" -eq 0 ] || [ ! -d "$init_dir" ]; then mkdir -p "/data/logs/init" @@ -769,6 +776,7 @@ __start_init_scripts() { for init in "$init_dir"/*.sh; do if [ -x "$init" ]; then + touch "$pidFile" name="$(basename "$init")" service="$(printf '%s' "$name" | sed 's/^[^-]*-//;s|.sh$||g')" __service_banner "🔧" "Executing service script:" "$(basename "$init")" @@ -779,8 +787,13 @@ __start_init_scripts() { initStatus="0" __service_banner "🚫" "Service $service is disabled -" "skipping" unset SERVICE_DISABLED + # Continue to next service + elif [ "$CONTAINER_INIT" = "yes" ]; then + initStatus="0" + __service_banner "✅" "Service $service completed successfully -" "configuration service" else - sleep 2 + # Allow some time for service to initialize + sleep 1 # Check for service success indicators local expected_pid_file="/run/init.d/$service.pid" if [ "$SERVICE_USES_PID" = "no" ]; then @@ -795,9 +808,8 @@ __start_init_scripts() { fi else # Service uses PID tracking - verify actual running processes - set +e # Temporarily disable exit on error + set +e # Temporarily disable exit on error retPID="" - # First, try to find actual running process with various name patterns for name_variant in "$service" "${service}84" "${service}d" "$(echo "$service" | sed 's/-//g')" "$(echo "$service" | tr -d '-')"; do if [ -z "$retPID" ]; then @@ -805,9 +817,7 @@ __start_init_scripts() { [ -n "$retPID" ] && found_process="$name_variant" && break fi done - - set -e # Re-enable exit on error - + set -e # Re-enable exit on error if [ -n "$retPID" ] && [ "$retPID" != "0" ]; then # Found actual running process initStatus="0" @@ -859,7 +869,7 @@ __start_init_scripts() { printf '%s\n' "$SERVICE_NAME started on $(date)" >"/data/logs/start.log" return $retstatus } -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - __setup_mta() { [ -d "/etc/ssmtp" ] || [ -d "/etc/postfix" ] || return if [ ! -d "/config/ssmtp" ] || [ ! -d "/config/postfix" ]; then @@ -966,7 +976,7 @@ EOF [ -f "/root/dead.letter" ] && __rm "/root/dead.letter" return $exitCode } -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - __initialize_web_health() { local www_dir="${1:-${WWW_ROOT_DIR:-/usr/local/share/httpd/default}}" if [ -d "$www_dir" ]; then @@ -975,7 +985,7 @@ __initialize_web_health() { __find_replace "REPLACE_LAST_UPDATED_ON_MESSAGE" "${LAST_UPDATED_ON_MESSAGE:-$(date +'Last updated on: %Y-%m-%d at %H:%M:%S')}" "/usr/local/share/httpd" fi } -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # file_dir __initialize_replace_variables() { local set_dir="" get_dir="$*" @@ -1018,7 +1028,7 @@ __initialize_replace_variables() { mkdir -p "${TMP_DIR:-/tmp/$SERVICE_NAME}" "${RUN_DIR:-/run/$SERVICE_NAME}" "${LOG_DIR:-/data/logs/$SERVICE_NAME}" chmod -f 777 "${TMP_DIR:-/tmp/$SERVICE_NAME}" "${RUN_DIR:-/run/$SERVICE_NAME}" "${LOG_DIR:-/data/logs/$SERVICE_NAME}" } -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - __initialize_database() { [ "$IS_DATABASE_SERVICE" = "yes" ] || [ "$USES_DATABASE_SERVICE" = "yes" ] || return 0 local dir="${1:-$ETC_DIR}" @@ -1049,7 +1059,7 @@ __initialize_database() { __find_replace "REPLACE_DATABASE_DIR" "$DATABASE_DIR" "/etc" fi } -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - __initialize_db_users() { [ "$IS_DATABASE_SERVICE" = "yes" ] || [ "$USES_DATABASE_SERVICE" = "yes" ] || return 0 db_normal_user="${DATABASE_USER_NORMAL:-$user_name}" @@ -1062,7 +1072,7 @@ __initialize_db_users() { export DATABASE_PASS_ROOT="$db_admin_pass" export db_normal_user db_normal_pass db_admin_user db_admin_pass } -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - __initialize_system_etc() { local conf_dir="$1" local dir="" @@ -1089,7 +1099,7 @@ __initialize_system_etc() { done fi } -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - __initialize_custom_bin_dir() { local SET_USR_BIN="" [ -d "/data/bin" ] && SET_USR_BIN+="$(__find /data/bin f) " @@ -1107,7 +1117,7 @@ __initialize_custom_bin_dir() { unset create_bin_template create_bin_name SET_USR_BIN fi } -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - __initialize_default_templates() { if [ -n "$DEFAULT_TEMPLATE_DIR" ]; then if [ "$CONFIG_DIR_INITIALIZED" = "false" ] && [ -d "/config" ]; then @@ -1127,7 +1137,7 @@ __initialize_default_templates() { fi fi } -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - __initialize_config_dir() { if [ -n "$DEFAULT_CONF_DIR" ]; then if [ "$CONFIG_DIR_INITIALIZED" = "false" ] && [ -d "/config" ]; then @@ -1147,7 +1157,7 @@ __initialize_config_dir() { fi fi } -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - __initialize_data_dir() { if [ -d "/data" ]; then if [ "$DATA_DIR_INITIALIZED" = "false" ] && [ -n "$DEFAULT_DATA_DIR" ]; then @@ -1167,7 +1177,7 @@ __initialize_data_dir() { fi fi } -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - __initialize_www_root() { local WWW_INIT="" local WWW_TEMPLATE="" @@ -1180,7 +1190,7 @@ __initialize_www_root() { fi __initialize_web_health "$WWW_ROOT_DIR" } -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - __is_htdocs_mounted() { WWW_ROOT_DIR="${WWW_ROOT_DIR:-/data/htdocs}" [ -n "$ENV_WWW_ROOT_DIR" ] && WWW_ROOT_DIR="$ENV_WWW_ROOT_DIR" @@ -1207,7 +1217,7 @@ __is_htdocs_mounted() { [ -d "$WWW_ROOT_DIR" ] || mkdir -p "$WWW_ROOT_DIR" export WWW_ROOT_DIR="${WWW_ROOT_DIR:-/usr/local/share/httpd/default}" } -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - __initialize_ssl_certs() { [ "$SSL_ENABLED" = "yes" ] && __certbot if [ -d "/config/letsencrypt" ]; then @@ -1234,7 +1244,7 @@ __initialize_ssl_certs() { fi type update-ca-certificates &>/dev/null && update-ca-certificates &>/dev/null } -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - __start_php_dev_server() { if [ "$2" = "yes" ]; then if [ -d "/usr/local/share/httpd" ]; then @@ -1247,7 +1257,7 @@ __start_php_dev_server() { fi fi } -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - __check_service() { if [ "$1" = "check" ]; then shift $# @@ -1255,7 +1265,7 @@ __check_service() { exit $? fi } -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - __switch_to_user() { if [ "$RUNAS_USER" = "root" ]; then su_exec="" @@ -1278,7 +1288,7 @@ __switch_to_user() { fi export su_exec } -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # usage backup "days" "hours" __backup() { local dirs="" backup_dir backup_name backup_exclude runTime cronTime maxDays @@ -1316,7 +1326,7 @@ __backup() { [ -n "$cronTime" ] && runTime=$((cronTime * 3600)) || return $exitStatus sleep $runTime && __backup "$maxDays" "$cronTime" } -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # set variables from function calls export INIT_DATE="${INIT_DATE:-$(date)}" export START_SERVICES="${START_SERVICES:-yes}" @@ -1324,13 +1334,13 @@ export ENTRYPOINT_MESSAGE="${ENTRYPOINT_MESSAGE:-yes}" export ENTRYPOINT_FIRST_RUN="${ENTRYPOINT_FIRST_RUN:-yes}" export DATA_DIR_INITIALIZED="${DATA_DIR_INITIALIZED:-false}" export CONFIG_DIR_INITIALIZED="${CONFIG_DIR_INITIALIZED:-false}" -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # System export LANG="${LANG:-C.UTF-8}" export LC_ALL="${LANG:-C.UTF-8}" export TZ="${TZ:-${TIMEZONE:-America/New_York}}" export HOSTNAME="${FULL_DOMAIN_NAME:-${SERVER_HOSTNAME:-$HOSTNAME}}" -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # Default directories export SSL_DIR="${SSL_DIR:-/config/ssl}" export SSL_CA="${SSL_CERT:-/config/ssl/ca.crt}" @@ -1340,15 +1350,15 @@ export LOCAL_BIN_DIR="${LOCAL_BIN_DIR:-/usr/local/bin}" export DEFAULT_DATA_DIR="${DEFAULT_DATA_DIR:-/usr/local/share/template-files/data}" export DEFAULT_CONF_DIR="${DEFAULT_CONF_DIR:-/usr/local/share/template-files/config}" export DEFAULT_TEMPLATE_DIR="${DEFAULT_TEMPLATE_DIR:-/usr/local/share/template-files/defaults}" -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # Backup settings export BACKUP_MAX_DAYS="${BACKUP_MAX_DAYS:-}" export BACKUP_RUN_CRON="${BACKUP_RUN_CRON:-}" export BACKUP_DIR="${BACKUP_DIR:-/data/backups}" -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - CONTAINER_IP4_ADDRESS="${CONTAINER_IP4_ADDRESS:-$(__get_ip4)}" CONTAINER_IP6_ADDRESS="${CONTAINER_IP6_ADDRESS:-$(__get_ip6)}" -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # Additional export WORK_DIR="${ENV_WORK_DIR:-$WORK_DIR}" export SET_RANDOM_PASS="${SET_RANDOM_PASS:-$(__random_password 16)}" @@ -1366,15 +1376,15 @@ export ENTRYPOINT_PID_FILE="${ENTRYPOINT_PID_FILE:-/run/init.d/entrypoint.pid}" export ENTRYPOINT_INIT_FILE="${ENTRYPOINT_INIT_FILE:-/config/.entrypoint.done}" export ENTRYPOINT_DATA_INIT_FILE="${ENTRYPOINT_DATA_INIT_FILE:-/data/.docker_has_run}" export ENTRYPOINT_CONFIG_INIT_FILE="${ENTRYPOINT_CONFIG_INIT_FILE:-/config/.docker_has_run}" -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # is already Initialized [ -z "$DATA_DIR_INITIALIZED" ] && { [ -f "$ENTRYPOINT_DATA_INIT_FILE" ] && DATA_DIR_INITIALIZED="true" || DATA_DIR_INITIALIZED="false"; } [ -z "$CONFIG_DIR_INITIALIZED" ] && { [ -f "$ENTRYPOINT_CONFIG_INIT_FILE" ] && CONFIG_DIR_INITIALIZED="true" || CONFIG_DIR_INITIALIZED="false"; } [ -z "$ENTRYPOINT_FIRST_RUN" ] && { { [ -f "$ENTRYPOINT_PID_FILE" ] || [ -f "$ENTRYPOINT_INIT_FILE" ]; } && ENTRYPOINT_FIRST_RUN="no" || ENTRYPOINT_FIRST_RUN="true"; } export ENTRYPOINT_DATA_INIT_FILE DATA_DIR_INITIALIZED ENTRYPOINT_CONFIG_INIT_FILE CONFIG_DIR_INITIALIZED export ENTRYPOINT_PID_FILE ENTRYPOINT_INIT_FILE ENTRYPOINT_FIRST_RUN -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # export the functions export -f __get_pid __start_init_scripts __is_running __certbot __update_ssl_certs __create_ssl_cert -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # end of functions diff --git a/rootfs/usr/local/share/template-files/config/env/default.sample b/rootfs/usr/local/share/template-files/config/env/default.sample index e81257f..2d4a7ef 100644 --- a/rootfs/usr/local/share/template-files/config/env/default.sample +++ b/rootfs/usr/local/share/template-files/config/env/default.sample @@ -1,17 +1,17 @@ #!/usr/bin/env bash -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # Set bash options [ "$DEBUGGER" = "on" ] && echo "Enabling debugging" && set -o pipefail -x$DEBUGGER_OPTIONS || set -o pipefail -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # import the functions file [ -f "/usr/local/etc/docker/functions/entrypoint.sh" ] && . "/usr/local/etc/docker/functions/entrypoint.sh" -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # GLOBAL enviroment variables #USER="${USER:-root}" #LANG="${LANG:-C.UTF-8}" #TZ="${TZ:-America/New_York}" #SERVICE_USER="${SERVICE_USER:-root}" -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # directory settings #BACKUP_DIR="${BACKUP_DIR:-/data/backups}" #WWW_ROOT_DIR="${WWW_ROOT_DIR:-/usr/local/share/httpd/default}" @@ -21,39 +21,39 @@ #DEFAULT_CONF_DIR="${DEFAULT_CONF_DIR:-/usr/local/share/template-files/config}" #DEFAULT_TEMPLATE_DIR="${DEFAULT_TEMPLATE_DIR:-/usr/local/share/template-files/defaults}" #DBTYPE="sqlite" -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # healthcheck #HEALTH_ENABLED="${HEALTH_ENABLED:-$ENV_HEALTH_ENABLED}" #HEALTH_URL="${HEALTH_URL:-}" -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # php settings #PHP_VERSION="${PHP_VERSION//php/}" #PHP_INI_DIR="${PHP_INI_DIR:-$(__find_php_ini)}" #PHP_BIN_DIR="${PHP_BIN_DIR:-$(__find_php_bin)}" -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # services/ports #ENV_PORTS="${ENV_PORTS:-}" #SERVICE_PORT="${SERVICE_PORT:-$PORT}" #WEB_SERVER_PORTS="${WEB_SERVER_PORTS:-$ENV_WEB_SERVER_PORTS}" #SERVICES_LIST="${PROCS_LIST:-$SERVICES_LIST} " -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # networing info DOMAINNAME="${DOMAINNAME:-}" HOSTNAME="${HOSTNAME:-casjaysdev-GEN_SCRIPT_REPLACE_APPNAME}" FULL_DOMAIN_NAME="${FULL_DOMAIN_NAME:-${DOMAINNAME:-$HOSTNAME}}" SERVER_ADMIN="${SERVER_ADMIN:-root@${EMAIL_DOMAIN:-${DOMAINNAME:-$FULL_DOMAIN_NAME}}}" -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - EMAIL_RELAY="${EMAIL_RELAY:-}" -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # get ip addresses CONTAINER_IP4_ADDRESS="${CONTAINER_IP4_ADDRESS:-$(__get_ip4)}" CONTAINER_IP6_ADDRESS="${CONTAINER_IP6_ADDRESS:-$(__get_ip6)}" -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # cerbot #CERT_BOT_MAIL="${CERT_BOT_MAIL:-}" #CERTBOT_DOMAINS="${CERTBOT_DOMAINS:-}" #CERT_BOT_ENABLED="${CERT_BOT_ENABLED:-false}" -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # ssl server settings #SSL_ENABLED="${SSL_ENABLED:-false}" #SSL_DIR="${SSL_DIR:-/config/ssl}" @@ -69,22 +69,22 @@ CONTAINER_IP6_ADDRESS="${CONTAINER_IP6_ADDRESS:-$(__get_ip6)}" #DAYS_VALID="${DAYS_VALID:-3650}" #RSA="${RSA:-4096}" #CN="${CN:-$FULL_DOMAIN_NAME}" -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # web server configs HTTPD_CONFIG_FILE="${HTTPD_CONFIG_FILE:-$(__find_httpd_conf)}" NGINX_CONFIG_FILE="${NGINX_CONFIG_FILE:-$(__find_nginx_conf)}" LIGHTTPD_CONFIG_FILE="${LIGHTTPD_CONFIG_FILE:-$(__find_lighttpd_conf)}" -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # redis env DATABASE_DIR_REDIS="${DATABASE_DIR_REDIS:-$DATABASE_BASE_DIR/redis}" -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # postgresql env DATABASE_DIR_PGSQL="${DATABASE_DIR_PGSQL:-$PGDATA}" PGDATA="${DATABASE_DIR_PGSQL:-$DATABASE_BASE_DIR/postgres}" POSTGRES_USER="${DATABASE_USER_ROOT:-$POSTGRES_USER}" POSTGRES_PASSWORD="${DATABASE_PASS_ROOT:-$POSTGRES_PASSWORD}" POSTGRES_CONFIG_FILE="${POSTGRES_CONFIG_FILE:-$(__find_pgsql_conf)}" -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # mariadb env MARIADB_ROOT_HOST="${MARIADB_ROOT_HOST:-%}" MARIADB_AUTO_UPGRADE="${MARIADB_AUTO_UPGRADE:-yes}" @@ -97,30 +97,30 @@ MARIADB_ALLOW_EMPTY_ROOT_PASSWORD="${MARIADB_ALLOW_EMPTY_ROOT_PASSWORD:-}" MARIADB_INITDB_SKIP_TZINFO="${MARIADB_INITDB_SKIP_TZINFO}:-" MARIADB_RANDOM_ROOT_PASSWORD="${MARIADB_RANDOM_ROOT_PASSWORD:-}" MARIADB_CONFIG_FILE="${MARIADB_CONFIG_FILE:-$(__find_mysql_conf)}" -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # mongodb env INITDB_ROOT_USERNAME="${DATABASE_USER_ROOT:-$INITDB_ROOT_USERNAME}" DATABASE_DIR_MONGODB="${DATABASE_DIR_MONGODB:-$DATABASE_BASE_DIR/mongodb}" MONGO_INITDB_ROOT_PASSWORD="${DATABASE_PASS_ROOT:-$MONGO_INITDB_ROOT_PASSWORD}" -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # couchdb env NODENAME="${NODENAME:-}" COUCHDB_USER="${DATABASE_USER_ROOT:-$COUCHDB_USER}" COUCHDB_PASSWORD="${DATABASE_PASS_ROOT:-$COUCHDB_PASSWORD}" DATABASE_DIR_COUCHDB="${DATABASE_DIR_COUCHDB:-$DATABASE_BASE_DIR/couchdb}" -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # Supabase DATABASE_DIR_SUPABASE="${DATABASE_DIR_SUPABASE:-$DATABASE_BASE_DIR/supabase}" -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # docker env -DOCKER_HOST="unix:///run/docker.sock" -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +DOCKER_HOST="unix://var/run/docker.sock" +# - - - - - - - - - - - - - - - - - - - - - - - - - # File locations ENTRYPOINT_PID_FILE="${ENTRYPOINT_PID_FILE:-/run/init.d/entrypoint.pid}" ENTRYPOINT_INIT_FILE="${ENTRYPOINT_INIT_FILE:-/config/.entrypoint.done}" ENTRYPOINT_DATA_INIT_FILE="${ENTRYPOINT_DATA_INIT_FILE:-/data/.docker_has_run}" ENTRYPOINT_CONFIG_INIT_FILE="${ENTRYPOINT_CONFIG_INIT_FILE:-/config/.docker_has_run}" -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # Startup variables INIT_DATE="${INIT_DATE:-$(date)}" START_SERVICES="${START_SERVICES:-yes}" @@ -128,8 +128,8 @@ ENTRYPOINT_MESSAGE="${ENTRYPOINT_MESSAGE:-yes}" ENTRYPOINT_FIRST_RUN="${ENTRYPOINT_FIRST_RUN:-yes}" DATA_DIR_INITIALIZED="${DATA_DIR_INITIALIZED:-false}" CONFIG_DIR_INITIALIZED="${CONFIG_DIR_INITIALIZED:-false}" -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - if [ -f "$ENTRYPOINT_PID_FILE" ] || [ -f "$ENTRYPOINT_INIT_FILE" ]; then START_SERVICES="no" ENTRYPOINT_MESSAGE="no" ENTRYPOINT_FIRST_RUN="no" fi -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/rootfs/usr/local/share/template-files/config/env/examples/00-directory.sh b/rootfs/usr/local/share/template-files/config/env/examples/00-directory.sh index b41c7b7..8253a15 100644 --- a/rootfs/usr/local/share/template-files/config/env/examples/00-directory.sh +++ b/rootfs/usr/local/share/template-files/config/env/examples/00-directory.sh @@ -1,4 +1,4 @@ -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # directory settings WWW_ROOT_DIR="${ENV_WWW_ROOT_DIR:-${WWW_ROOT_DIR}}" BACKUP_DIR="${ENV_BACKUP_DIR:-${BACKUP_DIR:-/data/backups}}" @@ -7,4 +7,4 @@ DATABASE_BASE_DIR="${ENV_DATABASE_BASE_DIR:-${DATABASE_BASE_DIR:-/data/db}}" DEFAULT_DATA_DIR="${ENV_DEFAULT_DATA_DIR:-${DEFAULT_DATA_DIR:-/usr/local/share/template-files/data}}" DEFAULT_CONF_DIR="${ENV_DEFAULT_CONF_DIR:-${DEFAULT_CONF_DIR:-/usr/local/share/template-files/config}}" DEFAULT_TEMPLATE_DIR="${ENV_DEFAULT_TEMPLATE_DIR:-${EDEFAULT_TEMPLATE_DIR:-/usr/local/share/template-files/defaults}}" -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/rootfs/usr/local/share/template-files/config/env/examples/addresses.sh b/rootfs/usr/local/share/template-files/config/env/examples/addresses.sh index 695428c..48a3941 100644 --- a/rootfs/usr/local/share/template-files/config/env/examples/addresses.sh +++ b/rootfs/usr/local/share/template-files/config/env/examples/addresses.sh @@ -1,5 +1,5 @@ -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # get ip addresses CONTAINER_IP4_ADDRESS="${CONTAINER_IP4_ADDRESS:-$(__get_ip4)}" CONTAINER_IP6_ADDRESS="${CONTAINER_IP6_ADDRESS:-$(__get_ip6)}" -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/rootfs/usr/local/share/template-files/config/env/examples/certbot.sh b/rootfs/usr/local/share/template-files/config/env/examples/certbot.sh index 9f52b28..44bb230 100644 --- a/rootfs/usr/local/share/template-files/config/env/examples/certbot.sh +++ b/rootfs/usr/local/share/template-files/config/env/examples/certbot.sh @@ -1,6 +1,6 @@ -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # cerbot CERT_BOT_MAIL="${ENV_CERT_BOT_MAIL:-$CERT_BOT_MAIL}" CERTBOT_DOMAINS="${ENV_CERTBOT_DOMAINS:-$CERTBOT_DOMAINS}" CERT_BOT_ENABLED="${ENV_CERT_BOT_ENABLED:-${CERT_BOT_ENABLED:-false}}" -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/rootfs/usr/local/share/template-files/config/env/examples/couchdb.sh b/rootfs/usr/local/share/template-files/config/env/examples/couchdb.sh index 4a7fb91..a9bee9d 100644 --- a/rootfs/usr/local/share/template-files/config/env/examples/couchdb.sh +++ b/rootfs/usr/local/share/template-files/config/env/examples/couchdb.sh @@ -1,7 +1,7 @@ -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # couchdb env COUCHDB_NODENAME="${ENV_COUCHDB_NODENAME:-${COUCHDB_NODENAME:-$NODENAME}}" COUCHDB_USER="${ENV_COUCHDB_USER:-${COUCHDB_USER:-$DATABASE_USER_ROOT}}" COUCHDB_PASSWORD="${ENV_COUCHDB_PASSWORD:-${COUCHDB_PASSWORD:-$DATABASE_PASS_ROOT}}" DATABASE_DIR_COUCHDB="${ENV_DATABASE_DIR_COUCHDB:-${DATABASE_DIR_COUCHDB:-/data/db/couchdb}}" -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/rootfs/usr/local/share/template-files/config/env/examples/dockerd.sh b/rootfs/usr/local/share/template-files/config/env/examples/dockerd.sh index a93d690..a0c68a2 100644 --- a/rootfs/usr/local/share/template-files/config/env/examples/dockerd.sh +++ b/rootfs/usr/local/share/template-files/config/env/examples/dockerd.sh @@ -1,4 +1,4 @@ -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # docker env DOCKER_HOST="${DOCKER_HOST:-unix://var/run/docker.sock}" -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/rootfs/usr/local/share/template-files/config/env/examples/global.sh b/rootfs/usr/local/share/template-files/config/env/examples/global.sh index fece9c8..9e9d446 100644 --- a/rootfs/usr/local/share/template-files/config/env/examples/global.sh +++ b/rootfs/usr/local/share/template-files/config/env/examples/global.sh @@ -1,13 +1,13 @@ -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # GLOBAL enviroment variables USER="${USER:-root}" LANG="${LANG:-C.UTF-8}" TZ="${TZ:-America/New_York}" ENV_PORTS="${ENV_PORTS//\/*/}" -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # How to set permissions SERVICE_USER="${SERVICE_USER:-}" SERVICE_GROUP="${SERVICE_GROUP:-}" -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - SERVICE_UID="${SERVICE_UID:-}" # set the user id SERVICE_GID="${SERVICE_GID:-}" # set the group id diff --git a/rootfs/usr/local/share/template-files/config/env/examples/healthcheck.sh b/rootfs/usr/local/share/template-files/config/env/examples/healthcheck.sh index 0dd7d39..11141b9 100644 --- a/rootfs/usr/local/share/template-files/config/env/examples/healthcheck.sh +++ b/rootfs/usr/local/share/template-files/config/env/examples/healthcheck.sh @@ -1,5 +1,5 @@ -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # healthcheck HEALTH_ENABLED="${HEALTH_ENABLED:-}" HEALTH_URL="${HEALTH_URL:-}" -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/rootfs/usr/local/share/template-files/config/env/examples/mariadb.sh b/rootfs/usr/local/share/template-files/config/env/examples/mariadb.sh index 223fce3..34afe76 100644 --- a/rootfs/usr/local/share/template-files/config/env/examples/mariadb.sh +++ b/rootfs/usr/local/share/template-files/config/env/examples/mariadb.sh @@ -1,4 +1,4 @@ -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # mariadb env MARIADB_ROOT_HOST="${MARIADB_ROOT_HOST:-%}" MARIADB_AUTO_UPGRADE="${MARIADB_AUTO_UPGRADE:-yes}" @@ -11,4 +11,4 @@ MARIADB_ALLOW_EMPTY_ROOT_PASSWORD="${MARIADB_ALLOW_EMPTY_ROOT_PASSWORD:-}" MARIADB_INITDB_SKIP_TZINFO="${MARIADB_INITDB_SKIP_TZINFO}:-" MARIADB_RANDOM_ROOT_PASSWORD="${MARIADB_RANDOM_ROOT_PASSWORD:-}" MARIADB_CONFIG_FILE="${MARIADB_CONFIG_FILE:-$(__find_mysql_conf)}" -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/rootfs/usr/local/share/template-files/config/env/examples/mongodb.sh b/rootfs/usr/local/share/template-files/config/env/examples/mongodb.sh index 8e014de..1f90f96 100644 --- a/rootfs/usr/local/share/template-files/config/env/examples/mongodb.sh +++ b/rootfs/usr/local/share/template-files/config/env/examples/mongodb.sh @@ -1,4 +1,4 @@ -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # mongodb env DATABASE_DIR_MONGODB="${DATABASE_DIR_MONGODB:-/data/db/mongodb}" INITDB_ROOT_USERNAME="${DATABASE_USER_ROOT:-$INITDB_ROOT_USERNAME}" @@ -17,4 +17,4 @@ ME_CONFIG_MONGODB_AUTH_PASSWORD_FILE="${ME_CONFIG_MONGODB_AUTH_PASSWORD_FILE:-}" ME_CONFIG_MONGODB_CA_FILE="${ME_CONFIG_MONGODB_CA_FILE:-}" VCAP_APP_HOST="${VCAP_APP_HOST:-0.0.0.0}" VCAP_APP_PORT="${VCAP_APP_PORT:-19054}" -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/rootfs/usr/local/share/template-files/config/env/examples/networking.sh b/rootfs/usr/local/share/template-files/config/env/examples/networking.sh index 3af24bb..0f0d464 100644 --- a/rootfs/usr/local/share/template-files/config/env/examples/networking.sh +++ b/rootfs/usr/local/share/template-files/config/env/examples/networking.sh @@ -1,4 +1,4 @@ -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # networing info DOMAINNAME="${DOMAINNAME:-}" EMAIL_RELAY="${EMAIL_RELAY:-}" @@ -6,4 +6,4 @@ HOSTNAME="${HOSTNAME:-casjaysdev-GEN_SCRIPT_REPLACE_APPNAME}" EMAIL_DOMAIN="${EMAIL_DOMAIN:-${DOMAINNAME:-$HOSTNAME}}" FULL_DOMAIN_NAME="${FULL_DOMAIN_NAME:-${DOMAINNAME:-$HOSTNAME}}" SERVER_ADMIN="${SERVER_ADMIN:-root@${EMAIL_DOMAIN:-$FULL_DOMAIN_NAME}}" -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/rootfs/usr/local/share/template-files/config/env/examples/other.sh b/rootfs/usr/local/share/template-files/config/env/examples/other.sh index 1a59689..d75cc03 100644 --- a/rootfs/usr/local/share/template-files/config/env/examples/other.sh +++ b/rootfs/usr/local/share/template-files/config/env/examples/other.sh @@ -1,4 +1,4 @@ -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # other -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/rootfs/usr/local/share/template-files/config/env/examples/php.sh b/rootfs/usr/local/share/template-files/config/env/examples/php.sh index a005543..d9bbad1 100644 --- a/rootfs/usr/local/share/template-files/config/env/examples/php.sh +++ b/rootfs/usr/local/share/template-files/config/env/examples/php.sh @@ -1,6 +1,6 @@ -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # php settings PHP_VERSION="${PHP_VERSION//php/}" PHP_INI_DIR="${PHP_INI_DIR:-$(__find_php_ini)}" PHP_BIN_DIR="${PHP_BIN_DIR:-$(__find_php_bin)}" -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/rootfs/usr/local/share/template-files/config/env/examples/postgres.sh b/rootfs/usr/local/share/template-files/config/env/examples/postgres.sh index 348b4bf..7fb8536 100644 --- a/rootfs/usr/local/share/template-files/config/env/examples/postgres.sh +++ b/rootfs/usr/local/share/template-files/config/env/examples/postgres.sh @@ -1,8 +1,8 @@ -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # postgresql env PGDATA="${DATABASE_DIR_PGSQL:-$PGDATA}" DATABASE_DIR_PGSQL="${DATABASE_DIR_PGSQL:-/data/db/postgres}" POSTGRES_USER="${DATABASE_USER_ROOT:-$POSTGRES_USER}" POSTGRES_PASSWORD="${DATABASE_PASS_ROOT:-$POSTGRES_PASSWORD}" POSTGRES_CONFIG_FILE="${POSTGRES_CONFIG_FILE:-$(__find_pgsql_conf)}" -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/rootfs/usr/local/share/template-files/config/env/examples/redis.sh b/rootfs/usr/local/share/template-files/config/env/examples/redis.sh index 805a14d..623e0ba 100644 --- a/rootfs/usr/local/share/template-files/config/env/examples/redis.sh +++ b/rootfs/usr/local/share/template-files/config/env/examples/redis.sh @@ -1,4 +1,4 @@ -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # redis env DATABASE_DIR_REDIS="${DATABASE_DIR_REDIS:-/data/db/redis}" -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/rootfs/usr/local/share/template-files/config/env/examples/services.sh b/rootfs/usr/local/share/template-files/config/env/examples/services.sh index e330031..c3a9333 100644 --- a/rootfs/usr/local/share/template-files/config/env/examples/services.sh +++ b/rootfs/usr/local/share/template-files/config/env/examples/services.sh @@ -1,7 +1,7 @@ -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # services/ports ENV_PORTS="${ENV_PORTS:-}" SERVICE_PORT="${SERVICE_PORT:-$PORT}" WEB_SERVER_PORTS="${WEB_SERVER_PORTS:-}" SERVICES_LIST="${PROCS_LIST:-$SERVICES_LIST} " -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/rootfs/usr/local/share/template-files/config/env/examples/ssl.sh b/rootfs/usr/local/share/template-files/config/env/examples/ssl.sh index 78b1686..b1e8876 100644 --- a/rootfs/usr/local/share/template-files/config/env/examples/ssl.sh +++ b/rootfs/usr/local/share/template-files/config/env/examples/ssl.sh @@ -1,4 +1,4 @@ -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # ssl server settings SSL_ENABLED="${SSL_ENABLED:-false}" SSL_DIR="${SSL_CONTAINER_DIR:-/config/ssl}" @@ -6,7 +6,7 @@ SSL_DIR="${SSL_DIR:-$SSL_DIR}" SSL_CA="${SSL_CA:-$SSL_DIR/ca.crt}" SSL_KEY="${SSL_KEY:-$SSL_DIR/server.key}" SSL_CERT="${SSL_CERT:-$SSL_DIR/server.crt}" -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # certificate settings RSA="${RSA:-4096}" STATE="${STATE:-NY}" @@ -16,4 +16,4 @@ UNIT="${UNIT:-CasjaysDev}" ORG="${ORG:-"Casjays Developments"}" DAYS_VALID="${DAYS_VALID:-3650}" CN="${CN:-${FULL_DOMAIN_NAME:-$HOSTNAME}}" -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/rootfs/usr/local/share/template-files/config/env/examples/supabase.sh b/rootfs/usr/local/share/template-files/config/env/examples/supabase.sh index f25a9ca..49bae3a 100644 --- a/rootfs/usr/local/share/template-files/config/env/examples/supabase.sh +++ b/rootfs/usr/local/share/template-files/config/env/examples/supabase.sh @@ -1,4 +1,4 @@ -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # Supabase DATABASE_DIR_SUPABASE="${DATABASE_DIR_SUPABASE:-/data/db/supabase}" -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/rootfs/usr/local/share/template-files/config/env/examples/webservers.sh b/rootfs/usr/local/share/template-files/config/env/examples/webservers.sh index 15ba1af..554e47a 100644 --- a/rootfs/usr/local/share/template-files/config/env/examples/webservers.sh +++ b/rootfs/usr/local/share/template-files/config/env/examples/webservers.sh @@ -1,8 +1,8 @@ -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # web server configs HTTPD_CONFIG_FILE="${HTTPD_CONFIG_FILE:-$(__find_httpd_conf)}" NGINX_CONFIG_FILE="${NGINX_CONFIG_FILE:-$(__find_nginx_conf)}" CADDY_CONFIG_FILE="${CHEROKEE_CONFIG_FILE:-$(__find_caddy_conf)}" LIGHTTPD_CONFIG_FILE="${LIGHTTPD_CONFIG_FILE:-$(__find_lighttpd_conf)}" CHEROKEE_CONFIG_FILE="${CHEROKEE_CONFIG_FILE:-$(__find_cherokee_conf)}" -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/rootfs/usr/local/share/template-files/config/env/examples/zz-entrypoint.sh b/rootfs/usr/local/share/template-files/config/env/examples/zz-entrypoint.sh index cc9505b..8cc487b 100644 --- a/rootfs/usr/local/share/template-files/config/env/examples/zz-entrypoint.sh +++ b/rootfs/usr/local/share/template-files/config/env/examples/zz-entrypoint.sh @@ -1,10 +1,10 @@ -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # File locations ENTRYPOINT_PID_FILE="${ENTRYPOINT_PID_FILE:-/run/init.d/entrypoint.pid}" ENTRYPOINT_INIT_FILE="${ENTRYPOINT_INIT_FILE:-/config/.entrypoint.done}" ENTRYPOINT_DATA_INIT_FILE="${ENTRYPOINT_DATA_INIT_FILE:-/data/.docker_has_run}" ENTRYPOINT_CONFIG_INIT_FILE="${ENTRYPOINT_CONFIG_INIT_FILE:-/config/.docker_has_run}" -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # Startup variables INIT_DATE="${INIT_DATE:-$(date)}" START_SERVICES="${START_SERVICES:-yes}" @@ -12,10 +12,10 @@ ENTRYPOINT_MESSAGE="${ENTRYPOINT_MESSAGE:-yes}" ENTRYPOINT_FIRST_RUN="${ENTRYPOINT_FIRST_RUN:-yes}" DATA_DIR_INITIALIZED="${DATA_DIR_INITIALIZED:-false}" CONFIG_DIR_INITIALIZED="${CONFIG_DIR_INITIALIZED:-false}" -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - - # Check if this is a new container [ -f "$ENTRYPOINT_PID_FILE" ] && START_SERVICES="no" [ -f "$ENTRYPOINT_CONFIG_INIT_FILE" ] && ENTRYPOINT_FIRST_RUN="no" [ -f "$ENTRYPOINT_DATA_INIT_FILE" ] && DATA_DIR_INITIALIZED="true" [ -f "$ENTRYPOINT_CONFIG_INIT_FILE" ] && CONFIG_DIR_INITIALIZED="true" -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# - - - - - - - - - - - - - - - - - - - - - - - - -