Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 5 additions & 16 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,27 +1,16 @@
FROM python:slim-trixie
LABEL maintainer="Razvan Crainea <razvan@opensips.org>"

USER root

# Set Environment Variables
ENV DEBIAN_FRONTEND noninteractive

#install basic components
RUN apt-get -y update -qq && \
apt-get -y install git default-libmysqlclient-dev gcc

#add keyserver, repository
RUN git clone https://github.com/OpenSIPS/opensips-cli.git /usr/src/opensips-cli && \
cd /usr/src/opensips-cli && \
python3 -m pip install . && \
COPY . /usr/src/opensips-cli
RUN cd /usr/src/opensips-cli && \
python3 -m pip install --no-cache-dir . && \
cd / && rm -rf /usr/src/opensips-cli

RUN apt-get purge -y git gcc && \
apt-get autoremove -y && \
apt-get clean

ADD "run.sh" "/run.sh"
ADD "docker/run.sh" "/run.sh"

ENV PYTHONPATH /usr/lib/python3/dist-packages

ENTRYPOINT ["/run.sh", "-o", "communication_type=http"]
ENTRYPOINT [ "/run.sh", "-o", "communication_type=http" ]
3 changes: 2 additions & 1 deletion docker/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ all: build start

.PHONY: build start
build:
docker build \
cd .. ; \
docker build -f docker/Dockerfile \
--tag="opensips/opensips-cli:$(OPENSIPS_DOCKER_TAG)" \
.

Expand Down
4 changes: 2 additions & 2 deletions docker/docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ You can build the docker image by running:
make build
```

This command will build a docker image with OpenSIPS CLI master version taken from
the git repository
This command will build a docker image with OpenSIPS CLI code taken from
the parent directory.

## Parameters

Expand Down
12 changes: 6 additions & 6 deletions docs/INSTALLATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ will vary on every supported operating system.

```
# required OS packages
sudo apt install python3 python3-pip python3-dev gcc default-libmysqlclient-dev \
python3-mysqldb python3-sqlalchemy python3-sqlalchemy-utils \
sudo apt install python3 python3-pip python3-dev \
python3-pymysql python3-sqlalchemy python3-sqlalchemy-utils \
python3-openssl
# alternatively, you can build the requirements from source
sudo pip3 install mysqlclient sqlalchemy sqlalchemy-utils pyOpenSSL
sudo pip3 install pymysql sqlalchemy sqlalchemy-utils pyOpenSSL
```

#### Red Hat / CentOS
Expand All @@ -72,11 +72,11 @@ sudo yum install python36 python36-pip python36-devel gcc mysql-devel \
python36-mysql python36-sqlalchemy python36-pyOpenSSL
# required CentOS 8 packages
sudo yum install python3 python3-pip python3-devel gcc mysql-devel \
python3-mysqlclient python3-sqlalchemy python3-pyOpenSSL
sudo yum install python3 python3-pip python3-devel \
python3-pymysql python3-sqlalchemy python3-pyOpenSSL
# alternatively, you can build the requirements from source
sudo pip3 install mysqlclient sqlalchemy sqlalchemy-utils pyOpenSSL
sudo pip3 install pymysql sqlalchemy sqlalchemy-utils pyOpenSSL
```

### Download, Build & Install
Expand Down
6 changes: 3 additions & 3 deletions docs/modules/database.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ are using the OpenSIPS source tree. Default: `/usr/share/opensips`
(administrator) access level which will be used to create/drop databases, as
well as to create or ensure access for the non-privileged DB access user
provided via `database_url`. The URL combines schema, username, password, host
and port. Default: `mysql://root@localhost`.
and port. Default: `mysql+pymysql://root@localhost`.
* `database_url` (optional) - the connection string to the database. A good practice
would be to use a non-administrator access user for this URL. Default:
`mysql://opensips:opensipsrw@localhost`.
`mysql+pymysql://opensips:opensipsrw@localhost`.
* `database_name` (optional) - the name of the database. Modules may be separately added
to this database if you choose not to install all of them. Default: `opensips`.
* `database_modules` (optional) - accepts the `ALL` keyword that indicates all the
Expand All @@ -68,7 +68,7 @@ Consider the following configuration file:
database_modules: ALL

#database_admin_url: postgresql://root@localhost
database_admin_url: mysql://root@localhost
database_admin_url: mysql+pymysql://root@localhost
```

The following command will create the `opensips` database and all possible
Expand Down
4 changes: 2 additions & 2 deletions opensipscli/defaults.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
##
## This file is part of OpenSIPS CLI
## (see https://github.com/OpenSIPS/opensips-cli).
Expand Down Expand Up @@ -71,7 +71,7 @@
"datagram_buffer_size": "65535",

# database module
"database_url": "mysql://opensips:opensipsrw@localhost",
"database_url": "mysql+pymysql://opensips:opensipsrw@localhost",
"database_name": "opensips",
"database_schema_path": "/usr/share/opensips",

Expand Down
4 changes: 2 additions & 2 deletions packaging/debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ Source: opensips-cli
Section: python
Priority: optional
Maintainer: Razvan Crainea <razvan@opensips.org>
Build-Depends: debhelper (>= 9), dh-python, python3-setuptools, python3-dev, default-libmysqlclient-dev | libmysqlclient-dev, python3-sqlalchemy, python3-opensips
Build-Depends: debhelper (>= 9), dh-python, python3-setuptools, python3-dev, python3-sqlalchemy, python3-opensips
Standards-Version: 3.9.8
Homepage: https://github.com/OpenSIPS/opensips-cli

Package: opensips-cli
Architecture: all
Multi-Arch: foreign
Depends: python3, ${misc:Depends}, ${python3:Depends}, python3-sqlalchemy, python3-sqlalchemy-utils, python3-openssl, python3-mysqldb, python3-pymysql, python3-opensips
Depends: python3, ${misc:Depends}, ${python3:Depends}, python3-sqlalchemy, python3-sqlalchemy-utils, python3-openssl, python3-pymysql, python3-opensips
Description: Interactive command-line tool for OpenSIPS 3.0+
This package contains the OpenSIPS CLI tool, an interactive command line tool
that can be used to control and monitor OpenSIPS 3.0+ servers.
Expand Down
6 changes: 5 additions & 1 deletion packaging/redhat_fedora/opensips-cli.spec
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ BuildArch: noarch
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: python3-rpm-macros
%if 0%{?rhel} == 7
BuildRequires: mysql-devel
%endif
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

AutoReqProv: no
Expand All @@ -24,7 +26,7 @@ Requires: python36-mysql
Requires: python36-pyOpenSSL
%else
Requires: python3-sqlalchemy
Requires: python3-mysqlclient
Requires: python3-pymysql
Requires: python3-pyOpenSSL
%endif
Requires: python3-opensips
Expand Down Expand Up @@ -69,6 +71,8 @@ rm -rf $RPM_BUILD_ROOT
%license LICENSE

%changelog
* Mon Apr 27 2026 Jérôme Warnier <jwarnier@bandwidth.com> - 0.1-3
- Use PyMySQL rather than MySQLdb on recent distros.
* Thu Aug 27 2020 Liviu Chircu <liviu@opensips.org> - 0.1-2
- Update package summary.
* Fri Jan 3 2020 Nick Altmann <nick.altmann@gmail.com> - 0.1-1
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ maintainers = [
]
dependencies = [
"opensips",
"mysqlclient<1.4.0rc1",
"pymysql",
"sqlalchemy>=1.3.3,<2",
"sqlalchemy-utils",
]
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
##
## This file is part of OpenSIPS CLI
## (see https://github.com/OpenSIPS/opensips-cli).
Expand Down Expand Up @@ -46,7 +46,7 @@
packages=find_packages(include=("opensipscli", "opensipscli.*")),
install_requires=[
"opensips",
"mysqlclient<1.4.0rc1",
"pymysql",
"sqlalchemy>=1.3.3,<2",
"sqlalchemy-utils",
],
Expand Down
18 changes: 9 additions & 9 deletions test/alltests.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,17 @@ def testMakeURL(self):
assert repr(u) == 'x://user:***@host:12/db'
assert str(u) == 'x://user:pass@host:12/db'

u = make_url('mysql://opensips:opensipsrw@localhost/opensips')
assert repr(u) == 'mysql://opensips:***@localhost/opensips'
assert str(u) == 'mysql://opensips:opensipsrw@localhost/opensips'
u = make_url('mysql+pymysql://opensips:opensipsrw@localhost/opensips')
assert repr(u) == 'mysql+pymysql://opensips:***@localhost/opensips'
assert str(u) == 'mysql+pymysql://opensips:opensipsrw@localhost/opensips'

u = make_url('mysql://opensips:opensipsrw@localhost')
assert repr(u) == 'mysql://opensips:***@localhost'
assert str(u) == 'mysql://opensips:opensipsrw@localhost'
u = make_url('mysql+pymysql://opensips:opensipsrw@localhost')
assert repr(u) == 'mysql+pymysql://opensips:***@localhost'
assert str(u) == 'mysql+pymysql://opensips:opensipsrw@localhost'

u = make_url('mysql://root@localhost')
assert repr(u) == 'mysql://root@localhost'
assert str(u) == 'mysql://root@localhost'
u = make_url('mysql+pymysql://root@localhost')
assert repr(u) == 'mysql+pymysql://root@localhost'
assert str(u) == 'mysql+pymysql://root@localhost'


if __name__ == "__main__":
Expand Down
2 changes: 1 addition & 1 deletion test/test-database.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
CLI_CFG=/tmp/.__cli.cfg
DB_NAME=_opensips_cli_test

MYSQL_URL=mysql://opensips:opensipsrw@localhost
MYSQL_URL=mysql+pymysql://opensips:opensipsrw@localhost
PGSQL_URL=postgresql://opensips:opensipsrw@localhost

TESTS=(
Expand Down