Commit 449ef52a authored by Daniel's avatar Daniel

Update overlay/root/scripts/mysql_config.sh,...

Update overlay/root/scripts/mysql_config.sh, overlay/root/scripts/nc_tuning.sh, overlay/root/scripts/functions.sh, overlay/root/scripts/redis_config.sh, overlay/root/scripts/php_setup.sh files
parent 1ec3bb19
......@@ -120,13 +120,13 @@ conf_activate()
}
conf_update(){
local file_conf=""; local option=""; local new_val=""; local add_after=""; local add_before="";
local file_conf=""; local option=""; local new_val=""; local add_after=""; local add_before=""; local help=false;
local option_end=""
local assignment_char="="
local backup_ext=""
local print_only=false
local debug=false
local activate_option=false
local auto_activate=true
while [ "$1" != "" ]; do
case "${1}" in
......@@ -140,7 +140,8 @@ conf_update(){
--add-before) add_before=$2; ;;
--debug) debug=true; shift; continue; ;;
-p | --print-only) print_only=true; shift; continue; ;;
--activate) activate_option=true; shift; continue; ;;
-n | --no-auto-activate) auto_activate=false; shift; continue; ;;
-h | --help) help=true; debug=true; shift; continue; ;;
*)
if [ "$1" == "-*" ]; then echo "ERROR: unknown parameter '$1'"; return 1; fi
# accept config as last parameter without -c
......@@ -208,8 +209,9 @@ conf_update(){
echo "-b | --backup-extension : '${backup_ext}'"
echo " --add-before : '${add_before}'"
echo " --add-after : '${option_end}'"
echo " --activate : '${activate_option}'"
echo "-n | --no-auto-activate : '${auto_activate}'"
echo " -p | --print-only : '${print_only}'"
if help; then return 0; fi
fi
##################
......@@ -243,7 +245,7 @@ conf_update(){
# remove all spaces
# "s|\([^[:space:]]*\)[[:space:]]*\([^[:space:]]*\)|\1 \2|g"
local ret_order="\1\2"
if $activate_option; then local ret_order="\2"; fi
if $auto_activate; then local ret_order="\2"; fi
if $print_only; then
sed -n -e "s|\(.*\)\(${option}\)\([[:space:]]*\)${assignment_char}.*|${ret_order}${assignment_char}${new_val}${option_end}|gp" $file_conf
else
......
......@@ -27,17 +27,17 @@ sleep 5
#mysql -u root -e "ALTER USER 'root'@'localhost' IDENTIFIED BY '${DB_ROOT_PW}';"
echo "mysql: setting up root credentials"
mysql -u root -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '${DB_ROOT_PW}';"
alias mysqlr="mysql --user=root --password=\"${DB_ROOT_PW}\""
# create the dbuser (fix for mysql >= 8)
# mysql -u root -e "CREATE USER '${DB_ROOT}'@'localhost' IDENTIFIED BY '${DB_ROOT_PW}';"
echo "mysql: setting up user ${DB_ROOT}"
mysql -u root -e "CREATE USER '${DB_ROOT}'@'localhost' IDENTIFIED WITH mysql_native_password BY '${DB_ROOT_PW}';"
mysql -u root -e "GRANT ALL PRIVILEGES ON *.* TO '${DB_ROOT}'@'localhost' WITH GRANT OPTION;"
mysql -u root -e "FLUSH PRIVILEGES;"
mysqlr "CREATE USER '${DB_ROOT}'@'localhost' IDENTIFIED WITH mysql_native_password BY '${DB_ROOT_PW}';"
mysqlr "GRANT ALL PRIVILEGES ON *.* TO '${DB_ROOT}'@'localhost' WITH GRANT OPTION;"
mysqlr "FLUSH PRIVILEGES;"
# create nextcloud db with extended character set and add user as admin
echo "mysql: setting up database ${DB_NAME}"
mysql -u root -e "CREATE DATABASE IF NOT EXISTS ${DB_NAME} CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;"
mysql -u root -e "GRANT ALL PRIVILEGES on ${DB_NAME}.* to '${DB_ROOT}'@'localhost';"
mysql -u root -e "FLUSH PRIVILEGES;"
mysqlr "CREATE DATABASE IF NOT EXISTS ${DB_NAME} CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;"
mysqlr "GRANT ALL PRIVILEGES on ${DB_NAME}.* to '${DB_ROOT}'@'localhost';"
mysqlr "FLUSH PRIVILEGES;"
......@@ -17,13 +17,13 @@ occ config:system:set opcache.revalidate_freq --value=1
# setup op cache
# https://docs.nextcloud.com/server/15/admin_manual/configuration_server/server_tuning.html#enable-php-opcache
conf_update_enable -c ${file_php_conf} -o "opcache.enable" -v "1"
conf_update_enable -c ${file_php_conf} -o "opcache.enable_cli" -v "1"
conf_update_enable -c ${file_php_conf} -o "opcache.interned_strings_buffer" -v "8"
conf_update_enable -c ${file_php_conf} -o "opcache.max_accelerated_files" -v "10000"
conf_update_enable -c ${file_php_conf} -o "opcache.memory_consumption" -v "128"
conf_update_enable -c ${file_php_conf} -o "opcache.save_comments" -v "1"
conf_update_enable -c ${file_php_conf} -o "opcache.revalidate_freq" -v "1"
conf_update -c ${file_php_conf} -o "opcache.enable" -v "1"
conf_update -c ${file_php_conf} -o "opcache.enable_cli" -v "1"
conf_update -c ${file_php_conf} -o "opcache.interned_strings_buffer" -v "8"
conf_update -c ${file_php_conf} -o "opcache.max_accelerated_files" -v "10000"
conf_update -c ${file_php_conf} -o "opcache.memory_consumption" -v "128"
conf_update -c ${file_php_conf} -o "opcache.save_comments" -v "1"
conf_update -c ${file_php_conf} -o "opcache.revalidate_freq" -v "1"
service php-fpm restart 1>/dev/null
service nginx restart 1>/dev/null
......@@ -45,11 +45,11 @@ echo "tuning: big files"
# https://docs.nextcloud.com/server/15/admin_manual/configuration_files/big_file_upload_configuration.html#nginx
###
# change php.ini
conf_update_enable -c ${file_php_conf} -o "memory_limit" -v "8G"
conf_update_enable -c ${file_php_conf} -o "post_max_size" -v "8G"
conf_update_enable -c ${file_php_conf} -o "max_input_time" -v "3600"
conf_update_enable -c ${file_php_conf} -o "max_execution_time" -v "3600"
conf_update_enable -c ${file_php_conf} -o "output_buffering" -v "0"
conf_update_enable -c ${file_php_conf} -o "upload_tmp_dir" -v "/var/big_temp_file/"
conf_update -c ${file_php_conf} -o "memory_limit" -v "8G"
conf_update -c ${file_php_conf} -o "post_max_size" -v "8G"
conf_update -c ${file_php_conf} -o "max_input_time" -v "3600"
conf_update -c ${file_php_conf} -o "max_execution_time" -v "3600"
conf_update -c ${file_php_conf} -o "output_buffering" -v "0"
conf_update -c ${file_php_conf} -o "upload_tmp_dir" -v "/var/big_temp_file/"
mkdir -p /var/big_temp_file
chown $WWW_USER /var/big_temp_file
......@@ -5,6 +5,6 @@ echo "php: starting setup"
if [ ! -f "$file_php_conf" ]; then cp "${file_php_conf}-production" ${file_php_conf}; fi
echo "php: configure default values"
conf_update_enable -c ${file_php_conf} -o "memory_limit" -v "512M"
conf_update_enable -c ${file_php_conf} -o "html_errors" -v "On"
conf_update_enable -c ${file_php_conf} -o "mysqli.default_socket" -v "${file_mysql_sock}"
conf_update -c ${file_php_conf} -o "memory_limit" -v "512M"
conf_update -c ${file_php_conf} -o "html_errors" -v "On"
conf_update -c ${file_php_conf} -o "mysqli.default_socket" -v "${file_mysql_sock}"
......@@ -23,15 +23,15 @@ echo "redis: setup redis config"
# setup redis config file
if [ ! -f "$file_redis_conf" ]; then cp "${file_redis_conf}.sample" ${file_redis_conf}; fi
#
conf_update -a ' ' --activate ${file_redis_conf} ^bind 127.0.0.1
conf_update -a ' ' ${file_redis_conf} ^bind 127.0.0.1
# Disable Redis listening on TCP by setting 'port' to 0
conf_update -a ' ' --activate ${file_redis_conf} ^port 0
conf_update -a ' ' ${file_redis_conf} ^port 0
#
# Enable Redis unix socket
conf_update -a ' ' --activate ${file_redis_conf} unixsocket ${file_redis_sock}
conf_update -a ' ' ${file_redis_conf} unixsocket ${file_redis_sock}
#
# Grant permission to the socket to all members of the redis group
conf_update -a ' ' --activate ${file_redis_conf} unixsocketperm 770
conf_update -a ' ' ${file_redis_conf} unixsocketperm 770
echo "redis: register redis in nextcloud"
# set caching
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment