Prototype implementation of IPNS-Link-gateway.
-
You can either run it locally for yourself or host it publicly.
-
This implementation redirects almost all requests for static content to an IPFS-Gateway, in order to offload itself.
-
This implementation doesn't support HTTP/2. It prefers HTTP/1.1 but can't support persistent connections. To enable HTTP2 and persistent connections, however, you can simply put a capable reverse-proxy in front. If you choose to use Caddy for this job, which helps with automatic HTTPS too, this project repository contains a ready Caddyfile. See below for a setup guide.
-
This implementation is optimized to save as much bandwidth as possible. While idle, viz. serving no requests, the IPFS node at the backend is paused with a SIGSTOP.
HELP WANTED: Port the codebase to Go. Get in touch if you're interested.
-
Download:
git clone https://github.com/ipns-link/ipns-link-gateway
-
Go to the downloaded git-repo:
cd ipns-link-gateway
-
Install the non-standard dependencies. The Heroku buildpack within this repository can be used here
bin/compile
-
Launch:
./ipns-link-gateway -a "AnyAlphanumericPassword"
-
Note the PID shown. To stop the server later, just do
kill "PID"
-
Open http://www.localhost:8080 in any browser
See available command-line options with:
./ipns-link-gateway -h
If you have IPFS Companion running, you can integrate this gateway with it as follows.
-
Run an IPFS node and thus a local IPFS Gateway at say
localhost:8080
. This is to serve static content. -
Point your IPNS-Link-gateway to this local IPFS-Gateway as :
export IPFS_SUBD_GW="http://localhost:8080" IPFS_PATH_GW="http://localhost:8080"
-
Launch your IPNS-Link-gateway at say port 8000. This is to serve dynamic content.
./ipns-link-gateway -p 8000
-
Point your IPFS Companion to http://localhost:8000 as the local gateway and activate the use of subdomains.
-
To browse an IPNS-Link-exposed site now, you just simply access the URI:
ipns://IPNSNameOfTheSite
-
Head over to your DNS provider and add to/edit your DNS records as follows:
Type Name Points to A @ Static public IPv4 of your host CNAME www @ CNAME ipns @ CNAME ipfs @ CNAME *.ipns @ CNAME *.ipfs @ -
Generate an API token for programatically editing your DNS records.
-
Test if gateway is running locally. This makes sure you've all the dependencies in place. Once tested, kill the gateway using its PID.
-
Open ports 443 (HTTPS) and 80 (HTTP) for incoming traffic.
-
Install Caddy for Linux amd64, custom built with your DNS provider's plugin. For example's sake, we shall assume your DNS provider is CloudFlare. Tip: Download the binary with
curl -Lo caddy "URL TO DOWNLOAD"
instead ofwget
. Then,chmod +x caddy
andsudo install caddy /usr/local/bin
-
Edit the crontab file within this repo by putting appropriate values for all the environment variables
-
Set up a cronjob for root as instructed in the crontab file.
-
Launch the script :
sudo /path/to/edited/crontab/file
. This would launch the gateway and caddy with progress logged incron.log
andcaddy.log
within the repo. -
In a browser, test if the gateway is accessible at your domain.
Let us know anytime you're stuck. We'll help.
- Verify account
- Edit config_var to :
URL: https://domain.tld
andPassword: AnyAlphanumericString
- Add wild-card domain:
*.domain.tld
- Manage SSL or use Cloudflare
- Refer to the EC2 UserGuide to set up your instance.
- Follow the remote hosting guide above.
If you're hosting a public gateway, please note these.
- Set up an email id with your purchased domain:
contact@domain.tld
. You might use a free email-forwarding service such as https://improvmx.com/ for this step. Also see https://improvmx.com/guides/send-emails-using-gmail/. - Setup your own payment portal or get a crypto wallet.
- Edit the html files to reflect your contact details and payment portals.
- Create an issue at the official public-gateway-registry to let us know of your gateway.
- If you receive any request to block specific sites from being accessed using your public gateway please let us know.
- You might experience some OOM (out-of-memory) related outage from time to time. Periodic restarts can avoid this for now. Hopefully, this will be fixed soon.
Email: contact@ipns.live
We cannot sustain this project and our public gateways without your support.