Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Change the name of the server after it's configured #3031

Closed
bzhfloriane opened this issue Mar 26, 2018 · 11 comments
Closed

Change the name of the server after it's configured #3031

bzhfloriane opened this issue Mar 26, 2018 · 11 comments

Comments

@bzhfloriane
Copy link

Hi, I just have a quick question. I configured my Synapse server and it works perfectly. But I want to change the name of the server.
Is there a way to change the name of the server after it's configured ?

Because when I modify the server_name line in homeserver.yaml, after rebooting my server I get this error :
2018-03-05 20:07:17,043 - synapse.storage.prepare_database - 223 - INFO - - Upgrading schema to v46
2018-03-05 20:07:17,044 - twisted - 131 - ERROR - - *********************************************************************
2018-03-05 20:07:17,045 - twisted - 131 - ERROR - - Found users in database not native to testchat1.nexus.com!
2018-03-05 20:07:17,045 - twisted - 131 - ERROR - - You cannot changed a synapse server_name after it's been configured
2018-03-05 20:07:17,045 - twisted - 131 - ERROR - - *******************************************************

I use this database :

database:
name: psycopg2
args:
user: star
password:
host: 127.0.0.1
database: synapse
cp_min: 5
cp_max: 10

@Half-Shot
Copy link
Collaborator

Is there a way to change the name of the server after it's configured ?

can probably be answered by

2018-03-05 20:07:17,045 - twisted - 131 - ERROR - - You cannot changed a synapse server_name after it's been configured

Once a server has a name configured, you must start from scratch on a new instance if you wish to change it. You cannot just change it, because most IDs rely on it. It is also not possible to migrate at this time.

@neilisfragile
Copy link
Contributor

(closing following half-shot's response)

@elisdg
Copy link

elisdg commented Dec 31, 2018

found this issue while having the same question.
Just want to link to the solution how to "start from scratch": https://github.com/matrix-org/synapse/wiki#i-have-a-problem-with-my-server-can-i-just-delete-my-database-and-start-again

@sindelar-fr
Copy link

Is there a posibility that it would be possible to "just remove the port" from the server name? Back when we've set up our homeserver, for some reason, we've specified the port which makes username joe:server.com:8448 which is a bit cumbersome. (so the change would be to joe:server.com)

@ghost
Copy link

ghost commented Sep 18, 2020

you can try dumping the database and doing a search and replace then re-loading it in

@luizvaz
Copy link

luizvaz commented Mar 10, 2021

I wrongly typed the server name.
So I solved it using the solution below.
My database is PostgreSQL.

  • Replace all misspelled domain parts in this tables: users, access_tokens
  • Stop the matrix server
  • Replace the domain in /etc/matrix-synapse/conf.d/server_name.yaml
  • Replace the domain in /etc/matrix-synapse/homeserver.yaml
  • Start the matrix server

Now everything is fine.

@michaelkaye
Copy link
Contributor

To clarify the above comment, which describes the steps required to skip the fatal error and consistency check, and will allow synapse to start, but critically does not fix the reasons this check was implemented, and is wrongly causing administrators to believe this may now work.

Nothing has changed since 2018, it is still not possible to rename a server once it has done anything useful (eg sent a message, joined any room), please do not attempt to rename your server by manual database operations.

@sindelar-fr
Copy link

Pfew! Good that I kept putting of the renaming for so long ... Guess this issue is a duplicate of #1209 which is still opened.
I had a feeling that it would have messed up something at least on a non isolated homeserver that does federate with others...

@chrisSCM
Copy link

I wrongly typed the server name. So I solved it using the solution below. My database is PostgreSQL.

  • Replace all misspelled domain parts in this tables: users, access_tokens
  • Stop the matrix server
  • Replace the domain in /etc/matrix-synapse/conf.d/server_name.yaml
  • Replace the domain in /etc/matrix-synapse/homeserver.yaml
  • Start the matrix server

Now everything is fine.

I can confirm that this does not work - I have tried it myself.

It results in numerous errors like this one:

RuntimeError: Database corruption: Event $AbqVZ7wqza-jBEHMkGTwxG3vpdlW2FtRQ1Is-vXMQBU in room !BNzFswCetUMLPfEgyx:example.com from the database appears to have been modified (calculated event id $TQ05o0HWrwd7RWtPIKpT47eDluu8tD_Fa3dAqrmXc9I)

@gleruzh
Copy link

gleruzh commented Oct 29, 2023

And what about private servers with federation turned off?

@gleruzh
Copy link

gleruzh commented Oct 30, 2023

Well. Looks like the only variant when direct DB changes for the server name probably won't hurt <-= very rare case when the server 1) was not ever federated AND 2) have been used by users (before the domain changes) without e2e.
But it is not 100% safe operation. I'd test it just for few days for now.
I guess, any federated server or server with encrypted messages is still without domain change possibility.
And yes, I did reinstallation with restore PG DB from dump (where I did changes), not directly change existing DB.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants