Bump php version to 7.3

Adding database backup/restore information
This commit is contained in:
2019-09-24 13:10:18 +02:00
parent 8e370a0e56
commit 1ac923c774

View File

@@ -4,8 +4,9 @@ serverName="nginx"
serverPackages="nginx" serverPackages="nginx"
databaseName="mariadb" databaseName="mariadb"
databasePackages="mariadb-server mariadb-client" databasePackages="mariadb-server mariadb-client"
phpName="php7.0" phpVersion="7.3"
phpPackages="${phpName}-fpm ${phpName}-json ${phpName}-mysql ${phpName}-curl ${phpName}-intl ${phpName}-mcrypt ${phpName}-gd ${phpName}-zip ${phpName}-xml ${phpName}-mbstring php-imagick php-apcu" phpName="php${phpVersion}"
phpPackages="${phpName}-fpm ${phpName}-json ${phpName}-mysql ${phpName}-curl ${phpName}-intl ${phpName}-gd ${phpName}-zip ${phpName}-xml ${phpName}-mbstring php-imagick php-apcu"
step_1_info() { echo -e "Installation of $serverName and ${databaseName} packages:\n $serverPackages $databasePackages"; } step_1_info() { echo -e "Installation of $serverName and ${databaseName} packages:\n $serverPackages $databasePackages"; }
step_1_alias() { ALIAS=install; } step_1_alias() { ALIAS=install; }
@@ -16,6 +17,7 @@ step_1() {
endReturn endReturn
exe apt install $serverPackages exe apt install $serverPackages
saveReturn $? saveReturn $?
endReturn
} }
step_2_info() { echo "Basic nginx configuration for initial letsencrypt certificate creation"; } step_2_info() { echo "Basic nginx configuration for initial letsencrypt certificate creation"; }
@@ -44,15 +46,15 @@ step_2() {
snippetLetsencryptLoc="/etc/nginx/snippets/letsencrypt.conf" snippetLetsencryptLoc="/etc/nginx/snippets/letsencrypt.conf"
siteLetsencryptWww="/var/www/letsencrypt" siteLetsencryptWww="/var/www/letsencrypt"
snippetLetsencrypt="\ snippetLetsencrypt="\
location ^~ /.well-known/acme-challenge/ { location ^~ /.well-known/acme-challenge/ {
default_type \"text/plain\"; default_type \"text/plain\";
root ${siteLetsencryptWww}; root ${siteLetsencryptWww};
}" }"
siteDefaultLoc="/etc/nginx/sites-available/default" siteDefaultLoc="/etc/nginx/sites-available/default"
siteDefaultIp4="server { siteDefaultIp4="server {
listen 80 default_server; listen 80 default_server;
include ${snippetLetsencryptLoc}; include ${snippetLetsencryptLoc};
}" }"
step_3_info() { echo "Secure mariadb installation"; } step_3_info() { echo "Secure mariadb installation"; }
@@ -70,12 +72,12 @@ step_4() {
mariadbConfigLoc="/etc/mysql/mariadb.conf.d/90-myconfig.cnf" mariadbConfigLoc="/etc/mysql/mariadb.conf.d/90-myconfig.cnf"
mariadbConfig="\ mariadbConfig="\
[mysqld] [mysqld]
innodb_large_prefix=on innodb_large_prefix=on
innodb_file_format=barracuda innodb_file_format=barracuda
innodb_file_per_table=true innodb_file_per_table=true
lower_case_table_names=0 lower_case_table_names=0
#innodb_force_recovery=6" #innodb_force_recovery=6"
@@ -84,35 +86,35 @@ step_5() {
exe apt install $phpPackages exe apt install $phpPackages
} }
phpFpmConfigLocation="/etc/php/7.0/fpm/conf.d/90-custom_pi.ini" phpFpmConfigLocation="/etc/php/${phpVersion}/fpm/conf.d/90-custom_pi.ini"
phpFpmConfig="\ phpFpmConfig="\
post_max_size=64M post_max_size=64M
max_execution_time=600 max_execution_time=600
apc.enable_cli=1 apc.enable_cli=1
date.timezone = Europe/Berlin date.timezone = Europe/Berlin
opcache.enable=1 opcache.enable=1
opcache.enable_cli=1 opcache.enable_cli=1
opcache.interned_strings_buffer=8 opcache.interned_strings_buffer=8
opcache.max_accelerated_files=10000 opcache.max_accelerated_files=10000
opcache.memory_consumption=128 opcache.memory_consumption=128
opcache.save_comments=1 opcache.save_comments=1
opcache.revalidate_freq=1" opcache.revalidate_freq=1"
phpCliConfigLocation="/etc/php/7.0/cli/conf.d/90-custom_pi.ini" phpCliConfigLocation="/etc/php/${phpVersion}/cli/conf.d/90-custom_pi.ini"
phpCliConfig="\ phpCliConfig="\
date.timezone = Europe/Berlin" date.timezone = Europe/Berlin"
step_6_info() { echo -e "Configuration of ${phpName} fpm and cli\n"; } step_6_info() { echo -e "Configuration of ${phpName} fpm and cli\n"; }
step_6() { step_6() {
addConf -c "$phpFpmConfig" "$phpFpmConfigLocation" addConf -c "$phpFpmConfig" "$phpFpmConfigLocation"
addConf -c "$phpCliConfig" "$phpCliConfigLocation" addConf -c "$phpCliConfig" "$phpCliConfigLocation"
echo -n "Restarting ${phpName} ... " echo -n "Restarting ${phpName} ... "
exe service ${phpName}-fpm restart && echo "ok" exe service ${phpName}-fpm restart && echo "ok"
} }
step_10_info() { echo -e "Create mysql database without specific characterset\n"; } step_10_info() { echo -e "Create mysql database without specific characterset\n"; }
step_10_alias() { ALIAS="createdb"; } step_10_alias() { ALIAS="createdb"; }
@@ -135,7 +137,7 @@ step_10() {
read -p "Enter mysql user name: " mysqlUser read -p "Enter mysql user name: " mysqlUser
endCheckEmpty mysqlDatabase "user name" endCheckEmpty mysqlDatabase "user name"
read -p "Enter mysql user password: " mysqlPass read -s -p "Enter mysql user password: " mysqlPass
endCheckEmpty mysqlPass "password" endCheckEmpty mysqlPass "password"
exe mysql -u root -e 'CREATE USER '"'"$mysqlUser"'"'@'"'"'localhost'"'"' IDENTIFIED BY '"'"$mysqlPass"'"';' exe mysql -u root -e 'CREATE USER '"'"$mysqlUser"'"'@'"'"'localhost'"'"' IDENTIFIED BY '"'"$mysqlPass"'"';'
saveReturn $? saveReturn $?
@@ -170,7 +172,7 @@ step_12() {
read -p "Enter mysql user name: " mysqlUser read -p "Enter mysql user name: " mysqlUser
endCheckEmpty mysqlDatabase "user name" endCheckEmpty mysqlDatabase "user name"
read -p "Enter mysql user password: " mysqlPass read -s -p "Enter mysql user password: " mysqlPass
endCheckEmpty mysqlPass "password" endCheckEmpty mysqlPass "password"
exe mysql -u root -e 'CREATE USER '"'"$mysqlUser"'"'@'"'"'localhost'"'"' IDENTIFIED BY '"'"$mysqlPass"'"';' exe mysql -u root -e 'CREATE USER '"'"$mysqlUser"'"'@'"'"'localhost'"'"' IDENTIFIED BY '"'"$mysqlPass"'"';'
saveReturn $? saveReturn $?
@@ -183,5 +185,17 @@ step_12() {
exe mysql -u root -e 'FLUSH PRIVILEGES;' exe mysql -u root -e 'FLUSH PRIVILEGES;'
} }
step_14_info() { echo "Backup and restore a mysql database"; }
step_14_alias() { ALIAS="backup"; }
step_14() {
echo "Dump the existing database with:"
echo " mysqldump --single-transaction nextcloud_db > NextcloudBackup_DB_\`date +\"%Y%m%d\"\`.sql"
echo
echo "Restore with:"
echo " mysql -e \"DROP DATABASE nextcloud_db\""
echo " mysql -e \"CREATE DATABASE nextcloud_db\""
echo " mysql nextcloud_db < NextcloudBackup_DB_20170912.sql"
}
VERSION_SEQREV=3 VERSION_SEQREV=3
. sequencer.sh . sequencer.sh