A blazingly fast drop-in replacement for the Mastodon streaming API server
Go to file
Daniel Sockwell 161da3f456 Add aditional Postgres config options
This commit adds several aditional Postgres config options, such
as PORT, USER, DB_NAME and similar.  It also relocates the .env
file so that it will be picked up even if flodgat isn't run from
the src/ directory.
2019-08-27 18:31:56 -04:00
.github Create FUNDING.yml 2019-07-10 23:21:18 +02:00
src Add aditional Postgres config options 2019-08-27 18:31:56 -04:00
tests Code reorganization 2019-07-08 07:31:42 -04:00
.env Add aditional Postgres config options 2019-08-27 18:31:56 -04:00
.gitignore Initial project files 2019-02-11 09:45:14 +01:00
.travis.yml Add Travis CI 2019-07-10 23:17:40 +02:00
Cargo.lock Update documentation and restructure code 2019-07-08 15:21:02 -04:00
Cargo.toml Update documentation and restructure code 2019-07-08 15:21:02 -04:00
LICENSE Initial commit 2019-02-08 10:35:26 +01:00
README.md Change name of project in README.md (#25) 2019-07-10 17:37:41 -04:00

README.md

Flóðgátt

Build Status

A blazingly fast drop-in replacement for the Mastodon streaming API server.

Current status: This server is currently a work in progress. However, it is now testable and, if configured properly, would theoretically be usable in production—though production use is not advisable until we have completed further testing. I would greatly appreciate any testing, bug reports, or other feedback you could provide.

Installation

Installing from source requires the Rust toolchain. Clone this repository and run cargo build (to build the server), or cargo build --release (to build the server with release optimizations).

Configuring

The streaming server uses the same environment variables as the rest of Mastodon, which can either be passed to the process the standard way or through a .env file.

Running

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.

Documentation

Build documentation with cargo doc --open, which will build the Markdown docs and open them in your browser. Please consult those docs for a detailed description of the code structure/organization. The documentation also contains additional notes about data flow and options for configuration.

Unit and (limited) integration tests

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 PostgreSQL connection) with cargo test -- --ignored.

Manual testing

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.

Memory/CPU usage

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.

Load testing

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.