{"id":13520294,"url":"https://github.com/mastodon/flodgatt","last_synced_at":"2025-09-27T05:30:47.849Z","repository":{"id":41470427,"uuid":"169712053","full_name":"mastodon/flodgatt","owner":"mastodon","description":"A blazingly fast drop-in replacement for the Mastodon streaming API server","archived":true,"fork":false,"pushed_at":"2020-05-07T20:44:03.000Z","size":796,"stargazers_count":86,"open_issues_count":11,"forks_count":6,"subscribers_count":11,"default_branch":"master","last_synced_at":"2024-05-23T04:04:59.844Z","etag":null,"topics":["mastodon","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mastodon.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"open_collective":"mastodon"}},"created_at":"2019-02-08T09:35:26.000Z","updated_at":"2023-12-11T15:54:30.000Z","dependencies_parsed_at":"2022-09-12T02:11:15.244Z","dependency_job_id":null,"html_url":"https://github.com/mastodon/flodgatt","commit_stats":null,"previous_names":[],"tags_count":27,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mastodon%2Fflodgatt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mastodon%2Fflodgatt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mastodon%2Fflodgatt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mastodon%2Fflodgatt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mastodon","download_url":"https://codeload.github.com/mastodon/flodgatt/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219871882,"owners_count":16554465,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["mastodon","rust"],"created_at":"2024-08-01T05:02:16.867Z","updated_at":"2025-09-27T05:30:42.530Z","avatar_url":"https://github.com/mastodon.png","language":"Rust","funding_links":["https://opencollective.com/mastodon"],"categories":["Rust"],"sub_categories":[],"readme":"Flóðgátt\n========\n\n[![Build Status](https://travis-ci.com/tootsuite/flodgatt.svg?branch=master)](https://travis-ci.com/tootsuite/flodgatt)\n\nA blazingly fast drop-in replacement for the Mastodon streaming API server.\n\n\u003e **Current status:** This server is currently a **work in progress**. However, it is now testable\n\u003e and, if configured properly, would theoretically be usable in production—though production use\n\u003e is not advisable until we have completed further testing. I would greatly appreciate any\n\u003e testing, bug reports, or other feedback you could provide.\n\n## Installation\n\nStarting from version 0.3, Flóðgátt can be installed for Linux by installing the pre-built\nbinaries released on GitHub.  Simply download the binary (extracting it if necessary), set it to\nexecutable (`chmod +x`) and run it.  Note that you will likely need to configure the Postgres\nconnection before you can successfully connect.\n\n### Configuration Examples\n\nIf you are running Mastodon with its [standard Development\nsettings](https://docs.joinmastodon.org/dev/setup/), then you should be able to run `flodgatt`\nwithout any configuration.  (You will, of course, need to ensure that the Node streaming server is\nnot running at the same time as Flodgatt.  If you normally run the development servers with\n`foreman start`, you should edit the `Procfile.dev` file to remove the line that starts the Node\nserver.  To run `flodgatt` with a production instance of Mastodon, you should ensure that the\n`mastodon-streaming` systemd service is not running.)\n\nYou will likely wish to use the environmental variable `RUST_LOG=warn` to enable debugging warnings.\n\nIf you are running Mastodon with its standard Production settings and connect to Postgres with the\nIdent authentication method, then you can use the following procedure to launch Flodgatt.\n * Change to the user that satisfies the Ident requirement (typically \"mastodon\" with default\n   settints).  For example: `su mastodon`\n * Use environmental variables to set the user, database, and host names.  For example:\n   `DB_NAME=\"mastodon_production\" DB_USER=\"mastodon\" DB_HOST=\"/var/run/postgresql\" RUST_LOG=warn\n   flodgatt`\n \nIf you have any difficulty connecting, note that, if run with `RUST_LOG=warn` Flodgatt will print\nboth the environmental variables it received and the parsed configuration variables it generated\nfrom those environmental variables.  You can use this info to debug the connection.\n\nFlóðgátt is tested against the [default Mastodon nginx config](https://github.com/tootsuite/mastodon/blob/master/dist/nginx.conf) and treats that as the known-good configuration.\n\n### Advanced Configuration\n\nThe streaming server will eventually use the same environment variables as the rest of Mastodon,\nand currently uses a subset of those variables.  Supported variables are listed in\n`/src/config.rs`.  You can provide any supported environmental variable to Flóðgátt at runtime or\nthrough a `.env` file.\n\nNote that the default values for the `postgres` connection do not correspond to those typically\nused in production.  Thus, you will need to configure the connection either env vars or a `.env`\nfile if you intend to connect Flóðgátt to a production database.\n\nIf you set the `SOCKET` environmental variable, you must set the nginx `proxy_pass` variable to\nthe same socket (with the file prefixed by `http://unix:`).\n\nAdditionally, note that connecting Flóðgátt to Postgres with the `ident` method requires running\nFlóðgátt as the user who owns the mastodon database (typically `mastodon`).\n\n## Building from source\n\nInstalling from source requires the Rust toolchain. Clone this repository and run `cargo build`\n(to build the server), or `cargo build --release` (to build the server with release\noptimizations).\n\n### Running the built server\n\nYou can run the server with `cargo run`. Alternatively, if you built the sever using `cargo build`\nor `cargo build --release`, you can run the executable produced in the `target/build/debug` folder\nor the `target/build/release` folder.\n\n### Building documentation \n\nBuild documentation with `cargo doc --open`, which will build the Markdown docs and open them in\nyour browser. Please consult those docs for a detailed description of the code\nstructure/organization. The documentation also contains additional notes about data flow and\noptions for configuration.\n\n### Testing\n\nYou can run basic unit tests with `cargo test`.\n\n### Manual testing\n\nOnce the streaming server is running, you can also test it manually. You can test it using a\nbrowser connected to the relevant Mastodon development server. Or you can test the SSE endpoints\nwith `curl`, PostMan, or any other HTTP client. Similarly, you can test the WebSocket endpoints\nwith `websocat` or any other WebSocket client.\n\n### Memory/CPU usage\n\nNote that memory usage is higher when running the development version of the streaming server (the\none generated with `cargo run` or `cargo build`). If you are interested in measuring RAM or CPU\nusage, you should likely run `cargo build --release` and test the release version of the\nexecutable.\n\n### Load testing\n\nI have not yet found a good way to test the streaming server under load. I have experimented with\nusing `artillery` or other load-testing utilities. However, every utility I am familiar with or\nhave found is built around either HTTP requests or WebSocket connections in which the client sends\nmessages. I have not found a good solution to test receiving SSEs or WebSocket connections where\nthe client does not transmit data after establishing the connection. If you are aware of a good\nway to do load testing, please let me know.\n\n\n## Contributing\n\nIssues and pull requests are welcome. Flóðgátt is governed by the same Code of Conduct as Mastodon\nas a whole.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmastodon%2Fflodgatt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmastodon%2Fflodgatt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmastodon%2Fflodgatt/lists"}