Support

Akeeba Backup for Joomla!

#31856 Migration to new server (same domain) using read-only site to avoid complete downtime

Posted in ‘Akeeba Backup for Joomla! 4 & 5’
This is a public ticket

Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.

Environment Information

Joomla! version
n/a
PHP version
n/a
Akeeba Backup version
n/a

Latest post by on Wednesday, 13 November 2019 17:17 CST

mikeprince
I couldn't find reference in the documentation for any guide to migrating a Joomla database to a new server, with the same domain, considering the necessary time for DNS update. I have a highly interactive site so wish to minimise downtime, and need to prevent database updates on the 'old' site after I have taken the backup to migrate.

Although my DNS TTL is set to 300s I noticed with other (non Joomla) domain migrations that it was taking many hours for the IP address of the new server to propagate, and many hours more to be able for Let's Encrypt to pick this up and allow me to setup SSL again (apparently from a long queue length on the Let's Encrypt side).

Clearly until DNS has updated the 'old' site will be visible to users. What is the best way to allow this, but in a read-only mode rather than taking it completely offline? I was thinking of displaying a message to users, disabling the login module, and booting out all logged in users. This way I presume any users will not see any downtime, just a period when they are directed to the old site and get it read-only before their DNS is updated and they will see the new site (with the login module re-enabled).

Is it possible to use Site Transfer Wizard to do the actual migration? The transfer target URL would be the same https://example.com and would point to the old site until DNS is updated, so can an IP address be used here instead? Otherwise I could manually transfer and use Kickstart, but again can this be done before the DNS update and SSL certificate installation has occured? Going to https://example.com/kickstart.php would not go to the new server until this has happened, but having to wait for this would mean I can't achieve the no downtime I would like.

In short, is it possible to do a migration to a new server with the same domain and avoid complete downtime by keeping access to the old site in read-only mode in parallel to setting up the site on the new server?

nicholas
Akeeba Staff
Manager
AFAIK Joomla does not have a good way of making a site "read-only". I suspect that you'd have to go to great lengths to make that happen which isn't all that practical or fail-safe.

I faced this problem years ago when I had to transfer this site with minimal downtime. The solution is to set the DNS TTL to 300 seconds at least a week before you do the actual migration.

Remember that the DNS clients do not hit your DNS server directly. They always use a caching DNS server. When the caching DNS server deems that the copy of your DNS zone in its cache is out of date it will ask your DNS server for a new copy. Considering that the default TTL fro most DNS entries is between a day and a week it makes sense to update your DNS zone's A and AAAA records with the ultra-low TTL a week in advance of the move. Therefore by the time you make the site move the zone will have propagated and everyone will know that the TTL is five minutes. This means that your downtime will be 5' to 10'.

Further reading (my write-up of the real world moving of our business site, five years ago): https://www.dionysopoulos.me/how-i-transferred-a-7gb-site-with-15-of-downtime/

Nicholas K. Dionysopoulos

Lead Developer and Director

🇬🇷Greek: native 🇬🇧English: excellent 🇫🇷French: basic • 🕐 My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

mikeprince
Very interesting and an excellent write-up. So if I understand properly:

  • You do an initial full backup and restore this on the new server: how do you run kickstart on the new server considering that https://example.com/kickstart.php will resolve to the old one?

  • Set the old site offline

  • Do another full backup (minus anything unimportant for speed) and restore this on the new server, 'updating' the previous restoration. Same question as above

  • Switch the DNS, which should be quick if TTL has been set low for several days

(I'd forgotten about the cron jobs!)

nicholas
Akeeba Staff
Manager
how do you run kickstart on the new server considering that https://example.com/kickstart.php will resolve to the old one?


I set up a subdomain as an A record with the new server's IP address :) Joomla is hostname-agnostic. It doesn't matter if I restore to foo.example.com and access the site as www.example.com. It will work regardless.

Nicholas K. Dionysopoulos

Lead Developer and Director

🇬🇷Greek: native 🇬🇧English: excellent 🇫🇷French: basic • 🕐 My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

mikeprince
Ah, sneaky. Thanks!

nicholas
Akeeba Staff
Manager
You're welcome!

Nicholas K. Dionysopoulos

Lead Developer and Director

🇬🇷Greek: native 🇬🇧English: excellent 🇫🇷French: basic • 🕐 My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

System Task
system
This ticket has been automatically closed. All tickets which have been inactive for a long time are automatically closed. If you believe that this ticket was closed in error, please contact us.

Support Information

Working hours: We are open Monday to Friday, 9am to 7pm Cyprus timezone (EET / EEST). Support is provided by the same developers writing the software, all of which live in Europe. You can still file tickets outside of our working hours, but we cannot respond to them until we're back at the office.

Support policy: We would like to kindly inform you that when using our support you have already agreed to the Support Policy which is part of our Terms of Service. Thank you for your understanding and for helping us help you!