Scripts2026年4月14日·1 分钟阅读

Mastodon — The Flagship Federated Social Network on the Fediverse

Mastodon is the decentralized Twitter/X alternative powering the Fediverse. Run your own instance, federate with thousands of others, and control your own community without ads, algorithms, or a single corporate owner.

Introduction

Mastodon is the flagship software of the Fediverse — a network of independently-operated servers that federate via the ActivityPub protocol (W3C standard). Unlike Twitter/X, there's no single corporate owner: anyone can host an instance, set community rules, and federate with the rest.

With over 50,000 GitHub stars, Mastodon is used by millions, including many journalists, technologists, academics, and the German government. The Mastodon gGmbH (non-profit) stewards the code; users pick instances that match their interests or rules.

What Mastodon Does

Mastodon is a microblogging server that exchanges posts with other ActivityPub-speaking servers (Mastodon, Pleroma, Misskey, PeerTube, Pixelfed, etc.). Users can follow accounts on any federated server, reply, boost (retweet), and favorite. Your home timeline shows posts from people you follow across the entire Fediverse.

Architecture Overview

[Your Instance] -------ActivityPub-----> [Other Fediverse instances]
     |
     |----Ruby on Rails web app
     |----Node.js streaming API
     |----Sidekiq background workers
     |
[Postgres] <----- posts, accounts, relationships
[Redis]     <----- feeds, queues, sessions
[Elasticsearch] <-- full-text search (optional)
[Object Storage (S3/MinIO)] <-- media attachments

Protocols:
  ActivityPub (inbox/outbox delivery)
  WebFinger (user discovery)
  HTTP Signatures (authentication)

Self-Hosting & Configuration

# .env.production (excerpt)
LOCAL_DOMAIN=social.example.com
WEB_DOMAIN=social.example.com

REDIS_HOST=redis
DB_HOST=db
DB_USER=mastodon
DB_NAME=mastodon_production

# Media to S3-compatible object storage
S3_ENABLED=true
S3_BUCKET=mastodon-media
AWS_ACCESS_KEY_ID=...
AWS_SECRET_ACCESS_KEY=...
S3_ENDPOINT=https://s3.amazonaws.com

# SMTP
SMTP_SERVER=email-smtp.us-east-1.amazonaws.com
SMTP_FROM_ADDRESS=notifications@social.example.com

# Elastic search (optional, enables full-text search of your own posts)
ES_ENABLED=true
ES_HOST=es
ES_PORT=9200
# Common admin tasks
docker compose run --rm web bin/tootctl accounts create admin --email admin@example.com --confirmed --role owner
docker compose run --rm web bin/tootctl search deploy   # (re)build ES index
docker compose run --rm web bin/tootctl domains purge blocked-instance.example

Key Features

  • Federated — follow across thousands of instances via ActivityPub
  • No algorithms — chronological timelines, opt-in trending hashtags
  • No ads — community-funded hosting, no advertising products
  • Content warnings — first-class CW support (sensitive content, spoilers)
  • Post-length 500+ — longer than Twitter/X default
  • Instance rules — admins set community norms; users pick instances that fit
  • Full export/import — take your follows, posts, media with you
  • API-complete — hundreds of third-party clients, bots, and services

Comparison with Similar Tools

Feature Mastodon Misskey / Calckey Pleroma / Akkoma Bluesky (ATProto) Twitter/X
Protocol ActivityPub ActivityPub ActivityPub ATProto (not AP) Proprietary
Federation Full Full Full Federated (AppView) No
Hosting Self or pick instance Self or instance Self or instance Self (relay + PDS) Central
Media-rich posts Good Best (reactions, polls) Good Good Best
Cost (self-host) Moderate (RAM-heavy) Low Lowest Moderate N/A
Best For Mainstream federated social Anime/art + reactions Lightweight server Emerging protocol Reach (but corporate)

FAQ

Q: Do I need to self-host to use Mastodon? A: No. Pick an instance (mastodon.social, hachyderm.io, fosstodon.org, infosec.exchange) and sign up. Self-hosting is for those who want full control of their community or data.

Q: What server resources does Mastodon need? A: A small instance (under 100 users): 2 vCPU + 4GB RAM + 50GB storage. Media storage grows quickly with federated content — plan to offload to S3 and use a CDN.

Q: Can I move to another instance later? A: Yes — set up the new account, then run the "Move" migration. Your followers are automatically redirected. Posts aren't migrated (ActivityPub limitation), but follows are preserved.

Q: Mastodon vs Bluesky? A: Different protocols (ActivityPub vs ATProto). Mastodon is mature, federation works today. Bluesky is newer with potentially better portability (PDS + relay architecture) but smaller network. Many users participate in both.

Sources

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产