Mastodon Self-Hosting: Lightweight Setup for Federating with Threads

This document summarizes everything I did to set up and optimize a self-hosted Mastodon instance, with the specific goal of federating with my Threads account, while keeping system resource usage low. This includes systemd tuning, Sidekiq concurrency adjustments, federation limits, and selective media handling.


Why I Did This

I wanted to stay connected to the fediverse via Threads (which I'm verified on), but without committing fully to a busy Mastodon instance. My intent is not to host a large social server, but to run a minimal and functional one for the purpose of federation — particularly with Threads.


Environment


1. Sidekiq Concurrency Optimization

Goal

Limit Sidekiq's thread usage to avoid high memory and CPU consumption.

What I Did

Final Working Override

File: /etc/systemd/system/mastodon-sidekiq.service.d/override.conf

[Service]
ExecStart=
ExecStart=/bin/bash -lc 'cd /var/www/mastodon/live && exec bundle exec sidekiq -c 2'

Then reloaded and restarted:

sudo systemctl daemon-reexec
sudo systemctl daemon-reload
sudo systemctl restart mastodon-sidekiq

Verified With

systemctl status mastodon-sidekiq

Output showed:

"sidekiq ... [0 of 2 busy]"

Which confirmed that Sidekiq is now respecting the -c 2 limit.


2. Disabling Streaming Service

Goal

Reduce resource usage by disabling real-time updates, which are not essential for my use case.

What I Did

sudo systemctl disable --now mastodon-streaming

This turns off the WebSocket-based streaming component, meaning I need to manually refresh pages (or rely on polling from the front-end).


3. Limiting Federation Scope

Goal

Avoid excessive background traffic from large Mastodon instances that I don’t care about. Focus on Threads and maybe a few others.

What I Did

a. Enabled authorized_fetch

Edited /var/www/mastodon/live/config/settings.yml and added:

authorized_fetch: true

This means only instances I interact with (e.g., Threads) can request data from me.

b. Blocked Large Instances

Using the admin panel at:

https://<my-domain>/admin/domain_blocks

I blocked:

Set to:

This prevents those busy instances from pulling posts or federating with mine.


4. Media Processing Preferences

Goal

Keep media handling efficient, but not disabled — I still want to allow video and audio uploads.

What I Chose

.env.production settings

DISABLE_MEDIA_PROXY=true

This means remote images are not cached or served via my server — they’re loaded directly from their source.


5. Sidekiq Concurrency in .env.production (for clarity)

Even though systemd overrides enforce concurrency, I added this to .env.production as documentation or fallback:

SIDEKIQ_CONCURRENCY=2

This is safe, and it communicates intent in case someone else checks the environment later.


Other Notes


Conclusion

The Mastodon instance now: