You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
opensips-cli defaults to MySQL despite PostgreSQL being installed #112
Hi Team,
I've noticed that when using the database create command in opensips-cli, it automatically selects MySQL, even though I have PostgreSQL correctly installed on my system. I have double-checked the configurations and ensured PostgreSQL's availability, yet the CLI tool seems to prioritize MySQL.
opensips-cli is installed via get.
#dpkg -l | grep opensips
ii opensips 3.4.1-1 amd64 very fast and configurable SIP server
ii opensips-cli 0.120230512161b5ea-1 all Interactive command-line tool for OpenSIPS 3.0+
ii opensips-postgres-module:amd64 3.4.1-1 amd64 PostgreSQL database connectivity module for OpenSIPS
modules:
ls /usr/share/opensips/
dbtext menuconfig_templates postgres
Can I force opensips-cli to install it only on postgresql?
If this is still an issue, I believe you have some lingering opensips-cli.cfg configuration which instructs it to default to MySQL. In decreasing order of importance, can you check the following files for any MySQL DB URLs? Moreover, the implicit database_url is mysql://opensips:opensipsrw@localhost, after all, which could be the source of your troubles!
Thanks for the hint.
I have had no opensips-cli.cfg file, I found in the repository the correct line to add:
osips06# cat ~/.opensips-cli.cfg
[default]
log_level: WARNING
prompt_name: cli
prompt_intro: Welcome to CLI!
prompt_emptyline_repeat_cmd: False
history_file: ~/.opensips-cli.history
history_file_size: 1000
output_type: pretty-print
communication_type: fifo
fifo_file: /tmp/opensips_fifo
domain: opensips.org database_admin_url: postgresql://root@localhost
root@osips06:/usr/local/lib/python3.9/dist-packages# opensips-cli -x database create
Password for admin PostgreSQL user (root):
adding logic for DB package detection could get cumbersome to maintain, with lots of random logical forks on several levels:
is it a dpkg listing? rpm? pacman? etc.
is the MySQL package named mysql-server, mariadb-server, percona-server or percona-xtradb-cluster, etc.
even if we were to add all this "detection" logic, how would you explain the behavior to CLI users? "The CLI tries to detect your SQL DB and use it, but only if it's a single DB install from a known package on a CLI-known distro?"
sqlalchemy.exc.OperationalError: (psycopg2.OperationalError) connection to server at "localhost" (::1), port 5432 failed: FATAL: database "sips" does not exist
It is taking the username also as the Database name.
I'm still searching and debugging what to put in here to get it correct
Activity
liviuchircu commentedon Oct 17, 2023
Hi @Vince-H1!
If this is still an issue, I believe you have some lingering
opensips-cli.cfgconfiguration which instructs it to default to MySQL. In decreasing order of importance, can you check the following files for any MySQL DB URLs? Moreover, the implicitdatabase_urlismysql://opensips:opensipsrw@localhost, after all, which could be the source of your troubles!~/.opensips-cli.cfg/etc/opensips-cli.cfg/etc/opensips/opensips-cli.cfgVince-H1 commentedon Oct 17, 2023
Hi @liviuchircu,
Thanks for the hint.
I have had no opensips-cli.cfg file, I found in the repository the correct line to add:
osips06# cat ~/.opensips-cli.cfg
[default]
log_level: WARNING
prompt_name: cli
prompt_intro: Welcome to CLI!
prompt_emptyline_repeat_cmd: False
history_file: ~/.opensips-cli.history
history_file_size: 1000
output_type: pretty-print
communication_type: fifo
fifo_file: /tmp/opensips_fifo
domain: opensips.org
database_admin_url: postgresql://root@localhost
root@osips06:/usr/local/lib/python3.9/dist-packages# opensips-cli -x database create
Password for admin PostgreSQL user (root):
So the default was still to MySQL.
Thanks for the help! :)
cheers, Vincent
liviuchircu commentedon Oct 18, 2023
I see. Glad you could move past the issue.
Now, whether this is a bug or not... I think it's ultimately best to leave
database_urlas it is, and not add too much bloat around it:dpkglisting?rpm?pacman? etc.mysql-server,mariadb-server,percona-serverorpercona-xtradb-cluster, etc.Vince-H1 commentedon Oct 18, 2023
Don't think it is a bug, it is more that I was not able to find that this step was needed.
I notice I'm a step further but not able to get it fixed as I need it.
root@osips06:/etc/opensips# opensips-cli -x database createOutcome at the moment is:
sqlalchemy.exc.OperationalError: (psycopg2.OperationalError) connection to server at "localhost" (::1), port 5432 failed: FATAL: database "sips" does not existIt is taking the username also as the Database name.
I'm still searching and debugging what to put in here to get it correct
liviuchircu commentedon Oct 18, 2023
Could you run it in debug mode, using
opensips-cli -d, and provide the output of the samedatabase createattempt? Thanks!