0

For some reasons, I'm changing my hosting service for my web application. The problem, is that I need to keep my site accessible and fully working during the process.

I want to be sure that my plan to achieve this gonna work, so let talk about the infrastructure.

DNS Records:
A record : torquemanagement.ca -> 138.197.83.23
A record : dev.torquemanagement.ca  -> 138.197.83.23
CNAME record : dev -> @

Host on CompanyA:
IP: 138.197.83.23
PHP Laravel application deployed with git/branch master
Mysql Connetion into .env pointing to Something
Mysql Database having name: Something

Host on CompanyB:
IP: 159.89.124.24
PHP Laravel application deployed with git/branch master
Mysql Connetion into .env pointing to SomethingElse
Mysql Database having name: SomethingElse

Before talking about the procedure I plan to use, is there a conflict in my CNAME and A record about the sub domain. Should I just use the A or the CNAME???

How I plan to achieve this without interruption of services.

1. Export SQL dump from Something(companyA) and import it into SomethingElse(companyB).
2. Changing the Mysql Connection from .env file onto host CompanyA to the Mysql DB onto host CompanyB
3. Export SQL to only updates new record from Something and import it into SomethingElse.
    3.A. I think this will prevent lost of any record save to DB of companyA while doing the export/import.
4. Changing ALL ip in DNS records to point 159.89.124.24 (ip of host CompanyB)
5. Waiting 48hrs or more.
6. Shutting down host on CompanyA

If I'm doing this, will my services stay available? From my understanding, while the process of changing the DNS over the net, people connecting to CompanyA will get result from the new Database onto host of CompanyB and when the process will be finish, they will not lost any record.

What do you think?
Am I wrong?
Is there any alternative to keep services alive?

1 Answer 1

0

Before talking about the procedure I plan to use, is there a conflict in my CNAME and A record about the sub domain. Should I just use the A or the CNAME???

That's up to you. If you keep the A record, then it's statically set and it'll never change unless you change it. If you keep the CNAME of dev -> @, dev.torquemanagement.ca would change if you changed the root record. In your case, they need to both be set to the same thing anyway, so it really doesn't matter.

There are a couple of concerns with the plan. First, your assumption is that you'll be able to hook up your app on CompanyA to the database of CompanyB. Is CompanyB publicly exposing your database to the internet? Or do you have some ability to create a VPN tunnel between sites? Or do you have control over the firewall that you could allow access to the database from CompanyA?

What are your allowances for maintenance windows and downtime? How much traffic does your site process? How large is the database?

If you can afford a maintenance window, I would suggest a simpler approach

  1. Enter Maintenance mode to stop new data from going into DB
  2. Export database from A and import it into B
  3. Verify on your end that access to App at B works (use host file to manipulate DNS)
  4. Make the DNS change (before starting maintenance window, set TTL of DNS records to something really low, like 120 seconds)
  5. As visitors start to resolve the URL to the new IP, it'll be a natural progression out of maintenance mode. The majority of your visitors should honor the TTL on your DNS records and the change from one IP to the other should occur within the timeframe of your TTs.
  6. Shut down site A when you're ready.

This method would introduce a maintenance window for your visitors, but at the benefit of not having to mess with database replication. Of course, if your DB is 100s of GB and the export/import would take too long for a maintenance window, this plan might not work.

1
  • My database is 364mb, so your solution can be done easily. But after some research, it say that Godaddy will apply the change of the ip with the TTL, but even if I say 120 sec, it'll took up to 48 hrs to be fully propagate over the internet. I did not learn a lot about how to connect database from App A to DB on company B, but I tought that if i can use SSH from my computer to connect it, I could do the same from the app on company A.
    – Elie Morin
    Nov 11, 2019 at 14:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .