Skip to content

Commit de8e7d5

Browse files
committed
docs: Add native & containerized instructions
1 parent b24ab8c commit de8e7d5

File tree

1 file changed

+74
-17
lines changed

1 file changed

+74
-17
lines changed

README.md

Lines changed: 74 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,11 @@ weron provides lean, fast & secure overlay networks based on WebRTC.
1818

1919
It enables you too ...
2020

21-
- **Access to nodes behind NAT**: Because weron uses WebRTC to establish connections between nodes, it can easily traverse corporate firewalls and NATs using STUN, or even use a TURN server to tunnel traffic. This can be very useful to i.e. SSH into your homelab without forwarding any ports on your router.
22-
- **Secure your home network**: By using the inbuilt interactive TLS verification and running the signaling server locally, weron can be used to secure traffic between nodes in a LAN without depending on any external infrastructure.
23-
- **Join local nodes into a cloud network**: If you run e.g. a Kubernetes cluster with nodes based on cloud instances but also want to join your on-prem nodes into it, you can use weron to create a trusted network for it.
24-
- **Write your own peer-to-peer protocols**: The simple API makes writing distributed applications with automatic reconnects, multiple datachannels etc. approachable and fun!
21+
- **Access nodes behind NAT**: Because weron uses WebRTC to establish connections between nodes, it can easily traverse corporate firewalls and NATs using STUN, or even use a TURN server to tunnel traffic. This can be very useful to for example SSH into your homelab without forwarding any ports on your router.
22+
- **Secure your home network**: Due to the relatively low overhead of WebRTC in low-latency networks, weron can be used to secure traffic between nodes in a LAN without a significant performance hit.
23+
- **Join local nodes into a cloud network**: If you run for example a Kubernetes cluster with nodes based on cloud instances but also want to join your on-prem nodes into it, you can use weron to create a trusted network.
24+
- **Bypass censorship**: The underlying WebRTC suite, which is what popular videoconferencing tools such as Zoom, Teams and Meet are built on, is hard to block on a network level, making it a valuable addition to your toolbox for bypassing state or corporate censorship.
25+
- **Write your own peer-to-peer protocols**: The simple API makes writing distributed applications with automatic reconnects, multiple datachannels etc. easy.
2526

2627
## Installation
2728

@@ -72,23 +73,73 @@ While it is possible and resonably private (in addition to TLS, connection infor
7273

7374
The signaling server can use an in-process broker with an in-memory database or Redis and PostgreSQL; for production use the latter configuration is strongly recommended, as it allows you to easily scale the signaling server horizontally. This is particularly important if you want to scale your server infrastructure across multiple continents, as intra-cloud backbones usually have lower latency than residental connections, which reduces the amount of time required to connect peers with each other.
7475

75-
First, start Redis and Postgres:
76+
<details>
77+
<summary>Expand containerized instructions</summary>
7678

7779
```shell
7880
$ sudo podman network create weron
79-
$ sudo podman run -d --name weron-postgres --network weron -e POSTGRES_HOST_AUTH_METHOD=trust -e POSTGRES_DB=weron_communities postgres
80-
$ sudo podman run -d --name weron-redis --network weron redis
81+
82+
$ sudo podman run -d --restart=always --label "io.containers.autoupdate=image" --name weron-postgres --network weron -e POSTGRES_HOST_AUTH_METHOD=trust -e POSTGRES_DB=weron_communities postgres
83+
$ sudo podman generate systemd --new weron-postgres | sudo tee /lib/systemd/system/weron-postgres.service
84+
85+
$ sudo podman run -d --restart=always --label "io.containers.autoupdate=image" --name weron-redis --network weron redis
86+
$ sudo podman generate systemd --new weron-redis | sudo tee /lib/systemd/system/weron-redis.service
87+
88+
$ sudo podman run -d --restart=always --label "io.containers.autoupdate=image" --name weron-signaler --network weron -p 1337:1337 -e DATABASE_URL='postgres://postgres@weron-postgres:5432/weron_communities?sslmode=disable' -e REDIS_URL='redis://weron-redis:6379/1' -e API_PASSWORD='myapipassword' ghcr.io/pojntfx/weron:unstable weron signaler
89+
$ sudo podman generate systemd --new weron-signaler | sudo tee /lib/systemd/system/weron-signaler.service
90+
91+
$ sudo systemctl daemon-reload
92+
93+
$ sudo systemctl enable --now weron-postgres
94+
$ sudo systemctl enable --now weron-redis
95+
$ sudo systemctl enable --now weron-signaler
96+
97+
$ sudo firewall-cmd --permanent --add-port=1337/tcp
98+
$ sudo firewall-cmd --reload
8199
```
82100

83-
Now, start the signaling server:
101+
</details>
102+
103+
<details>
104+
<summary>Expand native instructions</summary>
84105

85106
```shell
86-
$ sudo podman run -d --name weron-signaler --network weron -p 1337:1337 -e DATABASE_URL='postgres://postgres@weron-postgres:5432/weron_communities?sslmode=disable' -e REDIS_URL='redis://weron-redis:6379/1' -e API_PASSWORD='myapipassword' ghcr.io/pojntfx/weron:unstable weron signaler
107+
sudo podman run -d --restart=always --label "io.containers.autoupdate=image" --name weron-postgres -e POSTGRES_HOST_AUTH_METHOD=trust -e POSTGRES_DB=weron_communities -p 127.0.0.1:5432:5432 postgres
108+
sudo podman generate systemd --new weron-postgres | sudo tee /lib/systemd/system/weron-postgres.service
109+
110+
sudo podman run -d --restart=always --label "io.containers.autoupdate=image" --name weron-redis -p 127.0.0.1:6379:6379 redis
111+
sudo podman generate systemd --new weron-redis | sudo tee /lib/systemd/system/weron-redis.service
112+
113+
sudo tee /etc/systemd/system/weron-signaler.service<<'EOT'
114+
[Unit]
115+
Description=weron Signaling Server
116+
After=weron-postgres.service weron-redis.service
117+
118+
[Service]
119+
ExecStart=/usr/local/bin/weron signaler --verbose=7
120+
Environment="DATABASE_URL=postgres://postgres@localhost:5432/weron_communities?sslmode=disable"
121+
Environment="REDIS_URL=redis://localhost:6379/1"
122+
Environment="API_PASSWORD=myapipassword"
123+
124+
[Install]
125+
WantedBy=multi-user.target
126+
EOT
127+
128+
sudo systemctl daemon-reload
129+
130+
sudo systemctl restart weron-postgres
131+
sudo systemctl restart weron-redis
132+
sudo systemctl restart weron-signaler
133+
134+
sudo firewall-cmd --permanent --add-port=1337/tcp
135+
sudo firewall-cmd --reload
87136
```
88137

138+
</details>
139+
89140
It should now be reachable on `ws://localhost:1337/`.
90141

91-
To use it in production, put this signaling server behind a TLS-enabled reverse proxy such as [Caddy](https://caddyserver.com/) or [Traefik](https://traefik.io/). You may also either want to keep `API_PASSWORD` empty to disable the management API completely or use OpenID Connect to authenticate instead; for more information, see the [signaling server reference](#signaling-server). You can also embed the signaling server in your own application using it's [Go API](https://pkg.go.dev/github.com/pojntfx/weron@main/pkg/wrtcsgl).
142+
To use it in production, put this signaling server behind a TLS-enabled reverse proxy such as [Caddy](https://caddyserver.com/) or [Traefik](https://traefik.io/). You may also either want to keep `API_PASSWORD` empty to disable the management API completely or use OpenID Connect to authenticate instead; for more information, see the [signaling server reference](#signaling-server). You can also embed the signaling server in your own application using it's [Go API](https://pkg.go.dev/github.com/pojntfx/weron/pkg/wrtcsgl).
92143

93144
### 2. Manage Communities with `weron manager`
94145

@@ -134,10 +185,16 @@ It is also possible to delete communities using `weron delete`, which will also
134185
$ weron manager delete --community mycommunity
135186
```
136187

137-
For more information, see the [manager reference](#manager). You can also embed the manager in your own application using it's [Go API](https://pkg.go.dev/github.com/pojntfx/weron@main/pkg/wrtcmgr).
188+
For more information, see the [manager reference](#manager). You can also embed the manager in your own application using it's [Go API](https://pkg.go.dev/github.com/pojntfx/weron/pkg/wrtcmgr).
138189

139190
### 3. Test the System with `weron chat`
140191

192+
If you want to work on your self-hosted signaling server, first set the remote address:
193+
194+
```shell
195+
$ export WERON_RADDR='ws://localhost:1337/'
196+
```
197+
141198
The chat is an easy way to test if everything is working correctly. To join a chatroom, run the following:
142199

143200
```shell
@@ -158,7 +215,7 @@ user2>
158215

159216
You can now start sending and receiving messages or add new peers to your chatroom to test the network.
160217

161-
For more information, see the [chat reference](#chat). You can also embed the chat in your own application using it's [Go API](https://pkg.go.dev/github.com/pojntfx/weron@main/pkg/wrtcchat).
218+
For more information, see the [chat reference](#chat). You can also embed the chat in your own application using it's [Go API](https://pkg.go.dev/github.com/pojntfx/weron/pkg/wrtcchat).
162219

163220
### 4. Measure Latency with `weron utility latency`
164221

@@ -181,7 +238,7 @@ $ weron utility latency --community mycommunity --password mypassword --key myke
181238
^CAverage latency: 281.235µs (5 packets written) Min: 110.111µs Max: 386.12µs
182239
```
183240

184-
For more information, see the [latency measurement utility reference](#latency-measurement-utility). You can also embed the utility in your own application using it's [Go API](https://pkg.go.dev/github.com/pojntfx/weron@main/pkg/wrtcltc).
241+
For more information, see the [latency measurement utility reference](#latency-measurement-utility). You can also embed the utility in your own application using it's [Go API](https://pkg.go.dev/github.com/pojntfx/weron/pkg/wrtcltc).
185242

186243
### 5. Measure Throughput with `weron utility throughput`
187244

@@ -204,7 +261,7 @@ $ weron utility throughput --community mycommunity --password mypassword --key m
204261
^CAverage throughput: 74.295 MB/s (594.359 Mb/s) (250 MB written in 3.364971672s) Min: 64.844 MB/s Max: 103.360 MB/s
205262
```
206263

207-
For more information, see the [throughput measurement utility reference](#throughput-measurement-utility). You can also embed the utility in your own application using it's [Go API](https://pkg.go.dev/github.com/pojntfx/weron@main/pkg/wrtcthr).
264+
For more information, see the [throughput measurement utility reference](#throughput-measurement-utility). You can also embed the utility in your own application using it's [Go API](https://pkg.go.dev/github.com/pojntfx/weron/pkg/wrtcthr).
208265

209266
### 6. Create a Layer 3 (IP) Overlay Network with `weron vpn ip`
210267

@@ -240,7 +297,7 @@ PING 2001:db8::b9(2001:db8::b9) 56 data bytes
240297
rtt min/avg/max/mdev = 1.066/1.180/1.361/0.114 ms
241298
```
242299

243-
If you temporarly loose the network connection, the network topology changes etc. it will automatically reconnect. For more information and limitations on proprietary operating systems like macOS, see the [IP VPN reference](#layer-3-ip-overlay-networks). You can also embed the utility in your own application using it's [Go API](https://pkg.go.dev/github.com/pojntfx/weron@main/pkg/wrtcip).
300+
If you temporarly loose the network connection, the network topology changes etc. it will automatically reconnect. For more information and limitations on proprietary operating systems like macOS, see the [IP VPN reference](#layer-3-ip-overlay-networks). You can also embed the utility in your own application using it's [Go API](https://pkg.go.dev/github.com/pojntfx/weron/pkg/wrtcip).
244301

245302
### 7. Create a Layer 2 (Ethernet) Overlay Network with `weron vpn ethernet`
246303

@@ -289,7 +346,7 @@ PING 2001:db8::2(2001:db8::2) 56 data bytes
289346
rtt min/avg/max/mdev = 1.136/1.193/1.239/0.042 ms
290347
```
291348

292-
If you temporarly loose the network connection, the network topology changes etc. it will automatically reconnect. You can also embed the utility in your own application using it's [Go API](https://pkg.go.dev/github.com/pojntfx/weron@main/pkg/wrtceth).
349+
If you temporarly loose the network connection, the network topology changes etc. it will automatically reconnect. You can also embed the utility in your own application using it's [Go API](https://pkg.go.dev/github.com/pojntfx/weron/pkg/wrtceth).
293350

294351
### 8. Write your own protocol with `wrtcconn`
295352

@@ -328,7 +385,7 @@ for {
328385
}
329386
```
330387

331-
You can either use the [minimal adapter](https://pkg.go.dev/github.com/pojntfx/weron@main/pkg/wrtcconn#Adapter) or the [named adapter](https://pkg.go.dev/github.com/pojntfx/weron@main/pkg/wrtcconn#NamedAdapter); the latter negotiates a username between the peers, while the former does not check for duplicates. For more information, check out the [Go API](https://pkg.go.dev/github.com/pojntfx/weron@main) and take a look at the other utilities and services in the package for examples.
388+
You can either use the [minimal adapter](https://pkg.go.dev/github.com/pojntfx/weron/pkg/wrtcconn#Adapter) or the [named adapter](https://pkg.go.dev/github.com/pojntfx/weron/pkg/wrtcconn#NamedAdapter); the latter negotiates a username between the peers, while the former does not check for duplicates. For more information, check out the [Go API](https://pkg.go.dev/github.com/pojntfx/weron) and take a look at the other utilities and services in the package for examples.
332389

333390
🚀 **That's it!** We hope you enjoy using weron.
334391

0 commit comments

Comments
 (0)