0
0
Fork 0
mirror of https://github.com/matrix-org/dendrite synced 2024-10-31 04:59:07 +01:00
dendrite/cmd/dendrite-demo-pinecone
0x1a8510f2 46902e5766
Take advantage of changes in recent Go versions (#3361)
Given that #2714 wasn't merged but we are now at a minimum supported Go
version of 1.20 (soon to be 1.21), I wanted to carry over some of the
changes. Namely:
- Fix the log typo
- Simplify build constraints for unix
- Use stdlib atomic package

### Pull Request Checklist

<!-- Please read
https://matrix-org.github.io/dendrite/development/contributing before
submitting your pull request -->

* [x] I have added Go unit tests or [Complement integration
tests](https://github.com/matrix-org/complement) for this PR _or_ I have
justified why this PR doesn't need tests
* [x] Pull request includes a [sign off below using a legally
identifiable
name](https://matrix-org.github.io/dendrite/development/contributing#sign-off)
_or_ I have already signed off privately

Signed-off-by: `0x1a8510f2 <admin@0x1a8510f2.space>`

---------

Co-authored-by: devonh <devon.dmytro@gmail.com>
2024-05-01 00:38:36 +00:00
..
conduit Refactor conduit type from pinecone demo into its own package 2023-02-01 13:41:37 -07:00
conn Move fedclient interface over to gmsl (#3061) 2023-04-24 16:23:25 +00:00
defaults refactor: update GMSL (#3058) 2023-04-19 15:50:33 +01:00
embed Update Pinecone P2P demo 2022-03-30 15:01:22 +01:00
monolith Use IsBlacklistedOrBackingOff to determine if we should try to fetch devices (#3254) 2023-11-09 08:43:27 +01:00
relay Take advantage of changes in recent Go versions (#3361) 2024-05-01 00:38:36 +00:00
rooms Move fedclient interface over to gmsl (#3061) 2023-04-24 16:23:25 +00:00
users Move fedclient interface over to gmsl (#3061) 2023-04-24 16:23:25 +00:00
main.go refactor: update GMSL (#3058) 2023-04-19 15:50:33 +01:00
README.md Initial Store & Forward Implementation (#2917) 2023-01-23 17:55:12 +00:00

Pinecone Demo

This is the Dendrite Pinecone demo! It's easy to get started.

To run the homeserver, start at the root of the Dendrite repository and run:

go run ./cmd/dendrite-demo-pinecone

To connect to the static Pinecone peer used by the mobile demos run:

go run ./cmd/dendrite-demo-pinecone -peer wss://pinecone.matrix.org/public

The following command line arguments are accepted:

  • -peer tcp://a.b.c.d:e to specify a static Pinecone peer to connect to - you will need to supply this if you do not have another Pinecone node on your network
  • -port 12345 to specify a port to listen on for client connections

Then point your favourite Matrix client to the homeserver URLhttp://localhost:8008 (or whichever -port you specified), create an account and log in.

If your peering connection is operational then you should see a Connected TCP: line in the log output. If not then try a different peer.

Once logged in, you should be able to open the room directory or join a room by its ID.

Store & Forward Relays

To test out the store & forward relay functionality, you need a minimum of 3 instances. One instance will act as the relay, and the other two instances will be the users trying to communicate. Then you can send messages between the two nodes and watch as the relay is used if the receiving node is offline.

Launching the Nodes

Relay Server:

go run cmd/dendrite-demo-pinecone/main.go -dir relay/ -listen "[::]:49000"

Node 1:

go run cmd/dendrite-demo-pinecone/main.go -dir node-1/ -peer "[::]:49000" -port 8007

Node 2:

go run cmd/dendrite-demo-pinecone/main.go -dir node-2/ -peer "[::]:49000" -port 8009

Database Setup

At the moment, the database must be manually configured. For both Node 1 and Node 2 add the following entries to their respective relay_server table in the federationapi database:

server_name: {node_1_public_key}, relay_server_name: {relay_public_key}
server_name: {node_2_public_key}, relay_server_name: {relay_public_key}

After editing the database you will need to relaunch the nodes for the changes to be picked up by dendrite.

Testing

Now you can run two separate instances of element and connect them to Node 1 and Node 2. You can shutdown one of the nodes and continue sending messages. If you wait long enough, the message will be sent to the relay server. (you can see this in the log output of the relay server)