How do move a weborigin's data disks to a new weborigin
If a weborigin is compromised or otherwise not viable, you can create a new weborigin on the same host and then move the data disks to the new weborigin server.
- Setup new weborigin on host: Create without any data disks (
data_disks: []). Follow all steps in weborigin creation. - Generate restore script: On red001, run
/usr/local/share/red/ui/sbin/red-generate-web-conf-restore-commands weboriginxxx(where weboriginxxx is the name of the old weborigin). Copy the output to the new weborigin server. - Re-configure data disks in ansible: Move the
data_diskconfiguration from the old weborigin’s yml file to the new one. Push to host with--tags kvm-env-file. - Update `/etc/udev/rules.d: On the host, move data disks from the old weborigin’s udev rules to the new weborigin’s udev rules.
- Maintenance mode - edit
/usr/local/share/red/etc/config.inc.phpon red001 to put control panel in maintenance mode. - Copy key data from old weborigin:
/etc/apache2/site-{enabled/available}/etc/php//etc/ssl/mayfirst//etc/fstab
- Restore to new weborigin: Copy
/etc/ssl/mayfirst/and the data disk lines in/etc/fstab. The other data is just in case - so you have a reference. - Shutdown old weborigin. Downtime starts
- Reboot new weborigin. If it doesn’t come up, you may need to
chgrpthe data disks. - Run control panel script: Run restore script from red generated earlier on new weborigin.
- Ensure everything is running: The next step will start all the traffic to be directed at the new weborigin. Ensure all services are running properly.
- Update proxies - on each web proxy server run: {{{ tar -czf $HOSTNAME-nginx-sites-available-$(date +%F).tar.gz /etc/nginx/sites-available/; sed -i -e ’s/weboriginOLD/weboriginNEW/g’ -e ’s/127.0.0.1:8001/127.0.0.1:8018/g’ /etc/nginx/sites-available/*; mf-nginx-t && systemctl reload nginx; }}}
- Confirm: Ensure all web sites are working properly.
- Update control panel:
UPDATE red_item SET item_host = 'weboriginNEW.mayfirst.org' WHERE item_host = 'weboriginOLD.mayfirst.org' AND item_status != 'deleted' - Ensure everything is working: Run
red-queue run --item-id ID --restoreon all web configurations on the new host (will take hours)