You’d think from the title this would be easy.
Think again!
The main reason this is harder than I expected is because Digital Ocean will not allow you to add the domain to your Act02 until you have first deleted it completely from Act01.
Here is the high level view of what we need to do and then a few details to follow:
- Back up your domain DNS records and all those details (Zone file) on Original Account (now called Act01)
- Delete the “Domain” on Act01. NOTE! You will now have downtime until this is over and propagated…
- Create the Domain again in the target digital ocean account (now called Act02)
- Re-input the zone files from Act01 to Act02
- Hope everything works!
Now, let’s go with extra details:
Preliminary Basic Stuff
Probably you’ve already done all this but just in case, keep in mind your target server to where you are moving the old Digital Ocean server should already be set up and running, other than this last step of connecting the domains. Here are some quick memory joggers to make sure you’re done all that:
_ Moved files over
_ Moved and restored MYSQL databases
_ Done all the letsencrypt SSL certificate stuff
Backing up Zone File
It’s as easy as reading this
Actually Check the Zone File After Downloading it
True story. I thought I had the right zone file until I opened it and found out I didn’t. Doing this step saved me a bunch of saved headaches!
Delete the Domain from Act01
Go to ‘Domains’ and in the hamburger menu select “Delete domain’ and type the domain again when prompted. Domain and records are now gone from Act01 and now Digital Ocean will allow you to add it to Act02.
Add the Domain to Act02
- Log out of Act01
- Log into Act02
- Go to Networking
- Go to Domains
- Add a domain
Manually Re-Input Your DNS Records From Zone File
What? You can’t import the zone file that you exported with a standard import tool like .csv?
No. You cannot.
Why? I don’t know. I’m just the message boy.
But here is an official link to leave you more confident that I was right.
So, get ready for a copy-paste fest!
Open up your exported DNS Zone file and start slapping the data into the DNS record fields in Act02…
TIP: While working in my exported .txt zone file, I found it helpful to simply add 3 or 5 line-spaces between the entry I just updated so that as I was going through the list of records it was easy to tell where I was.
Test the DNS
Run a dig command on your domain and subdomains to make sure DNS is propagating and everything is setup, for example:
dig example.comdig www.example.comdig subdomain.example.com
In my case I found that one of them was still showing the Act01 server while the other had updated. You can keep your eye on this until it’s looking good.
ping command also works and should do the same effect and echo back the server IP to verify.
Also, while you’re at it, run the same tests in your browser, especially if you have both example.com and www.example.com that are supposed to be working with SSL certs… In my case all of the above worked but SSL didn’t so nothing worked…
Delete Files and Wrap Up on Act01
Once you have confirmed that everything has propagated and that your new server site is fully functional. Give it a very good test of this. Once confident everything is ok, you can delete your droplet and such items.
WordPress Bonus!
Although everything above was really all I needed for the domain part, and I had done everything above, my WordPress installation was only working on the index page. I had searched far and wide and the only suggestions coming back (good ones of course) were these:
- Make sure .htaccess file is ok
- Make sure folder permissions were ok (they were not in my case, but this wasn’t cause)
- etc
Here is a link to my bonus blog post on “A Rookie Admin’s Smooth Journey through a Word Press Migration” post to learn more specifics about that.