Quick Start / Demo
Thanks for your interest in IPNS-Link. Welcome and Happy Hosting
Let's get going. Feel free to report issues with this tutorial here.
Table of Contents
Aim
Expose local web-server running at, say, port 8000 with ipns-link.
Steps
Install ipns-link
git clone https://github.com/ipns-link/ipns-link
cd ipns-linkIf you have sudo privilege,
sudo install ipns-link /usr/local/bin/Otherwise,
mkdir -p ~/.bin
cp ipns-link ~/.bin
export PATH="${PATH}":"${HOME}"/.binAlso put the last command in your .bashrc file.
Initialize
ipns-link initThis asks for your favorite text-editor. Provide the corresponding command or absolute path to the executable when prompted.
Note: You can always change the editor with ipns-link config.
Launch the daemon
ipns-link daemonGenerate key
Let's now generate the Origin's/service's keypair that will later expose our Origin. Because the key is hard to remember, we must give it a human-friendly name, e.g. my-site.
ipns-link gen my-siteExpose our server
There are two ways to do this:
-
Edit the config specific to the key named
my-sitewithipns-link config my-site
and put
local.endpoint: "http://localhost:8000". Then, exposemy-sitesimply asipns-link expose my-site
-
Or, you can simply do
ipns-link expose my-site localhost:8000
If everything goes alright, our site should be accessible using any IPNS-Link Gateway within a few minutes. Try the URL shown at the screen, for example. You can even grab the /ipns/<key> part from the URL and use any good old IPFS-gateway, e.g. https://ipfs.io/ipns/<key>/. It would redirect the browser to an IPNS-Link Gateway.
Note: If you wanna expose localhost:80 instead, just do ipns-link expose my-site, because that endpoint is the default endpoint.
Monitor
You can check the list of exposed servers anytime using
ipns-link exposedCheck on the daemon anytime using
ipns-link logUndo expose if needed
If we need to take our exposed site offline, simply
ipns-link hide my-siteThis would only hide my-site and not any other site exposed by the daemon.
Shutdown daemon when done
When you need to shutdown everything, just
ipns-link quit