Setting up hosting on DigitalOcean App Platform and DNS management on GoDaddy

Setting up hosting on DigitalOcean App Platform and DNS management on GoDaddy

Domain configuration is probably my least favourite part of launching a website. I’ve had to host an app on DigitalOcean App Platform and keep DNS management on GoDaddy a couple of times, but keep missing some steps each time and end up spending a lot of time troubleshooting what went wrong, so I decided to write this article for my forgetful self. While this article is about hosting on DigitalOcean App Platform and managing your domain on GoDaddy, the guide can be followed for other similar platform pairings.

TL;DR

  1. Add your custom domain www.yourdomain.com to your DigitalOcean App in your app settings and copy the URL of your DigitalOcean app.

  2. Delete existing/default A records from GoDaddy.

  3. Create a new "www" CNAME record that points to the URL of your DigitalOcean app you copied earlier.

  4. Set up permanent forwarding of the apex domain on GoDaddy to the "https://" of www.yourdomain.com

Step 1

The first step is to add a custom domain to your DigitalOcean app.

Click on your app and go to the Settings tab, scroll down to the Domains section of the app settings and click the Edit link at the far right. Then click on the Add Domain button.

You should add the "www" subdomain on the Add Domain form.

After typing in your custom domain and proceeding, you’re presented with a choice to either delegate your DNS management to DigitalOcean or to manage it yourself, pick the option to manage your domain yourself.

DigitalOcean App platform doesn’t provide a static IP address for apps which we would've added as an A record on GoDaddy but it provides a CNAME alias which we can map a "www" CNAME record to.

You’ll now have to update your DNS records on GoDaddy by creating a new CNAME record and pointing it to our DigitalOcean app. But before going to your GoDaddy dashboard copy the URL of your DigitalOcean app.

Step 2

Head over to your GoDaddy dashboard to update DNS records.

First, delete existing or default A record(s) on your GoDaddy.

Then create a new "www" CNAME record that points to your DigitalOcean App (the URL you copied earlier). If there was an existing "www" CNAME record, you can edit it to point to your app. Click on Save to update your DNS records.

Step 3

After deleting the default A record(s) and adding a new "www" CNAME record, the next thing is to set up a permanent forwarding of your apex domain (example.com) to the "https://" of the "www" subdomain (https://www.example.com).

After saving, go back to your DigitalOcean dashboard where you copied your app URL and finally click on Add Domain.

If you go back to the Domains section of your app Settings tab after a while your newly added domain should now be active.