Migrating a Mastodon Instance to AnubizHost
Mastodon instances are tricky to migrate because federation depends on the instance domain. This guide covers keeping the domain stable while moving the entire Mastodon stack (Rails app, PostgreSQL, Redis, Sidekiq workers, media storage) to an AnubizHost offshore VPS.
Need this done for your project?
We implement, you ship. Async, documented, done in days.
Plan the Cutover Window
Mastodon federation continues to attempt deliveries to your instance during a brief outage - federated peers retry for hours. Plan a 30-60 minute downtime window for the final cutover; this is tolerable for federation.
The domain stays the same (mastodon.example.com), only the IP changes. This preserves federation identity and user accounts.
Provision AnubizHost Target Stack
Order offshore VPS with at least 4GB RAM (8GB+ for instances with 1000+ users). Install Ruby (rbenv recommended), PostgreSQL, Redis, ffmpeg, imagemagick, libidn, libvips, and the standard Mastodon dependencies from the official deployment guide.
Create the mastodon system user, clone the Mastodon repo at the matching version tag, run bundle install and yarn install.
Migrate Database and Media
Dump PostgreSQL on source: pg_dump -Fc mastodon_production > mastodon-db.dump. Restore on target: pg_restore -d mastodon_production mastodon-db.dump.
Media (avatars, attachments) is large. If you use S3-style object storage, migrate buckets with rclone to MinIO on AnubizHost. If local storage, rsync the public/system directory to the new host.
Copy .env.production and Cut Over
Copy .env.production to the new host. This contains your SECRET_KEY_BASE, OTP_SECRET, VAPID keys - these MUST match the source or all users lose access. Run RAILS_ENV=production bundle exec rails db:migrate to apply any pending migrations.
Start services: puma, sidekiq, streaming. Update DNS A record. Verify federation by following an external account from your instance.
Why Mastodon Operators Move Offshore
Mastodon admins often deal with moderation, content reports, and law enforcement requests. Offshore hosting on AnubizHost gives jurisdictional protection for instance admins. Romania and Iceland both have favorable approaches to platform liability. Related reading: offshore VPS, anonymous hosting, Matrix Synapse migration.
Related Services
Why Anubiz Host
Ready to get started?
Skip the research. Tell us what you need, and we'll scope it, implement it, and hand it back — fully documented and production-ready.