Skip to content
Mark Nadal edited this page Sep 2, 2021 · 4 revisions

Host a GunDB Relay Peer on your Raspberry Pi! Even from home!

This guide assumes the use of a Raspberry Pi running Raspbian, but should be adaptable to any Linux system.

Setup

As the pi user, here is a simple manual example installation:

mkdir -vp ~pi/gun-peer
cd ~pi/gun-peer
npm install "https://github.com/amark/gun.git" --save
cd node_modules/gun
npm start

Reference this gist for automatic setup of GunDB with systemctl service creation.

Exposing to the Public Internet

If you are behind a NAT, follow along below for some options on how to expose the service publicly.

Static Local IP

It is important that the device have a static local IP like 192.168.0.50 rather than to be assigned a random address lease with DHCP on boot so the router can consistently forward traffic. To set a static IP either configure the network configuration in the Pi or use the router to specify DHCP Reservation for the Pi's MAC address so the router always gives it the same IP.

Port Forwarding

Port forwarding is a process of configuring the router to forward inbound traffic to a specific device and port on your local network. Log into your home router as admin and create a port forward for TCP 8765 to TCP 8765 of the IP address of the machine hosting your Gun instance (you can run ip addr in terminal on the machine to see your IP).

For more specific instruction, reference the noip.com's tutorial article or search for something like "Port Forwarding Router Tutorial"

Port Forwarding with UPnP

To port forward with UPnP automatically, we can use miniupnpc (replace 192.168.0.50 with your Pi address):

sudo apt update 
sudo apt install miniupnpc
upnpc -e "GunDB Relay Peer" -a 192.168.0.50 8765 8765

Dynamic DNS

Dynamic DNS provides a convenient domain that is constantly updated to your latest public IP which is very likely to change in a residential ISP setting. Dynamic DNS can be set up in any of several ways. Here are some references:

This wiki is where all the GUN website documentation comes from.

You can read it here or on the website, but the website has some special features like rendering some markdown extensions to create interactive coding tutorials.

Please feel free to improve the docs itself, we need contributions!

Clone this wiki locally