Skip to content
This repository was archived by the owner on Jan 14, 2022. It is now read-only.

Commit 839f04a

Browse files
authored
Merge pull request #17 from tootsuite/dotenv
Dotenv
2 parents 1e9358f + b85271c commit 839f04a

20 files changed

Lines changed: 136 additions & 1111 deletions

Cargo.lock

Lines changed: 80 additions & 819 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,11 @@
22
name = "ragequit"
33
description = "A blazingly fast drop-in replacement for the Mastodon streaming api server"
44
version = "0.1.0"
5-
authors = ["Julian Laubstein <contact@julianlaubstein.de>"]
5+
authors = ["Daniel Long Sockwell <daniel@codesections.com", "Julian Laubstein <contact@julianlaubstein.de>"]
66
edition = "2018"
77

88
[dependencies]
9-
actix-web = "0.7.18"
10-
structopt = "0.2.14"
119
log = "0.4.6"
12-
actix = "0.7.9"
13-
actix-redis = "0.5.1"
14-
redis-async = "0.4.4"
15-
envconfig = "0.5.0"
16-
envconfig_derive = "0.5.0"
17-
whoami = "0.4.1"
1810
futures = "0.1.26"
1911
tokio = "0.1.19"
2012
warp = "0.1.15"
@@ -25,6 +17,7 @@ serde = "1.0.90"
2517
pretty_env_logger = "0.3.0"
2618
postgres = "0.15.2"
2719
uuid = { version = "0.7", features = ["v4"] }
20+
dotenv = "0.14.0"
2821

2922
[features]
3023
default = [ "production" ]

README.md

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,32 @@
1-
# RageQuit
1+
# Mastodon Streaming Server
22
A WIP blazingly fast drop-in replacement for the Mastodon streaming api server.
33

4+
## Current status
5+
The streaming server is very much a work in progress. It is currently missing essential features including support for SSL, CORS, and separate development/production environments. However, it has reached the point where it is usable/testable in a localhost development environment and I would greatly appreciate any testing, bug reports, or other feedback you could provide.
46

7+
## Installation
8+
Installing the WIP version requires the Rust toolchain (the released version will be available as a pre-compiled binary). To install, clone this repository and run `cargo build` (to build the server) `cargo run` (to both build and run the server), or `cargo build --release` (to build the server with release optimizations).
9+
10+
## Connection to Mastodon
11+
The streaming server expects to connect to a running development version of Mastodon built off of the `master` branch. Specifically, it needs to connect to both the Postgres database (to authenticate users) and to the Redis database. You should run Mastodon in whatever way you normally do and configure the streaming server to connect to the appropriate databases.
12+
13+
## Configuring
14+
You may edit the (currently limited) configuration variables in the `.env` file. Note that, by default, this server is configured to run on port 4000. This allows for easy testing with the development version of Mastodon (which, by default, is configured to communicate with a streaming server running on `localhost:4000`). However, it also conflicts with the current/Node.js version of Mastodon's streaming server, which runs on the same port. Thus, to test this server, you should disable the other streaming server or move it to a non-conflicting port.
15+
16+
## Documentation
17+
Build documentation with `cargo doc --open`, which will build the Markdown docs and open them in your browser. Please consult those docs for a description of the code structure/organization.
18+
19+
## Running
20+
As noted above, you can run the server with `cargo run`. Alternatively, if you built the sever using `cargo build` or `cargo build --release`, you can run the executable produced in the `target/build/debug` folder or the `target/build/release` folder.
21+
22+
## Unit and (limited) integration tests
23+
You can run basic unit test of the public Server Sent Event endpoints with `cargo test`. You can run integration tests of the authenticated SSE endpoints (which require a Postgres connection) with `cargo test -- --ignored`.
24+
25+
## Manual testing
26+
Once the streaming server is running, you can also test it manually. You can test it using a browser connected to the relevant Mastodon development server. Or you can test the SSE endpoints with `curl`, PostMan, or any other HTTP client. Similarly, you can test the WebSocket endpoints with `websocat` or any other WebSocket client.
27+
28+
## Memory/CPU usage
29+
Note that memory usage is higher when running the development version of the streaming server (the one generated with `cargo run` or `cargo build`). If you are interested in measuring RAM or CPU usage, you should likely run `cargo build --release` and test the release version of the executable.
30+
31+
## Load testing
32+
I have not yet found a good way to test the streaming server under load. I have experimented with using `artillery` or other load-testing utilities. However, every utility I am familiar with or have found is built around either HTTP requests or WebSocket connections in which the client sends messages. I have not found a good solution to test receiving SSEs or WebSocket connections where the client does not transmit data after establishing the connection. If you are aware of a good way to do load testing, please let me know.

src/.env

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Uncomment any of the variables below to customize your enviornment
2+
3+
#SERVER_ADDR=
4+
#REDIS_ADDR=
5+
#POSTGRES_ADDR=

src/api/http/direct.rs

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

src/api/http/hashtag.rs

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

src/api/http/list.rs

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

src/api/http/mod.rs

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

src/api/http/public.rs

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

src/api/http/user.rs

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

0 commit comments

Comments
 (0)