Run Postgres on another machine

Added by Filipe Garcia 10 months ago

Hello, guys.

I have been trying to change the database server to another machine but I was not lucky yet.

Reading the docs, I learned that xivo-dao is resposible for sharing the connection string to other components.
I changed the config.yml to point to the database cluster on my network but I cant manage to run xivo-init-db --init successfully.
It was able to create all tables on the new cluster but fails to add the necessary data.

If I shutdown the local postgresql server, these are the errors:

Failed to connect to postgres
Traceback (most recent call last):
  File "/usr/bin/xivo-init-db", line 5, in <module>
  File "/usr/lib/python2.7/dist-packages/xivo_db/bin/", line 68, in main
  File "/usr/lib/python2.7/dist-packages/xivo_db/bin/", line 54, in _init_db
  File "/usr/lib/python2.7/dist-packages/xivo_db/", line 39, in decorator
    res = f(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/xivo_db/", line 61, in init_db
    conn.autocommit = True
UnboundLocalError: local variable 'conn' referenced before assignment

Any suggestions here? Looks like init-db is still trying to connect to the local server. Should I rerun any scripts to get this new configuration loaded?

Replies (3)

RE: Run Postgres on another machine - Added by François Blackburn 10 months ago

You can try to edit the file : /usr/lib/python2.7/dist-packages/xivo_db/
To change hard-coded url

Or install xivo-dao on the remote database and run xivo-init-db --init

(I don't have tested any of these solutions)

RE: Run Postgres on another machine - Added by Sébastien Duthil 9 months ago


this issue will be addressed in Wazo 18.10, see #7239.

RE: Run Postgres on another machine - Added by Filipe Garcia 9 months ago

Glad to hear that, Sébastien.

I was not able to figure how to run it in another server because I found out so many files with the connection string hardcoded.
I actually managed to replicate the local database to my cluster and it is running smoothly.

When this version is released I'll for sure test it.