Skip to content

Commit d3f473e

Browse files
authored
Merge pull request #428 from bitcoin-dev-project/port-binding
Added instructions for connecting to local nodes
2 parents 7e9989c + 548dbf2 commit d3f473e

File tree

2 files changed

+89
-0
lines changed

2 files changed

+89
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,6 @@ Monitor and analyze the emergent behaviors of Bitcoin networks.
2424
- [Data Collection](https://github.com/bitcoin-dev-project/warnet/blob/main/docs/data.md)
2525
- [Monitoring](https://github.com/bitcoin-dev-project/warnet/blob/main/docs/monitoring.md)
2626
- [Lightning Network](https://github.com/bitcoin-dev-project/warnet/blob/main/docs/lightning.md)
27+
- [Connecting to local nodes](https://github.com/bitcoin-dev-project/warnet/blob/main/docs/connecting-local-nodes.md)
2728

2829
![warnet-art](https://raw.githubusercontent.com/bitcoin-dev-project/warnet/main/docs/machines.webp)

docs/connecting-local-nodes.md

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# Connecting Local Nodes
2+
3+
## Connections from cluster into local machine
4+
5+
[Telepresence](https://github.com/telepresenceio/telepresence) can be used to make a connection from the cluster to your local machine. Telepresence is designed to intercept cluster commmunication and forward it to your local machine so we will have to install a dummy pod and service to receive the traffic that will get forwarded.
6+
7+
### Run Warnet network
8+
9+
```shell
10+
warcli cluster deploy
11+
warcli network start
12+
```
13+
14+
### Install Telepresence
15+
16+
Install the open source version of Telepresence.
17+
18+
```shell
19+
# find path to most recent release for your architecture and OS
20+
# https://github.com/telepresenceio/telepresence/releases
21+
wget [URL of release]
22+
# assuming AMD64 linux binary (replace as needed)
23+
sudo mv telepresence-linux-amd64 /usr/local/bin/telepresence
24+
sudo chmod +x /usr/local/bin/telepresence
25+
telepresence version
26+
```
27+
28+
If on Mac OS you may need to remove telepresence from quarantine
29+
30+
```shell
31+
sudo xattr -d com.apple.quarantine /usr/local/bin/telepresence
32+
```
33+
34+
### Connect Telepresence to your cluster
35+
36+
```shell
37+
telepresence helm install
38+
telepresence connect
39+
```
40+
41+
`telepresence version` should now show something like this:
42+
43+
```shell
44+
OSS Client : v2.19.1
45+
OSS Root Daemon : v2.19.1
46+
OSS User Daemon : v2.19.1
47+
OSS Traffic Manager: v2.19.1
48+
Traffic Agent : docker.io/datawire/tel2:2.19.1
49+
```
50+
51+
### Run a dummy pod and service to intercept
52+
53+
In this example we are installing a nginx pod but any image should work as the network traffic will not actually arrive at this pod and will instead be redirected to your local machine.
54+
55+
```shell
56+
# Image here can be anything. Just picking a popular image.
57+
kubectl create deploy local-bitcoind --image=registry.k8s.io/nginx
58+
kubectl expose deploy local-bitcoind --port 18444 --target-port 18444
59+
```
60+
61+
### Instruct Telepresence to intercept traffic to the dummy pod
62+
63+
The intercept command starts the process that will recieve the traffic. In this case, bitcoind process.
64+
65+
```shell
66+
mkdir /tmp/connect
67+
# Assumes you have bitcoind installed and available on the PATH
68+
telepresence intercept local-bitcoind --port 18444 -- bitcoind --regtest --datadir=/tmp/connect
69+
```
70+
71+
### Connect to local bitcoind from cluster
72+
73+
```shell
74+
warcli bitcoin rpc 0 addnode "local-bitcoind:18444" "onetry"
75+
# Check that the local node was added
76+
warcli bitcoin rpc 0 getpeerinfo
77+
```
78+
79+
### Disconnect and remove Telepresence
80+
81+
```shell
82+
# Disconnect from the cluster
83+
telepresence quit -s
84+
# Remove Telepresence from the cluster
85+
telepresent helm uninstall
86+
# Remove Telepresence from your computer
87+
sudo rm /usr/local/bin/telepresence
88+
```

0 commit comments

Comments
 (0)