PyHSS is our open source Home Subscriber Server, it’s written in Python, has a variety of different backends, and is highly perforate (We benchmark to 10K transactions per second) and infinitely scaleable.
In this post I’ll cover the basics of setting up PyHSS in your enviroment and getting some Diameter peers connected.
For starters, we’ll need a database (We’ll use MySQL for this demo) and an account on that database for a MySQL user.
So let’s get that rolling (I’m using Ubuntu 24.04):
sudo apt update
sudo apt install mysql-server
Next we’ll create the MySQL user for PyHSS to use:
CREATE USER 'pyhss_user'@'%' IDENTIFIED BY 'pyhss_password';
GRANT ALL PRIVILEGES ON *.* TO 'pyhss_user'@'%' WITH GRANT OPTION;
FLUSH PRIVILEGES;
We’ll also need Redis as well (PyHSS uses Redis for inter-service communications and for caching), so go ahead an install that for your distro:
sudo apt install redis-server
So that’s our prerequisites sorted, let’s clone the PyHSS repo:
git clone https://github.com/nickvsnetworking/pyhss /etc/pyhss
And install the requirements with pip
from the PyHSS repo:
pip3 install -r requirements.txt
Next we’ll need to configure PyHSS, for that we update the config file (config.yaml
) with the settings we want to use.
We’ll start by setting the bind_ip
to a list of IPs you want to listen on, and your transport
– We can use either TCP or SCTP.
For Diameter, we will set OriginHost
and OriginRealm
to match the Diameter hostname you want to use for this peer, and the Realm of your Diameter network.
Lastly we’ll need to set the database parameters, updating the database:
section to populate your credentials, setting your username
and password
and the database
to match your SQL installation we setup at the start.
With that done, we can start PyHSS, which we do using systemctl
.
Because there’s multiple microservices that make up PyHSS, there’s multiple systemctl
files use to run PyHSS as a service, they’re all in the /systemd
folder.
We’ll copy them all to our systemd folder.
cp /etc/pyhss/systemd/ /lib/systemd/system/
systemctl daemon-reload
systemctl start pyhss
And with that we’ve got PyHSS running and ready for a Diameter peer to connect.
Now you should be able to bring our Diameter peers up.
If you’re using something like Kamailio, with C-Diameter Peer, you can read about the config for that here, or FreeDiameter you can read about here.
In the next post, we’ll cover subscriber provisioning via the API.