Skip to content

Commit dff9c08

Browse files
authored
Merge pull request #2 from sorki/srk/readme
README
2 parents 9b2cbd3 + a636df9 commit dff9c08

File tree

4 files changed

+122
-104
lines changed

4 files changed

+122
-104
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Version [0.1.5.1](https://github.com/sorki/haskell-zre/compare/0.1.5.0...0.1.5.1) (2023-11-28)
22

33
* Fix missing `void` import for GHC9.6.3
4+
* Allow `binary >= 0.8`
45

56
# Version [0.1.5.0](https://github.com/sorki/haskell-zre/compare/0.1.4.0...0.1.5.0) (2022-02-28)
67

README.md

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
# zre
2+
3+
[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/sorki/haskell-zre/ci.yaml?branch=master)](https://github.com/sorki/haskell-zre/actions/workflows/ci.yaml)
4+
[![Hackage version](https://img.shields.io/hackage/v/zre.svg?color=success)](https://hackage.haskell.org/package/zre)
5+
[![Dependencies](https://img.shields.io/hackage-deps/v/zre?label=Dependencies)](https://packdeps.haskellers.com/feed?needle=zre)
6+
7+
ZRE protocol implementation https://rfc.zeromq.org/spec:36/ZRE/
8+
9+
Peer-to-peer local area networking with reliable group messaging
10+
and automatic peer discovery.
11+
12+
## Usage
13+
14+
Dependencies:
15+
16+
```
17+
zeromq4
18+
```
19+
20+
Clone and test
21+
22+
```sh
23+
git clone https://github.com/sorki/haskell-zre/
24+
cd haskell-zre
25+
nix-build
26+
./result/bin/zre
27+
# in another terminal or networked computer
28+
./result/bin/zre
29+
```
30+
31+
Two zre peers should find each other and be able to send message between each other.
32+
Firewall needs to allow traffic on UDP port 5670 and TCP port range 41000-41100.
33+
Application picks random port from this range and advertises it to network.
34+
35+
## Applications
36+
37+
Few applications are provided to get you started:
38+
39+
- zre - interact and dump events
40+
- zrecat <group> - cat messages for group
41+
42+
These can be installed locally using `pkgs.haskellPackage.zre`.
43+
44+
Try running multiple copies of `zre` and `zrecat` on
45+
the same computer or computers on the local network
46+
47+
```sh
48+
zre
49+
# another terminal
50+
zrecat test
51+
# now in original terminal you can join testgroup with
52+
> /join test
53+
# or send messages to it
54+
> /shout test msg
55+
```
56+
57+
Send uptime periodically to uptime group
58+
59+
```sh
60+
( while true; do uptime; sleep 1; done ) | zrecat uptime
61+
```
62+
63+
Cat file to group
64+
65+
```sh
66+
cat /etc/os-release | zrecat test
67+
```
68+
69+
Interact manually
70+
71+
```sh
72+
zre
73+
# in zre shell following commands are supported:
74+
> /join time
75+
> /shout time test!
76+
> /leave time
77+
> /join uptime
78+
> /whisper <uuid> message
79+
```
80+
81+
## ZGossip
82+
83+
Implementation of gossip protocol is included in form of key value TTL server.
84+
This allows connecting peers from different networks (or subnets) not reachable via multicast
85+
beacon. This service requires TCP port 31337 and can be started with `zgossip-server` binary.
86+
87+
Run server
88+
89+
```sh
90+
zgossip_server
91+
```
92+
93+
Pass gossip endpoint to apps with
94+
95+
```sh
96+
zre -g <gossip_ip>:31337
97+
```
98+
99+
## Configuration
100+
101+
ZRE applications using `runZre` will automatically try to load configuration
102+
file if `ZRECFG` environment variable points to it. See `zre.conf` for configuration
103+
example::
104+
105+
```sh
106+
ZRECFG=./zre.conf zrecat test
107+
```
108+
109+
To be able to use one config for multiple apps and still be able to distinguish between
110+
them you can also set `ZRENAME` environment variable which overrides name
111+
from config or default config if `ZRECFG` is not used::
112+
113+
```sh
114+
ZRENAME=zrenode1 zrecat test
115+
```
116+
117+
## Demos
118+
119+
* https://asciinema.org/a/106340

README.rst

Lines changed: 0 additions & 102 deletions
This file was deleted.

zre.cabal

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ build-type: Simple
1717
cabal-version: 2.0
1818
extra-source-files:
1919
CHANGELOG.md
20-
README.rst
20+
README.md
2121
zre.conf
2222

2323
flag examples
@@ -57,7 +57,7 @@ library
5757
, network-bsd ^>= 2.8
5858
, network-info ^>= 0.2
5959
, network-multicast ^>= 0.3
60-
, binary ^>= 0.8
60+
, binary >= 0.8
6161
, bytestring
6262
, containers
6363
, directory

0 commit comments

Comments
 (0)