Cloudflare and Fleek make ENS+IPFS site deployment as easy as ever!

This post was originally published on this site

makoto_inoue

Feb 6 · 3 min read

Now that Cloudflare is hosting eth.link, we’re demonstrating our confidence in the new infrastructure and “eating our own dogfood” by deploying the ENS app on it at https://app.ens.eth.link. Here is a quick guide so that you can also deploy your dapp into ENS+IPFS.

  1. Turn our App into Single Page App
  2. Transfer controller ownership to Fleek
  3. Set up the SSL certificate

1.Turn our App into Single Page App(SPA)

One caveat of deploying SPA into IPFS is that IPFS doesn’t provide dynamic routing so /swap URL only works if you have asset under the pass.

The way to workaround is to use HashRouter (#) convention as you can see in Uniswap

Image for post

In our dapp, we make it configurable to choose depending on the configuration like this.

Image for post

2. Setup Continuous Integration(CI) on Fleek and transfer the controller

Fleek makes it easy to build and integrate privacy, encryption, and p2p functionality into your sites, web & native apps. They not natively integrate with IPFS but also set new IPFS contenthash into ENS as you merge your PR into master.

To allow Fleek to update your ENS contenthash record, you have to “Set Fleek as controller”.

if you don’t own the ENS name you want to set IPFS contenthash, then you have to ask the owner to set the controller manually from our ENS app as described in the technical doc.

It is amazing that Fleek pays the gas fee every time it updates the contenthash on ENS.

3. Set up SSL certificate (optional)

If you deploy your IPFS site to a second level ENS name (such as ens.eth), you don’t have to do anything. We already have *.eth wildcard SSL certificate set up.

If you manually update a contenthash on your subdomain, you shouldn’t have to do anything either as our App will request Cloudflare to create a new certificate for each subdomain. For those subdomains which had contenthash prior to Cloudflare migration, we ran a batch script to request the certificates so you don’t have to do in most of the cases. If it’s missed out any, then you have to do the following by yourself.

When you let Fleek (or any other way which doesn’t use our ENS app) to set a contenthash on a subdomain, then you need to click “Request SSL certificate” button from ENS app page. It shouldn’t take more than 30 seconds to create a new SSL certificate.

Image for post

On the back of it, our site sends PUT request tohttps://eth.link/names/{subdomain.yourdomain.eth}.link which creates a certificate if the given domain name exists and the contenthash is set. If you need to automate the process by yourself, you can do that, too.

This is it! Thanks to the effort of our partners such as Cloudflare and fleek, deploying ENS+IPFS site is as simple as ever!

Image for post

Leave a Comment

%d bloggers like this: