Server tech specs
Mementomori.social consists of many bits and pieces. This technical page is meant to tell you all about that.
Software
We run our own fork of Mastodon's latest development version, the main branch, built from source. Each update gets its own dated mementomods branch. On top of the Mastodon features, we have bunch of our own. See Instance features.
Current optimizations
- Mastodon itself (web, Sidekiq, streaming, Valkey and nginx) runs on its own server
- PostgreSQL is on its own server
- The database is on its own SSD volume that can grow when needed
- Elasticsearch is on its own server
- Media is stored in Cloudflare R2 object storage (practically endless storage)
- The site is served through Cloudflare's network, the servers stay in Helsinki
- Assets are compressed with Brotli
- Sidekiq is split into separate services per queue
- nginx, PostgreSQL, Sidekiq and Valkey are tuned to each server's resources
Server infrastructure
This is where the magic happens. All Mementomori.social servers are running on UpCloud cloud servers, located in Helsinki, Finland. UpCloud sponsors our infrastructure. Every server is built with Ansible, and the playbooks are public.
Mastodon server
Runs the Mastodon web app (Puma), Sidekiq, streaming, Valkey and nginx.
The server specifications:
- 8 vCPUs
- 32 GB RAM
- 20 GB system disk
- 20 GB data volume
On top of the regular Mastodon dependencies, the server software has
PostgreSQL server
The server specifications:
- 6 vCPUs
- 24 GB RAM
- 30 GB system disk
- 300 GB SSD volume for the PostgreSQL database, scalable further when needed
- 260 GB volume for database backups
Elasticsearch server
The server specifications:
- 4 vCPUs
- 16 GB RAM
- 40 GB system disk
- 60 GB data volume
Bastion server
The gateway the admins use to reach the other servers, which have no public address of their own except the Mastodon server.
- 2 vCPUs
- 2 GB RAM
- 30 GB system disk
S3 Object storage for media
Media storage is provided by Cloudflare R2, Zero Egress Distributed Object Storage.
Tweaks
There are some extensive improvements to the default installation.
Sidekiq services and jobs
Sidekiq background jobs have been separated into their own systemd services. We decided not to have them on a different server for now, we have not found the benefit in it yet.
mastodon@mastodon-0:~$ ls /etc/systemd/system/ | grep mastodon-sidekiq
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]Files (you get the idea):
[Unit]
Description=mastodon-sidekiq-%j-queue
After=network.target
[Service]
Type=simple
User=mastodon
WorkingDirectory=/data/mastodon/live
Environment="RAILS_ENV=production"
Environment="DB_POOL=%i"
Environment="MALLOC_ARENA_MAX=2"
Environment="LD_PRELOAD=libjemalloc.so"
ExecStart=/data/mastodon/.rbenv/shims/bundle exec sidekiq -c %i -q %j
TimeoutSec=15
Restart=always
# Proc filesystem
ProcSubset=pid
ProtectProc=invisible
# Capabilities
CapabilityBoundingSet=
# Security
NoNewPrivileges=true
# Sandboxing
ProtectSystem=strict
PrivateTmp=true
PrivateDevices=true
PrivateUsers=true
ProtectHostname=true
ProtectKernelLogs=true
ProtectKernelModules=true
ProtectKernelTunables=true
ProtectControlGroups=true
RestrictAddressFamilies=AF_INET
RestrictAddressFamilies=AF_INET6
RestrictAddressFamilies=AF_NETLINK
RestrictAddressFamilies=AF_UNIX
RestrictNamespaces=true
LockPersonality=true
RestrictRealtime=true
RestrictSUIDSGID=true
RemoveIPC=true
PrivateMounts=true
ProtectClock=true
# System Call Filtering
SystemCallArchitectures=native
SystemCallFilter=~@cpu-emulation @debug @keyring @ipc @mount @obsolete @privileged @setuid
SystemCallFilter=@chown
SystemCallFilter=pipe
SystemCallFilter=pipe2
ReadWritePaths=/data/mastodon/live
LimitNOFILE=65536
[Install]
WantedBy=multi-user.targetScheduled jobs
Health checks, preview card refetching, FediFetcher, the weekly search index rebuild and the nightly database dump run as systemd timers. See the Server runbook for the full list.
Server status and monitoring
Better Stack alerts the admins within a minute if anything on the status page goes down.
Services status can be followed at status.mementomori.social. Status page, monitors and heartbeats are provided by Better Stack.
Backups
- Nightly database dump to a separate backup volume, see the Server runbook
- A fresh database backup before every Mastodon upgrade, see Mastodon upgrade workflow
Last updated 2 minutes ago by rollecode - ba7033a