Infrastructure Layout

This is the current infrastructure layout as of 02/11/2023.

Here's a breakdown of the current infrastructure. Some of this will be technical, but I will try to explain it as best I can for everybody.

Diagram of Mindly.Social server infrastructure

Cloudflare

We utilize Cloudflare for our DNS (Domain Name Service) and WAF (Web Application Firewall), we were using Cloudflare for caching, but have that disabled currently. All external traffic passes through Cloudflare to our nginx frontend server.

nginx frontend

Our nginx frontend server handles all of the communication between the users and the actual web servers (Web/Streaming). We handle all of the caching on this server for our non-media content (i.e. everything that isn't a user uploaded image, audio, or video file).

Web (Puma)/Streaming(NodeJS)

These servers handle all of the actual website that users see and interact with. The "Web" (Puma) portion of these servers are using software called puma which loads the "body" of the website for lack of a better term, this is the page layout, CSS styling (theme), and other parts of the site that usually don't change once you're on the page. The "Streaming" (NodeJS) portion of these servers handle all of the data that is being updated and changing like the posts that keep loading and scrolling for you, the user data like names and avatars, and other things like the hashtags and such. These need to talk to the database servers to grab this information.

PostgreSQL/Redis

These are the database servers that store all of the post, user, settings, and other unique data for the Mastodon server. PostgreSQL is used for saving any data that needs to be saved, this would be things like posts and user accounts. Redis is used for saving "temporary" data, these are things like the current posts on your Home timeline and trending hashtags, the data for these things is saved in PostgreSQL for long term, but Redis is used to access data that's needed right now so it's much faster but at the expense of not being very resilient. Redis stores a lot of the data in RAM and only writes to the disk during certain intervals, this ensures fast performance but if power is lost or something breaks, any data in RAM is lost. Normally this would be bad, but since anything important is saved in the PostgreSQL database the Redis database can be rebuilt if needed.

ElasticSearch

This server is used for searching for plaintext words or phrases, this isn't used to search for usernames and hashtags (those are native in Mastodon and don't need a separate service). ElasticSearch is limited to only searching posts that your account has interacted with such as boosts, favorites, bookmarks, replies, and your own posts themselves.

Sidekiq

Sidekiq is the application that processes all of the "jobs" on a Mastodon server. These "jobs" are every action your server performs including sending e-mail, creating posts, pulling posts for users to view, uploading media, updating profiles, setting filters, cleaning up the database, and so many more actions. Basically, if something happens on your server or on a server your server knows about, there's most likely a Sidekiq job for it.

Backblaze B2

The Backblaze B2 service handles all of our user media storage, the technical term is "object storage" but most know it as "cloud storage". Any file uploaded by users (profile header, user avatar, photos, audio, and video) are uploaded to Backblaze B2 and served from there (using Cloudflare as a proxy for faster access).

LibreTranslate

We have a separate server that handles our translation feature. It's not the best solution, but it's free, open source, and we can host it ourselves so we opted to use it instead of a paid commercial service. Whenever you see a link to translate a post in a different language, it uses this server to do that. NOTE: If the post is marked as "English" by the user but the actual language is different, the translate feature does not appear.