How to change domain name?

Hi there, may I ask what are the necessary steps to change the domain name of an instance, while retaining all events and user data?

That’s not supported, especially if your instance already federated with other ones. Also it can be very time consuming since there’s no script to do it automatically at the moment.
So you might better be off with starting over.

However, the following steps should do it:

  • if you have followed or are followed by some instances, remove them all in the federation section
  • stop your instance
  • change the domain name into the config file
  • connect to your database (this will be the longest part)
    • remove the local instance actor and the anonymous actor (they will be automatically recreated when you restart your instance)
      delete from actors where domain is null and preferred_username = 'anonymous';
      delete from actors where domain is null and preferred_username = 'relay';
    • edit all the local actors URLs to match your new domain. Something like
      UPDATE actors SET url = REPLACE(url,old_domain,new_domain) WHERE domain is null;
      For url, inbox_url, outbox_url, following_url, followers_url, shared_inbox_url, and if the actor is a group, members_url, resources_url, todos_url, posts_url, events_url, discussions_url as well.
    • In the same way, edit all tables that contain URLs for local content (with a url field). That would be nearly all tables.
  • restart your instance
1 Like