This article is about publishing a website to the Internet without a web server, static IP address, or centrally managed DNS name.
Once the local website is published, its is available to everyone everywhere via its Diode public address and/or via a domain name you choose. It can be accessed via the normal Internet (Web2) at <domain>.diode.link, or directly via Web3.
Think of this as a decentralized version of ngrok with some added advantages: you can publish content to a globally unique “domain” name of your choice, its free, and if you want to limit access to just a few viewers, you can do that regardless of the IP they are on.
We’ll use https://ghost.org/ and a Raspberry Pi to run the localhost website, but you can run any server you like. Enjoy.
Environment and pre-requisites:
Raspbian GNU/Linux, v10
Ghost CLI 1.14.0
Installed Ghost (or other webserver)
Step 1: Publish Your Website with the Diode Client
- SSH into your Raspberry Pi and navigate to the folder where Ghost is installed
- Run "ghost ls" to view your Ghost configuration and status
- Publish the localhost website to Web3 via the Diode network with the "publish"command
diode publish -public 2368:80
- If you see "Network is validated", it means your website is published and accessible anywhere in the world!
Step 2: View Your Website
- Copy the address to the right of "Client address:" from your SSH session
- Open a web browser on your computer and paste the address into the address bar, adding ".diode.link"
- You should be able to see your localhost website:
Step 3: Setup a Web3 Domain Name
- Dream up the perfect domain name for your new Web3 website (Blockchain Name System domain name / friendly name) — we’ll be super creative and go with “demo-web3-a” as our Web3 domain name
- In your SSH session, register the name and assign it to your client's address using:
diode bns -register demo-web3-a=0xaf48410f22a4f7171fa6fd1602dc06e19f6708fd
- After waiting for between 1 and five minutes for the BNS update to be trusted by the network (and your Diode Client!), you will be able to use any web browser to go to <friendly name>.diode.link (https://demo-web3-a.diode.link)!
That’s it! So long as your localhost webserver and the Diode Client remains running, your website will be available to anyone on the Internet. If you don’t want it to be available to _everyone_, but only to a select number of users, you can configure the Diode Fleet Contract that owns your Diode Client ID to only allow other whitelisted Clients in the Fleet Contract to access your site.