How to use a custom domain with your Akash deployment
Use CloudFlare’s free plan to enable SSL + custom domain names!
Introduction
Just a quick guide on using CloudFlare to enable custom domain names and HTTPS/SSL on your Akash deployment. This assumes that you already have a deployment running, and you have the custom uri from your Akash provider. If you have yet to deploy your application on this great decentralized cloud marketplace, there are tons of guides:
- Official Docs
- Basic personal site guide from Tom that I personally used
- Another great one
After deployment, this is what the uri looks like:
oq0p3b3t959b185mp83o5bimnk.ingress.sjc1p0.mainnet.akashian.io
Of course, asking people to type that into their browser when sharing your app is just a pain in the butt. Akash deployments also don’t come with SSL certs enabled yet, so we’ll use CloudFlare’s free DNS service for that.
Domain Name
I purchased a domain name with my own name to run my personal site. I used GoDaddy, doesn’t matter which provider you purchase from. This should be pretty simple. There are decentralized alternatives such as handshake as well, but those are slightly more complicated to setup.
Update (As of 31 Aug 2022)
We now need to specify the hostname as an environment variable as well in the Akash deploy.yml
file. See the screen capture below for an example obtained from the official docs. It should be the same as the field in ‘expose/accept’
Based on feedback from Medium user sturmenta, thanks!
CloudFlare
Step by step of how I set this up:
- Create a CloudFlare account and add your site.
2. Select Free plan if you’re a cheapo like me
3. The next page will let you setup DNS records. Make sure Type is set to CNAME, Name is @, and Target is your deployment uri.
4. You should get to the overview page on CloudFlare. Navigate to the DNS tab and you should see the CF nameservers.
5. These nameservers need to be copied to your domain provider. In GoDaddy it was pretty simple, just navigate to DNS management and choose ‘update nameservers’. For other domain providers it should be a similar process.
6. Ensure SSL is set to ‘full’ under CloudFlare SSL/TLS tab.
7. Under SSL/TLS Tab, navigate to Edge Certificates. Make sure ‘always use HTTPS’ is enabled.
8. Now you can visit your domain name and it should redirect to your Akash deployment uri with a spanking new SSL cert.
9. ??? Profit