CHG-2025-XX-XX migrate store to hetzner3: Difference between revisions
Jump to navigation
Jump to search
(script cleanup) |
(added step to fix wordpress bug #48693) |
||
Line 148: | Line 148: | ||
# add wordpress bug fix | # add wordpress bug fix | ||
# | # is the bug fix already present? | ||
if [[ ! $(grep 'https://core.trac.wordpress.org/ticket/48693' wp-config.php) ]]; then | |||
# the bug fix is absent; add it | |||
backup_filename="wp-config.`date "+%Y%m%d_%H%M%S"`.php" | |||
mv wp-config.php ${backup_filename} | |||
cat > wp-config.php <<'EOF' | |||
<?php | |||
# fix wordpress bug https://core.trac.wordpress.org/ticket/48693 | |||
if( ! function_exists('ini_set') ){ | |||
function ini_set(){ | |||
return; | |||
} | |||
} | |||
EOF | |||
tail -n +2 ${backup_filename} >> wp-config.php | |||
fi | |||
# verify | |||
ls | |||
vim ${vhostDir}/wp-config.php | vim ${vhostDir}/wp-config.php | ||
Revision as of 04:58, 12 December 2024
Status
2024-12-11 09:52 UTC
Initial Ticket draft created on wiki (WIP)
Purpose
This change does the following for store.opensourceecology.org
- entirely migrate the 'store' wordpress site from hetzner2 (EOL CentOS7) to hetzner3 (Debian 12)
- update core wp from v5.1.1 to v6.6.1
- eliminates subversion from the docroot (which has security issues because the releases are not signed and lacks 3TOFU)
- update plugin 'akismet' from v4.1.1 to v5.3.3
- uninstall plugin 'be-gdpr'
- uninstall plugin 'be-portfolio-post'
- update plugin 'classic-editor' from v1.4 to v1.6.5
- uninstall plugin 'colorhub'
- update plugin 'contact-form-7' from v5.1.1 to v5.9.8
- uninstall plugin 'force-strong-passwords'
- update plugin 'google-authenticator' from v0.48 to 0.54
- uninstall plugin 'masterslider'
- update plugin 'meta-box' from v4.17.3 to v5.10.2
- uninstall plugin 'meta-box-conditional-logic'
- uninstall plugin 'meta-box-show-hide'
- uninstall plugin 'meta-box-tabs'
- uninstall plugin 'oshine-core'
- uninstall plugin 'oshine-modules'
- uninstall plugin 'redux-vendor-support'
- uninstall plugin 'rename-wp-login'
- uninstall plugin 'revslider'
- uninstall plugin 'tatsu'
- uninstall plugin 'typehub'
- update plugin 'vaching' from v1.6.9 to v1.8.3
- update plugin 'woocommerce' from v3.5.7 to v9.3.3
- update plugin 'coingate-for-woocommerce' from v1.2.2 to v2.1.1
- change theme from 'oshin' to 'twentyseventeen'
- update theme 'storefront' from v6.6.4.4 to v7.2.1
- update theme 'twentyeleven' from v3.2 to v4.7
- update theme 'twentyfifteen' from v2.4 to v3.8
- update theme 'twentyfourteen' from v2.6 to v4.0
- update theme 'twentynineteen' from v1.3 to v2.9
- update theme 'twentyseventeen' from v2.1 to v3.7
- update theme 'twentysixteen' from v1.9 to v3.3
- update theme 'twentyten' from v2.8 to v4.2
- update theme 'twentythirteen' from v2.8 to v4.2
- update theme 'twentytwelve' from v2.9 to v4.3
Points of Contact
Change being performed by: Michael Altfield
Service owners: Catarina Mota & Marcin Jakubowski
Apply to Production
# TODO: verify && change everything in this script #################### # run on hetzner2 # #################### sudo su - # STEP 0: CREATE BACKUPS source /usr/home/osemain/backups/backup.settings /usr/home/osemain/backups/backup.sh # when finished, verify that the whole system backup was successful before proceeding sudo rclone lsl b2:ose-server-backups | grep -i $(date +%Y%m%d) # DECLARE VARIABLES vhost_name='store.opensourceecology.org' dbName='store_db' dbUser="CHANGEME" dbPass="CHANGEME" source /usr/home/osemain/backups/backup.settings stamp=`date +%Y%m%d` backupDir_hetzner2="/var/tmp/backups_for_migration_to_hetzner2/${vhost_name}_${stamp}" backupFileName_db_hetzner2="mysqldump_${vhost_name}.${stamp}.sql.bz2" backupFileName_files_hetzner2="${vhost_name}_files.${stamp}.tar.gz" vhostDir='/var/www/html/store.opensourceecology.org' # STEP 1: BACKUP DB mkdir -p ${backupDir_hetzner2}/{current,old} pushd ${backupDir_hetzner2}/current/ mv ${backupDir_hetzner2}/current/* ${backupDir_hetzner2}/old/ time nice mysqldump -u"${dbUser}" -p"${dbPass}" ${dbName} | bzip2 -c > ${backupDir_hetzner2}/current/${backupFileName_db_hetzner2} # STEP 2: BACKUP FILES time nice tar -czvf ${backupDir_hetzner2}/current/${backupFileName_files_hetzner2} ${vhostDir} # STEP 3: COPY TO HETZNER3 ssh -p 32415 hetzner3 sudo mkdir -p ${backupDir_hetzner3}/{current,old} ssh -p 32415 hetzner3 sudo mv ${backupDir_hetzner3}/current/* ${backupDir_hetzner3}/old/ rsync -av --progress --rsync-path="sudo rsync" -e "ssh -p 32415" ${backupDir_hetzner2}/current/* maltfield@hetzner3:${backupDir_hetzner3}/current/ #################### # run on hetzner3 # #################### sudo su - # STEP 0: CREATE BACKUPS # for good measure, trigger a backup of the entire system's database & files: time /bin/nice /root/backups/backup.sh &>> /var/log/backups/backup.log # when finished, verify that the whole system backup was successful before proceeding rclone lsl b2:ose-server-backups | grep -i $(date +%Y%m%d) # DECLARE VARIABLES vhost_name='store.opensourceecology.org' dbName='store_db' dbUser="CHANGEME" dbPass="CHANGEME" source /root/backups/backup.settings stamp=`date +%Y%m%d` backupDir_hetzner2="/var/tmp/backups_for_migration_to_hetzner3/${vhost_name}_${stamp}" backupDir_hetzner3="/var/tmp/backups_for_migration_from_hetzner2/${vhost_name}_${stamp}" backupFileName_db_hetzner2="mysqldump_${vhost_name}.${stamp}.sql.bz2" backupFileName_files_hetzner2="${vhost_name}_files.${stamp}.tar.gz" vhostDir='/var/www/html/store.opensourceecology.org' docrootDir="${vhostDir}/htdocs" # STEP 1: ADD DB # create backup before we start changing the sql file pushd ${backupDir_hetzner3}/current cp ${backupFileName_db_hetzner2} ${backupFileName_db_hetzner2}.orig # extract .sql.bz2 -> .sql bzip2 -dc ${backupFileName_db_hetzner2} > db.sql time nice mysql -uroot -p${mysqlPass} -sNe "DROP DATABASE IF EXISTS ${dbName};" time nice mysql -uroot -p${mysqlPass} -sNe "CREATE DATABASE ${dbName}; USE ${dbName};" time nice mysql -uroot -p${mysqlPass} < "db.sql" time nice mysql -uroot -p${mysqlPass} -sNe "GRANT ALL ON ${dbName}.* TO '${dbUser}'@'localhost' IDENTIFIED BY '${dbPass}'; FLUSH PRIVILEGES;" # STEP 2: Add vhost files mv ${vhostDir}/* ${backupDir_hetzner3}/old/ tar -xzvf ${backupFileName_files_hetzner2} mv var/www/html/${vhost_name} ${vhostDir} mkdir -p ${docrootDir_hetzner3} # add wordpress bug fix # is the bug fix already present? if [[ ! $(grep 'https://core.trac.wordpress.org/ticket/48693' wp-config.php) ]]; then # the bug fix is absent; add it backup_filename="wp-config.`date "+%Y%m%d_%H%M%S"`.php" mv wp-config.php ${backup_filename} cat > wp-config.php <<'EOF' <?php # fix wordpress bug https://core.trac.wordpress.org/ticket/48693 if( ! function_exists('ini_set') ){ function ini_set(){ return; } } EOF tail -n +2 ${backup_filename} >> wp-config.php fi # verify ls vim ${vhostDir}/wp-config.php # INSTALL PLUGINS # TODO commands to update themes & plugins from 3TOFU'd dir # SET PERMISSIONS # TODO: copy from hetzner3 article # finally, log into the new wordpress site. Then update settings: # 1. "Appearance" -> Themes. Activate "Twenty Seventeen" # 2. "Settings" -> "Reading" -> "Homepage" = "Sample Page"