🗃️ Committing everything that changed 🗃️

.gitignore
rootfs/usr/local/bin/entrypoint.sh
rootfs/usr/local/etc/docker/functions/entrypoint.sh
This commit is contained in:
casjay 2023-09-03 13:36:17 -04:00
parent 7449639aa0
commit 7e9f9b4c3c
Signed by untrusted user who does not match committer: jason
GPG Key ID: 1AB309F42A764145
3 changed files with 69 additions and 34 deletions

2
.gitignore vendored
View File

@ -1,4 +1,4 @@
# gitignore created on 09/01/23 at 11:01 # gitignore created on 09/03/23 at 12:44
# Disable reminder in prompt # Disable reminder in prompt
ignoredirmessage ignoredirmessage

View File

@ -1,13 +1,13 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# shellcheck shell=bash # shellcheck shell=bash
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
##@Version : 202309011101-git ##@Version : 202309031244-git
# @@Author : Jason Hempstead # @@Author : Jason Hempstead
# @@Contact : jason@casjaysdev.pro # @@Contact : jason@casjaysdev.pro
# @@License : WTFPL # @@License : WTFPL
# @@ReadME : docker-entrypoint --help # @@ReadME : docker-entrypoint --help
# @@Copyright : Copyright: (c) 2023 Jason Hempstead, Casjays Developments # @@Copyright : Copyright: (c) 2023 Jason Hempstead, Casjays Developments
# @@Created : Friday, Sep 01, 2023 11:01 EDT # @@Created : Sunday, Sep 03, 2023 12:44 EDT
# @@File : docker-entrypoint # @@File : docker-entrypoint
# @@Description : # @@Description :
# @@Changelog : New script # @@Changelog : New script
@ -82,18 +82,6 @@ HEALTH_ENDPOINTS="" # url endpoints: [http://localhost/health,http://localhost/
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Overwrite variables # Overwrite variables
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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 BACKUP_DIR="${BACKUP_DIR:-/data/backups}"
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}"
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
__run_message() { __run_message() {
@ -102,14 +90,47 @@ __run_message() {
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
################## END OF CONFIGURATION ##################### ################## END OF CONFIGURATION #####################
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Startup variables
export INIT_DATE="${INIT_DATE:-$(date)}"
export START_SERVICES="${START_SERVICES:-yes}"
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}"
export SSL_KEY="${SSL_KEY:-/config/ssl/localhost.pem}"
export SSL_CERT="${SSL_CERT:-/config/ssl/localhost.crt}"
export BACKUP_DIR="${BACKUP_DIR:-/data/backups}"
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}"
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Additional # Additional
PHP_INI_DIR="${PHP_INI_DIR:-$(__find_php_ini)}" export PHP_INI_DIR="${PHP_INI_DIR:-$(__find_php_ini)}"
PHP_BIN_DIR="${PHP_BIN_DIR:-$(__find_php_bin)}" export PHP_BIN_DIR="${PHP_BIN_DIR:-$(__find_php_bin)}"
HTTPD_CONFIG_FILE="${HTTPD_CONFIG_FILE:-$(__find_httpd_conf)}" export HTTPD_CONFIG_FILE="${HTTPD_CONFIG_FILE:-$(__find_httpd_conf)}"
NGINX_CONFIG_FILE="${NGINX_CONFIG_FILE:-$(__find_nginx_conf)}" export NGINX_CONFIG_FILE="${NGINX_CONFIG_FILE:-$(__find_nginx_conf)}"
MYSQL_CONFIG_FILE="${MYSQL_CONFIG_FILE:-$(__find_mysql_conf)}" export MYSQL_CONFIG_FILE="${MYSQL_CONFIG_FILE:-$(__find_mysql_conf)}"
PGSQL_CONFIG_FILE="${PGSQL_CONFIG_FILE:-$(__find_pgsql_conf)}" export PGSQL_CONFIG_FILE="${PGSQL_CONFIG_FILE:-$(__find_pgsql_conf)}"
MONGODB_CONFIG_FILE="${MONGODB_CONFIG_FILE:-$(__find_mongodb_conf)}" export MONGODB_CONFIG_FILE="${MONGODB_CONFIG_FILE:-$(__find_mongodb_conf)}"
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}"
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
if [ -f "$ENTRYPOINT_PID_FILE" ] || [ -f "$ENTRYPOINT_INIT_FILE" ]; then
START_SERVICES="no" ENTRYPOINT_MESSAGE="no" ENTRYPOINT_FIRST_RUN="no"
fi
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# variables based on env/files # variables based on env/files
[ "$WEB_SERVER_PORT" = "443" ] && SSL_ENABLED="true" [ "$WEB_SERVER_PORT" = "443" ] && SSL_ENABLED="true"

View File

@ -1,13 +1,13 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# shellcheck shell=bash # shellcheck shell=bash
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
##@Version : 202308281453-git ##@Version : 202309030111-git
# @@Author : Jason Hempstead # @@Author : Jason Hempstead
# @@Contact : git-admin@casjaysdev.pro # @@Contact : git-admin@casjaysdev.pro
# @@License : WTFPL # @@License : LICENSE.md
# @@ReadME : docker-entrypoint --help # @@ReadME : docker-entrypoint --help
# @@Copyright : Copyright: (c) 2023 Jason Hempstead, Casjays Developments # @@Copyright : Copyright: (c) 2023 Jason Hempstead, Casjays Developments
# @@Created : Monday, Aug 28, 2023 14:53 EDT # @@Created : Sunday, Sep 03, 2023 01:40 EDT
# @@File : docker-entrypoint # @@File : docker-entrypoint
# @@Description : functions for my docker containers # @@Description : functions for my docker containers
# @@Changelog : newScript # @@Changelog : newScript
@ -575,7 +575,7 @@ __initialize_web_health() {
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# file_dir # file_dir
__initialize_replace_variables() { __initialize_replace_variables() {
[ $# -ne 0 ] || return 1 # REPLACE_GITEA_PROTO [ $# -ne 0 ] || return 1
__find_replace "REPLACE_SSL_DIR" "${SSL_DIR:-/etc/ssl}" "$1" __find_replace "REPLACE_SSL_DIR" "${SSL_DIR:-/etc/ssl}" "$1"
__find_replace "REPLACE_RANDOM_ID" "$(__random_password 8)" "$1" __find_replace "REPLACE_RANDOM_ID" "$(__random_password 8)" "$1"
__find_replace "REPLACE_TZ" "${TZ:-${TIMEZONE:-America/New_York}}" "$1" __find_replace "REPLACE_TZ" "${TZ:-${TIMEZONE:-America/New_York}}" "$1"
@ -602,18 +602,32 @@ __initialize_replace_variables() {
} }
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
__initialize_database() { __initialize_database() {
[ -n "$user_name" ] && __replace "REPLACE_USER_NAME" "$user_name" "$1" [ "$IS_DATABASE_SERVICE" = "yes" ] || return 0
[ -n "$user_pass" ] && __replace "REPLACE_USER_PASS" "$user_pass" "$1" local db_normal_user="${DATABASE_USER_NORMAL:-$user_name}"
[ -n "$user_name" ] && __replace "REPLACE_DATABASE_USER" "$user_name" "$1" local db_normal_pass="${DATABASE_PASS_NORMAL:-$user_pass}"
[ -n "$user_pass" ] && __replace "REPLACE_DATABASE_PASS" "$user_pass" "$1" local db_admin_user="${DATABASE_USER_ROOT:-$root_user_name}"
[ -n "$root_user_name" ] && __replace "REPLACE_ROOT_ADMIN" "$root_user_name" "$1" local db_admin_pass="${DATABASE_PASS_ROOT:-$root_user_pass}"
[ -n "$root_user_pass" ] && __replace "REPLACE_ROOT_PASS" "$root_user_pass" "$1" [ -n "$db_normal_user" ] && __replace "REPLACE_USER_NAME" "$db_normal_user" "$1"
[ -n "$root_user_name" ] && __replace "REPLACE_DATABASE_ROOT_USER" "$root_user_name" "$1" [ -n "$db_normal_pass" ] && __replace "REPLACE_USER_PASS" "$db_normal_pass" "$1"
[ -n "$root_user_pass" ] && __replace "REPLACE_DATABASE_ROOT_PASS" "$root_user_pass" "$1" [ -n "$db_normal_user" ] && __replace "REPLACE_DATABASE_USER" "$db_normal_user" "$1"
[ -n "$db_normal_pass" ] && __replace "REPLACE_DATABASE_PASS" "$db_normal_pass" "$1"
[ -n "$db_admin_user" ] && __replace "REPLACE_ROOT_ADMIN" "$db_admin_user" "$1"
[ -n "$db_admin_pass" ] && __replace "REPLACE_ROOT_PASS" "$db_admin_pass" "$1"
[ -n "$db_admin_user" ] && __replace "REPLACE_DATABASE_ROOT_USER" "$db_admin_user" "$1"
[ -n "$db_admin_pass" ] && __replace "REPLACE_DATABASE_ROOT_PASS" "$db_admin_pass" "$1"
[ -n "$DATABASE_NAME" ] && __replace "REPLACE_DATABASE_NAME" "$DATABASE_NAME" "$1" [ -n "$DATABASE_NAME" ] && __replace "REPLACE_DATABASE_NAME" "$DATABASE_NAME" "$1"
[ -n "$DATABASE_DIR" ] && __replace "REPLACE_DATABASE_DIR" "$DATABASE_DIR" "$1" [ -n "$DATABASE_DIR" ] && __replace "REPLACE_DATABASE_DIR" "$DATABASE_DIR" "$1"
} }
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
__initialize_db_users() {
[ "$IS_DATABASE_SERVICE" = "yes" ] || return 0
db_normal_user="${DATABASE_USER_NORMAL:-$user_name}"
db_normal_pass="${DATABASE_PASS_NORMAL:-$user_pass}"
db_admin_user="${DATABASE_USER_ROOT:-$root_user_name}"
db_admin_pass="${DATABASE_PASS_ROOT:-$root_user_pass}"
export user_name="$db_normal_user" user_pass="$db_normal_pass" root_user_name="$db_admin_user" root_user_pass="$db_admin_pass"
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
__initialize_system_etc() { __initialize_system_etc() {
local conf_dir="$1" local conf_dir="$1"
local file="" directories="" local file="" directories=""