Question

Redirecting inbound traffic to backup/snapshot droplet

Posted July 26, 2021 121 views
BackupsUbuntu 20.04DigitalOcean Droplets

I want to upgrade my droplet from Ubuntu 16.04 to 20.04. I know that the first steps are to create a snapshot and then create a new droplet from the snapshot.

To get inbound traffic to the backup droplet while the main droplet is updating, is it as simple as changing the A record for the domain to use the IP of the backup? Can I assume that the backup droplet will be fully functioning as soon as it’s created? Will changing the IP on the A record create significant downtime?

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
Submit an Answer
1 answer

Hello,

To avoid any downtime, what you could do is:

  • Create the backup Droplet from a snapshot
  • Before changing your A record make sure to fully test your website, you could do that by updating your local hosts file so that your PC would load the site from the secondary server rather than your main one.
  • Once you’ve fully tested the site, you could then point the A record of your domina name to the new Droplet’s IP
  • Then wait 12/24 hours to make sure that the DNS cache has cleared around the Globe
  • Finally you could proceed with the upgrade as you mentioned

One thing to keep in mind is the database, as if you are making some changes to your site, they would be preserved on the new Droplet, so you might have to carry them over to the old one once the upgrade has been completed.

Regards,
Bobby

  • Thank you, this is extremely helpful.

    Just one question about the DNS cache - I actually tried with another site I’m building and checked the IP in developer tools and on an IP checker site and both reflected the new droplet’s IP immediately. I know updating the nameservers causes a delay, but even changing the IP within the same datacenter can create a delay?

    • Hi there,

      No problem, happy to hear that this is helpful!

      I usually use this DNS checker here to figure out the approximate DNS propagation over the Globe:

      https://www.whatsmydns.net/

      Unless you are using Cloudflare the DNS is most likely cached and it could take between 10 minutes and 24 hours to be cleared around the Globe depending on the TTL. But with Cloudflare it is quicker as they have a bit different way of handling DNS.

      Hope that this helps!

      • Awesome site - thanks for providing that.

        And sorry, but one more question. If I use subdomains, can I add an A record for the subdomain that associates the subdomain with the new IP? Right now there’s a CNAME record that aliases the subdomain to the main domain name, but it doesn’t allow me to access the subdomain directly via the IP. So if my site is example.com and my IP is 111.11.11.11, I can access the site via the root IP in the browser, but I can’t access the api.111.11.11.11 subdomain.

        I’m asking because I use this droplet with a third party proxy that directs traffic to the subdomain. I’m wondering if I can simply update the address to the IP rather than the domain name (with the subdomain in either case) with the third party rather than worry about the timing of DNS changes. Probably not a big deal either way since most traffic comes from the US and Europe (which appear to update quickly), but just wondering if that’s another option.

        • Hi there,

          Unfortunately, you can’t add subdomains to an IP address.

          What you could do instead is to have a different endpoint like 111.111.111.111/api.

          You could add an extra location directive in your default Nginx server block or in your Vhost if you are using Apache.

          Hope that this helps!

          • Okay, I think I would have to change some things with my front end configuration (the site was built with React, which complicates the routing), but that might be an option.

            Either way, very helpful stuff. Thanks.