Skip to content

Commit

Permalink
Update cjdns node installation process
Browse files Browse the repository at this point in the history
  • Loading branch information
cjdelisle committed Oct 30, 2024
1 parent 7cf4270 commit befc65e
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 22 deletions.
1 change: 1 addition & 0 deletions custom_theme/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"></script>
<script src="{{ "main.js"|url }}"></script>
<script src="{{ "fonts.js"|url }}"></script>
{%- endblock %}

Expand Down
10 changes: 10 additions & 0 deletions custom_theme/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
$(document).ready(function() {
var KEY = '?peer_id=';
var idx = window.location.href.indexOf(KEY);
if (idx > -1) {
var peerId = window.location.href.slice(window.location.href.indexOf(KEY) + KEY.length);
$('.cjdns-peer-id').text(peerId);
$('.cjdns-peer-id-missing').css({ display: 'none' });
$('.cjdns-peer-id-has').css({ display: 'inline' });
}
});
42 changes: 20 additions & 22 deletions docs/infra/cjdns-node.md
Original file line number Diff line number Diff line change
@@ -1,42 +1,40 @@
# Setup a Cjdns Node
This guide will help you set up a cjdns node on a server.

The easiest way to get a cjdns node installed is using [cjdns.sh](https://github.com/cjdelisle/cjdns.sh).

## Requirements
A server running debian based Linux (preferably Ubuntu 22.04) with docker installed
A server running debian based Linux (preferably Ubuntu 22.04).

## Steps

* Create a data directory where the server configuration will be stored.
* Determine your *Peer ID*.
<span class="cjdns-peer-id-has" style="display:none">Your Peer ID is <code class="cjdns-peer-id">MISSING</code></span>
<span class="cjdns-peer-id-missing">To get your Peer ID, first register your cjdns node on the PKT Dashboard.</span>

```
mkdir vpn_data
```
* Install `cjdns.sh`

<code>
curl https://pkt.cash/special/cjdns/cjdns.sh | CJDNS_PEERID=<span class="cjdns-peer-id">&lt;peer-id-goes-here&gt;</span> CJDNS_ADMIN_PORT=11234 CJDNS_TUN=1 sh
</code>

* Get the latest docker image
* Check if you have peers working

```
docker pull pkteer/pkt-server
cjdnstool peers show
```
* Configure the server by running the following command:
* Make sure your firewall is open. Port 3478 must be accessible from the public internet.
```
docker run -it --rm -v $(pwd)/vpn_data:/data pkteer/pkt-server /configure.sh --novpn
iptables-save
nft list ruleset
```
The configure process will create: `* a cjdroute.conf at data/cjdroute.conf * PKT wallet at data/pktwallet/pkt/wallet.db * store the wallet's seed phrase at data/pktwallet/pkt/seed.txt`
configure.sh can take the following flags: `* --no-vpn:` To configure the server without setting up the VPN server `* --with-pktd:` To configure the server with a local PKT daemon `* --pktd-passwd= :` To set a password for the PKT daemon
## Different public port
Alternatively you can edit the __config.json__ file manually.
If you can't expose port `3478` to the public, you can change the port by specifying `CJDNS_PORT=<port number>` when installing cjdns.
## More information
!!! warning "NOTE"
Make sure to safely store your seed phrase in order to be able to import your wallet on your computer. And delete the __seed.txt__ file after.
* Run the server by running the following commands:
```
./vpn_data/start.sh
```
This will start the server and may expose the following ports:
`* cjdns port set from cjdroute.conf * cjdns admin rpc port set from cjdroute.conf (default 11234) * 8099 for anodevpn server * 5201 for iperf3 * 64764` for pktd
To learn more, check out [https://github.com/cjdelisle/cjdns.sh](https://github.com/cjdelisle/cjdns.sh)

0 comments on commit befc65e

Please sign in to comment.