diff options
author | Christophe Romain <christophe.romain@process-one.net> | 2018-01-11 10:19:56 +0100 |
---|---|---|
committer | Christophe Romain <christophe.romain@process-one.net> | 2018-01-11 10:19:56 +0100 |
commit | d6e1bc242c11b74f1aedde1398322253a753225d (patch) | |
tree | f18b670be077d1669ab2383da1e2d2e524771b74 /docker/scripts | |
parent | Prepare mix for 18.01 (diff) |
Remove old docker specs
Diffstat (limited to 'docker/scripts')
-rw-r--r-- | docker/scripts/lib/base_config.sh | 53 | ||||
-rw-r--r-- | docker/scripts/lib/base_functions.sh | 66 | ||||
-rw-r--r-- | docker/scripts/lib/config.sh | 1 | ||||
-rw-r--r-- | docker/scripts/lib/functions.sh | 1 | ||||
-rwxr-xr-x | docker/scripts/post/10_ejabberd_modules_update_specs.sh | 24 | ||||
-rwxr-xr-x | docker/scripts/post/11_ejabberd_install_modules.sh | 143 | ||||
-rwxr-xr-x | docker/scripts/post/20_ejabberd_register_users.sh | 118 | ||||
-rwxr-xr-x | docker/scripts/post/99_first_start_done.sh | 14 | ||||
-rwxr-xr-x | docker/scripts/pre/00_change_user.sh | 23 | ||||
-rwxr-xr-x | docker/scripts/pre/01_write_certifiates_from_env.sh | 33 | ||||
-rwxr-xr-x | docker/scripts/pre/02_make_snakeoil_certificates.sh | 91 | ||||
-rwxr-xr-x | docker/scripts/pre/03_make_dhparam.sh | 28 | ||||
-rwxr-xr-x | docker/scripts/pre/10_erlang_cookie.sh | 25 | ||||
-rwxr-xr-x | docker/scripts/pre/20_ejabberd_config.sh | 38 | ||||
-rwxr-xr-x | docker/scripts/stop/10_leave_cluster.sh | 21 |
15 files changed, 0 insertions, 679 deletions
diff --git a/docker/scripts/lib/base_config.sh b/docker/scripts/lib/base_config.sh deleted file mode 100644 index 9f66a4ae5..000000000 --- a/docker/scripts/lib/base_config.sh +++ /dev/null @@ -1,53 +0,0 @@ -readonly HOSTIP=$(hostname -i) -readonly HOSTNAME=$(hostname -f) -readonly DOMAINNAME=$(hostname -d) - -readonly ERLANGCOOKIEFILE="${EJABBERD_HOME}/.erlang.cookie" -readonly EJABBERDCTL="/usr/local/sbin/ejabberdctl" -readonly CONFIGFILE="${EJABBERD_HOME}/conf/ejabberd.yml" -readonly CONFIGTEMPLATE="${EJABBERD_HOME}/conf/ejabberd.yml.tpl" -readonly CTLCONFIGFILE="${EJABBERD_HOME}/conf/ejabberdctl.cfg" -readonly CTLCONFIGTEMPLATE="${EJABBERD_HOME}/conf/ejabberdctl.cfg.tpl" -readonly SSLCERTDIR="${EJABBERD_HOME}/ssl" -readonly SSLCERTHOST="${SSLCERTDIR}/host.pem" -readonly SSLDHPARAM="${SSLCERTDIR}/dh.pem" -readonly LOGDIR="/usr/local/var/log/ejabberd" -readonly FIRST_START_DONE_FILE="/${EJABBERD_HOME}/first-start-done" -readonly CLUSTER_NODE_FILE="/${EJABBERD_HOME}/cluster-done" - -readonly PYTHON_JINJA2="import os; -import sys; -import jinja2; -sys.stdout.write( - jinja2.Template - (sys.stdin.read() - ).render(env=os.environ))" - -# backward compatibility environment variables -set +e - -[[ -n $EJABBERD_ADMIN ]] \ - && export EJABBERD_ADMINS=${EJABBERD_ADMIN} - -[[ -n $AUTH_METHOD ]] \ - && export EJABBERD_AUTH_METHOD=${AUTH_METHOD} - -[[ -n $SKIP_MODULES_UPDATE ]] \ - && export EJABBERD_SKIP_MODULES_UPDATE=${SKIP_MODULES_UPDATE} - -[[ -n $ERL_OPTIONS ]] \ - && export ERLANG_OPTIONS=${ERL_OPTIONS} - -[[ -n $SSLCERT_HOST ]] \ - && export EJABBERD_SSLCERT_HOST=${SSLCERT_HOST} - -[[ -n $SSLCERT_EXAMPLE_COM ]] \ - && export EJABBERD_SSLCERT_EXAMPLE_COM=${SSLCERT_EXAMPLE_COM} - -[[ -n $LOGLEVEL ]] \ - && export EJABBERD_LOGLEVEL=${LOGLEVEL} - -[[ -n $EJABBERD_WEB_ADMIN_SSL ]] \ - && export EJABBERD_HTTPS=${EJABBERD_WEB_ADMIN_SSL} - -set -e diff --git a/docker/scripts/lib/base_functions.sh b/docker/scripts/lib/base_functions.sh deleted file mode 100644 index daadd1f68..000000000 --- a/docker/scripts/lib/base_functions.sh +++ /dev/null @@ -1,66 +0,0 @@ -is_set() { - local var=$1 - - [[ -n $var ]] -} - - -is_zero() { - local var=$1 - - [[ -z $var ]] -} - - -file_exist() { - local file=$1 - - [[ -e $file ]] -} - - -is_true() { - local var=${1,,} - local choices=("yes" "1" "y" "true") - for ((i=0;i < ${#choices[@]};i++)) { - [[ "${choices[i]}" == $var ]] && return 0 - } - return 1 -} - - -# overwrite this function to get hostname from other sources -# like dns or etcd -get_nodename() { - echo ${HOSTNAME} -} - - -join_cluster() { - local cluster_node=$1 - - is_zero ${cluster_node} \ - && exit 0 - - echo "Join cluster..." - - local erlang_node_name=${ERLANG_NODE%@*} - local erlang_cluster_node="${erlang_node_name}@${cluster_node}" - - response=$(${EJABBERDCTL} ping ${erlang_cluster_node}) - while [ "$response" != "pong" ]; do - echo "Waiting for ${erlang_cluster_node}..." - sleep 2 - response=$(${EJABBERDCTL} ping ${erlang_cluster_node}) - done - - echo "Join cluster at ${erlang_cluster_node}... " - NO_WARNINGS=true ${EJABBERDCTL} join_cluster $erlang_cluster_node - - if [ $? -eq 0 ]; then - touch ${CLUSTER_NODE_FILE} - else - echo "cloud not join cluster" - exit 1 - fi -} diff --git a/docker/scripts/lib/config.sh b/docker/scripts/lib/config.sh deleted file mode 100644 index 6b9cbbb12..000000000 --- a/docker/scripts/lib/config.sh +++ /dev/null @@ -1 +0,0 @@ -# Overridable file diff --git a/docker/scripts/lib/functions.sh b/docker/scripts/lib/functions.sh deleted file mode 100644 index 6b9cbbb12..000000000 --- a/docker/scripts/lib/functions.sh +++ /dev/null @@ -1 +0,0 @@ -# Overridable file diff --git a/docker/scripts/post/10_ejabberd_modules_update_specs.sh b/docker/scripts/post/10_ejabberd_modules_update_specs.sh deleted file mode 100755 index 01f20001e..000000000 --- a/docker/scripts/post/10_ejabberd_modules_update_specs.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash -set -e - -# Updates the known modules as to be found in https://github.com/processone/ejabberd-contrib - -source "${EJABBERD_HOME}/scripts/lib/base_config.sh" -source "${EJABBERD_HOME}/scripts/lib/config.sh" -source "${EJABBERD_HOME}/scripts/lib/base_functions.sh" -source "${EJABBERD_HOME}/scripts/lib/functions.sh" - - -run_modules_update_specs() { - echo -n 'Updating module specs... ' - ${EJABBERDCTL} modules_update_specs -} - - -is_true ${EJABBERD_SKIP_MODULES_UPDATE} \ - && exit 0 - -run_modules_update_specs - - -exit 0 diff --git a/docker/scripts/post/11_ejabberd_install_modules.sh b/docker/scripts/post/11_ejabberd_install_modules.sh deleted file mode 100755 index 8089fe9f2..000000000 --- a/docker/scripts/post/11_ejabberd_install_modules.sh +++ /dev/null @@ -1,143 +0,0 @@ -#!/bin/bash -set -e - -# Installs modules as defined in environment variables - -source "${EJABBERD_HOME}/scripts/lib/base_config.sh" -source "${EJABBERD_HOME}/scripts/lib/config.sh" -source "${EJABBERD_HOME}/scripts/lib/base_functions.sh" -source "${EJABBERD_HOME}/scripts/lib/functions.sh" - -install_module_from_source() { - local module_name=$1 - local module_source_path=${EJABBERD_HOME}/module_source/${module_name} - local module_install_folder=${EJABBERD_HOME}/.ejabberd-modules/sources - - echo "Analyzing module ${module_name} for installation" - # Make sure that the module exists in the source folder before attempting a copy - - if [ ! -d ${module_source_path} ]; then - echo "Error: Module ${module_name} not found in ${EJABBERD_HOME}/module_source" - echo "Please use a shared volume to populate your module in ${EJABBERD_HOME}/module_source" - return 1; - fi - - # Check to see if the module is already installed - local install_count=$(${EJABBERDCTL} modules_installed | grep -ce "^${module_name}[[:space:]]") - if [ $install_count -gt 0 ]; then - echo "Error: Module already installed: ${module_name}" - return 1; - fi - - # Copy the module into the shared folder - echo "Copying module to ejabberd folder ${module_install_folder}" - mkdir -p ${module_install_folder} - cp -R ${module_source_path} ${module_install_folder} - - # Run the ejabberdctl module_check on the module - echo "Running module_check on ${module_name}" - ${EJABBERDCTL} module_check ${module_name} - if [ $? -ne 0 ]; then - echo "Module check failed for ${module_name}" - return 1; - fi - echo "Module check succeeded for ${module_name}" - - # Install the module - echo "Running module_install on ${module_name}" - ${EJABBERDCTL} module_install ${module_name} - if [ $? -ne 0 ]; then - echo "Module installation failed for ${module_name}" - return 1; - fi - echo "Module installation succeeded for ${module_name}" - - return 0; -} - -install_module_from_ejabberd_contrib() { - local module_name=$1 - - # Check to see if the module is already installed - local install_count=$(${EJABBERDCTL} modules_installed | grep -ce "^${module_name}[[:space:]]") - if [ $install_count -gt 0 ]; then - echo "Error: Module already installed: ejabberd_contrib ${module_name}" - return 1; - fi - - # Install the module - echo "Running module_install on ejabberd_contrib ${module_name}" - ${EJABBERDCTL} module_install ${module_name} - if [ $? -ne 0 ]; then - echo "Module installation failed for ejabberd_contrib ${module_name}" - return 1; - fi - echo "Module installation succeeded for ejabberd_contrib ${module_name}" - - return 0; -} - -enable_custom_auth_module_override() { - module_name=$1; - # When using custom authentication modules, the module name must be - # in the following pattern: ejabberd_auth_foo, where foo is the - # value you will use for your auth_method yml configuration. - required_prefix="ejabberd_auth_" - - if [[ "${module_name}" != "${required_prefix}"* ]]; then - echo "Error: module_name must begin with ${required_prefix}" - exit 1; - fi - - echo "Checking custom auth module: ${module_name}" - # Make sure the auth module is installed - local install_count=$(${EJABBERDCTL} modules_installed | grep -ce "^${module_name}[[:space:]]") - if [ $install_count -eq 0 ]; then - echo "Error: custom auth_module not installed: ${module_name}" - return 1; - fi - - custom_auth_method=${module_name#$required_prefix} - echo -e "\nauth_method: [${custom_auth_method}]" >> ${CONFIGFILE} - echo "Custom auth module ${module_name} configuration complete." -} - -file_exist ${FIRST_START_DONE_FILE} \ - && exit 0 - -is_restart_needed=0; - -if [ -n "${EJABBERD_SOURCE_MODULES}" ]; then - for module_name in ${EJABBERD_SOURCE_MODULES} ; do - install_module_from_source ${module_name} - done - is_restart_needed=1; -fi - -# Check the EJABBERD_CONTRIB_MODULES variable for any ejabberd_contrib modules -if [ -n "${EJABBERD_CONTRIB_MODULES}" ]; then - for module_name in ${EJABBERD_CONTRIB_MODULES} ; do - install_module_from_ejabberd_contrib ${module_name} - done - is_restart_needed=1; -fi - -# If a custom module was defined for handling auth, we need to override -# the pre-defined auth methods in the config. -if [ -n "${EJABBERD_CUSTOM_AUTH_MODULE_OVERRIDE}" ]; then - enable_custom_auth_module_override "${EJABBERD_CUSTOM_AUTH_MODULE_OVERRIDE}" - is_restart_needed=1; -fi - -# If any modules were installed, restart the server, if the option is enabled -if [ ${is_restart_needed} -eq 1 ]; then - if is_true ${EJABBERD_RESTART_AFTER_MODULE_INSTALL} ; then - echo "Restarting ejabberd after successful module installation(s)" - ${EJABBERDCTL} restart - child=$! - ${EJABBERDCTL} "started" - wait $child - fi -fi - -exit 0 diff --git a/docker/scripts/post/20_ejabberd_register_users.sh b/docker/scripts/post/20_ejabberd_register_users.sh deleted file mode 100755 index 0a9569559..000000000 --- a/docker/scripts/post/20_ejabberd_register_users.sh +++ /dev/null @@ -1,118 +0,0 @@ -#!/bin/bash - -source "${EJABBERD_HOME}/scripts/lib/base_config.sh" -source "${EJABBERD_HOME}/scripts/lib/config.sh" -source "${EJABBERD_HOME}/scripts/lib/base_functions.sh" -source "${EJABBERD_HOME}/scripts/lib/functions.sh" - -# Do not exit if users already registered -set +e - -randpw() { - < /dev/urandom tr -dc A-Z-a-z-0-9 | head -c ${1:-16}; - echo; -} - - -register_user() { - local user=$1 - local domain=$2 - local password=$3 - - ${EJABBERDCTL} register ${user} ${domain} ${password} - return $? -} - - -register_all_users() { - # register users from environment $EJABBERD_USERS with given - # password or random password written to stout. Use whitespace - # to seperate users. - # - # sample: - # - add a user with an given password: - # -e "EJABBERD_USERS=admin@example.com:adminSecret" - # - add a user with a random password: - # -e "EJABBERD_USERS=user@example.com" - # - set password for admin and use random for user1: - # -e "EJABBERD_USERS=admin@example.com:adminSecret user@example.com" - - for user in ${EJABBERD_USERS} ; do - local jid=${user%%:*} - local password=${user#*:} - - local username=${jid%%@*} - local domain=${jid#*@} - - [[ "${password}" == "${jid}" ]] \ - && password=$(randpw) - - register_user ${username} ${domain} ${password} - local retval=$? - - [[ ${retval} -eq 0 ]] \ - && echo "Password for user ${username}@${domain} is ${password}" - done -} - - -file_exist ${FIRST_START_DONE_FILE} \ - && exit 0 - - -file_exist ${CLUSTER_NODE_FILE} \ - && exit 0 - - -is_set ${EJABBERD_USERS} \ - && register_all_users - - -################################## -## Keep for backward compatibility - -register_all_ejabberd_admins() { - # add all admins from environment $EJABBERD_ADMINS with the passwords from - # environment $EJABBERD_ADMIN_PASS. - - local passwords - local IFS=' ' - read -a passwords <<< "${EJABBERD_ADMIN_PWD}" - - for admin in ${EJABBERD_ADMINS} ; do - local user=${admin%%@*} - local domain=${admin#*@} - local password=${passwords[0]} - passwords=("${passwords[@]:1}") - register_user ${user} ${domain} ${password} - done -} - - -register_all_ejabberd_admins_randpw() { - # add all admins from environment $EJABBERD_ADMINS with a random - # password and write the password to stdout. - - for admin in ${EJABBERD_ADMINS} ; do - local user=${admin%%@*} - local domain=${admin#*@} - local password=$(randpw) - - register_user ${user} ${domain} ${password} - local retval=$? - - [[ ${retval} -eq 0 ]] \ - && echo "Password for user ${user}@${domain} is ${password}" - done -} - - -is_set ${EJABBERD_ADMIN_PWD} \ - && register_all_ejabberd_admins - - -is_true ${EJABBERD_ADMIN_RANDPWD} \ - && register_all_ejabberd_admins_randpw - - -exit 0 diff --git a/docker/scripts/post/99_first_start_done.sh b/docker/scripts/post/99_first_start_done.sh deleted file mode 100755 index b64d94b07..000000000 --- a/docker/scripts/post/99_first_start_done.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash -set -e - -# Write a first-start-done file - -source "${EJABBERD_HOME}/scripts/lib/base_config.sh" -source "${EJABBERD_HOME}/scripts/lib/config.sh" -source "${EJABBERD_HOME}/scripts/lib/base_functions.sh" -source "${EJABBERD_HOME}/scripts/lib/functions.sh" - - -if [ ! -e "${FIRST_START_DONE_FILE}" ]; then - touch ${FIRST_START_DONE_FILE} -fi diff --git a/docker/scripts/pre/00_change_user.sh b/docker/scripts/pre/00_change_user.sh deleted file mode 100755 index 3edeafb34..000000000 --- a/docker/scripts/pre/00_change_user.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash -set -e - -source "${EJABBERD_HOME}/scripts/lib/base_config.sh" -source "${EJABBERD_HOME}/scripts/lib/config.sh" -source "${EJABBERD_HOME}/scripts/lib/base_functions.sh" -source "${EJABBERD_HOME}/scripts/lib/functions.sh" - - -readonly whoami=$(whoami) - - -change_ejabberd_run_user() { - echo "Change ejabberd install user to root..." - sed -i "s/INSTALLUSER=${EJABBERD_USER}/INSTALLUSER=${whoami}/" ${EJABBERDCTL} -} - - -[[ "${whoami}" == "root" ]] \ - && change_ejabberd_run_user - - -exit 0 diff --git a/docker/scripts/pre/01_write_certifiates_from_env.sh b/docker/scripts/pre/01_write_certifiates_from_env.sh deleted file mode 100755 index 509b27e20..000000000 --- a/docker/scripts/pre/01_write_certifiates_from_env.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash -set -e - -source "${EJABBERD_HOME}/scripts/lib/base_config.sh" -source "${EJABBERD_HOME}/scripts/lib/config.sh" -source "${EJABBERD_HOME}/scripts/lib/base_functions.sh" -source "${EJABBERD_HOME}/scripts/lib/functions.sh" - -# Instead of having to mount a direction, specify the ssl certs -# via environment variables: -# `EJABBERD_SSLCERT_HOST` and `EJABBERD_SSLCERT_{domain_name}`. -# For example: `EJABBERD_SSLCERT_EXAMPLE_COM`. - -write_file_from_env() { - echo "Writing $1 to $2" - mkdir -p "$(dirname $2)" - echo "${!1}" > $2 -} - -# Write the host certificate -is_set ${EJABBERD_SSLCERT_HOST} \ - && write_file_from_env "EJABBERD_SSLCERT_HOST" ${SSLCERTHOST} - -# Write the domain certificates for each XMPP_DOMAIN -for xmpp_domain in ${XMPP_DOMAIN} ; do - var="EJABBERD_SSLCERT_$(echo $xmpp_domain | awk '{print toupper($0)}' | sed 's/\./_/g;s/-/_/g')" - if is_set ${!var} ; then - file_exist "${SSLCERTDIR}/${xmpp_domain}.pem" \ - || write_file_from_env "$var" "${SSLCERTDIR}/${xmpp_domain}.pem" - fi -done - -exit 0 diff --git a/docker/scripts/pre/02_make_snakeoil_certificates.sh b/docker/scripts/pre/02_make_snakeoil_certificates.sh deleted file mode 100755 index 0e7f21822..000000000 --- a/docker/scripts/pre/02_make_snakeoil_certificates.sh +++ /dev/null @@ -1,91 +0,0 @@ -#!/bin/bash -set -e - -source "${EJABBERD_HOME}/scripts/lib/base_config.sh" -source "${EJABBERD_HOME}/scripts/lib/config.sh" -source "${EJABBERD_HOME}/scripts/lib/base_functions.sh" -source "${EJABBERD_HOME}/scripts/lib/functions.sh" - - -make_snakeoil_certificate() { - local domain=$1 - local certfile=$2 - - openssl req -subj "/CN=${domain}" \ - -new \ - -newkey rsa:4096 \ - -days 365 \ - -nodes \ - -x509 \ - -keyout /tmp/selfsigned.key \ - -out /tmp/selfsigned.crt - - echo "Writing ssl cert and private key to '${certfile}'..." - cat /tmp/selfsigned.crt /tmp/selfsigned.key > ${certfile} - rm /tmp/selfsigned.crt /tmp/selfsigned.key -} - - -make_host_snakeoil_certificate() { - local IFS=@ - local domain='localhost' - local erlang_node=${ERLANG_NODE} - - if is_true ${erlang_node} ; then - domain=${HOSTNAME} - elif is_set ${erlang_node} ; then - set ${erlang_node} - local nodehost=$2 - if is_zero ${nodehost} ; then - domain=${HOSTNAME} - else - domain=${nodehost} - fi - fi - - echo -n "Missing ssl cert for your host. " - echo "Generating snakeoil ssl cert for ${domain}..." - - make_snakeoil_certificate ${domain} ${SSLCERTHOST} -} - - -make_domain_snakeoil_certificate() { - local domain=$1 - local certfile=$2 - - echo -n "Missing ssl cert for your xmpp domain. " - echo "Generating snakeoil ssl cert for ${domain}..." - - make_snakeoil_certificate ${domain} ${certfile} -} - - -## backward compatibility -# link old xmpp_domain.pem file to the first <domainname>.pem in XMPP_DOMAIN -readonly SSLCERTDOMAIN="${SSLCERTDIR}/xmpp_domain.pem" -if file_exist ${SSLCERTDOMAIN} ; then - for xmpp_domain in ${XMPP_DOMAIN} ; do - file_exist "${SSLCERTDIR}/${xmpp_domain}.pem" \ - || ln -s ${SSLCERTDOMAIN} "${SSLCERTDIR}/${xmpp_domain}.pem" - break - done -fi - - -is_true ${EJABBERD_SKIP_MAKE_SSLCERT} \ - && echo "Skip certificate generation" \ - && exit 0 - -# generate host ssl cert if missing -file_exist ${SSLCERTHOST} \ - || make_host_snakeoil_certificate - -# generate xmmp domain ssl certificates if missing -for xmpp_domain in ${XMPP_DOMAIN} ; do - domain_certfile="${SSLCERTDIR}/${xmpp_domain}.pem" - file_exist ${domain_certfile} \ - || make_domain_snakeoil_certificate ${xmpp_domain} ${domain_certfile} -done - -exit 0 diff --git a/docker/scripts/pre/03_make_dhparam.sh b/docker/scripts/pre/03_make_dhparam.sh deleted file mode 100755 index e240210fc..000000000 --- a/docker/scripts/pre/03_make_dhparam.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash -set -e - -source "${EJABBERD_HOME}/scripts/lib/base_config.sh" -source "${EJABBERD_HOME}/scripts/lib/config.sh" -source "${EJABBERD_HOME}/scripts/lib/base_functions.sh" -source "${EJABBERD_HOME}/scripts/lib/functions.sh" - - -make_dhparam() { - local dhfile=$1 - local bits=$2 - - echo "Writing dh file to '${dhfile}'..." - openssl dhparam -out ${dhfile} ${bits} -} - - -is_true ${EJABBERD_SKIP_MAKE_DHPARAM} \ - && echo "Skip DH param generation" \ - && exit 0 - -if is_true ${EJABBERD_DHPARAM} ; then - file_exist ${SSLDHPARAM} \ - || make_dhparam ${SSLDHPARAM} 4096 -fi - -exit 0 diff --git a/docker/scripts/pre/10_erlang_cookie.sh b/docker/scripts/pre/10_erlang_cookie.sh deleted file mode 100755 index bf276fc12..000000000 --- a/docker/scripts/pre/10_erlang_cookie.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash -set -e - -source "${EJABBERD_HOME}/scripts/lib/base_config.sh" -source "${EJABBERD_HOME}/scripts/lib/config.sh" -source "${EJABBERD_HOME}/scripts/lib/base_functions.sh" -source "${EJABBERD_HOME}/scripts/lib/functions.sh" - - -set_erlang_cookie() { - echo "Set erlang cookie to ${ERLANG_COOKIE}..." - echo ${ERLANG_COOKIE} > ${ERLANGCOOKIEFILE} - chmod 400 ${ERLANGCOOKIEFILE} -} - - -file_exist ${FIRST_START_DONE_FILE} \ - && exit 0 - - -# set erlang cookie if ERLANG_COOKIE is set in environemt -is_set ${ERLANG_COOKIE} \ - && set_erlang_cookie - -exit 0 diff --git a/docker/scripts/pre/20_ejabberd_config.sh b/docker/scripts/pre/20_ejabberd_config.sh deleted file mode 100755 index 498648c5a..000000000 --- a/docker/scripts/pre/20_ejabberd_config.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash -set -e - -source "${EJABBERD_HOME}/scripts/lib/base_config.sh" -source "${EJABBERD_HOME}/scripts/lib/config.sh" -source "${EJABBERD_HOME}/scripts/lib/base_functions.sh" -source "${EJABBERD_HOME}/scripts/lib/functions.sh" - - -make_config() { - if [ ! -e ${CONFIGFILE} ]; then - echo "Generating ejabberd config file..." - cat ${CONFIGTEMPLATE} \ - | python -c "${PYTHON_JINJA2}" \ - > ${CONFIGFILE} - else - echo "ejabberd config file exists." - fi - - if [ ! -e ${CTLCONFIGFILE} ]; then - echo "Generating ejabberdctl config file..." - cat ${CTLCONFIGTEMPLATE} \ - | python -c "${PYTHON_JINJA2}" \ - > ${CTLCONFIGFILE} - else - echo "ejabberdctl config file exists." - fi -} - - -file_exist ${FIRST_START_DONE_FILE} \ - && exit 0 - - -# generate config file -make_config - -exit 0 diff --git a/docker/scripts/stop/10_leave_cluster.sh b/docker/scripts/stop/10_leave_cluster.sh deleted file mode 100755 index b75efc52d..000000000 --- a/docker/scripts/stop/10_leave_cluster.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash -set -e - -source "${EJABBERD_HOME}/scripts/lib/base_config.sh" -source "${EJABBERD_HOME}/scripts/lib/config.sh" -source "${EJABBERD_HOME}/scripts/lib/base_functions.sh" -source "${EJABBERD_HOME}/scripts/lib/functions.sh" - - -leave_cluster() { - echo "Leave cluster... " - rm ${CLUSTER_NODE_FILE} - NO_WARNINGS=true ${EJABBERDCTL} leave_cluster -} - - -file_exist ${CLUSTER_NODE_FILE} \ - && leave_cluster - - -exit 0 |