Skip to content

Migrating from RPM Deployment

This chapter explains how to migrate from an existing RPM-based deployment of the BWGW to its containerized version. Since most of the configuration is stored in the database, this section focuses on recovering the necessary settings from configuration files. When the container starts, it reads from the same database, ensuring a smooth transition.

DANGER

Ensure that the same version of the BWGW is used in both the Docker and RPM variants, as the software executes DB migration scripts when version discrepancies occur. Switching versions during migration should be avoided. The software version can be retrieved by running the command rpm -q apio-gw-core on the existing deployment. The software version can be updated later by adjusting the image reference in the docker-compose.yml file.

The container can be launched either on the same host as the current RPM gateway (to be decommissioned later) or on a new host. If deployed on the same host, both versions must not run simultaneously unless they are exposed on different ports.

During the RPM-based installation of the APIO Broadworks Gateway, an initial configuration file with an .ini extension was created under /opt/apio-gateway_frontend/apio-gateway-ops/. This file served as the basis for generating various configuration files.

To transition from the RPM-based installation to a container-based deployment, the configuration parameters must be extracted from the existing setup and used to define the BWGW* environment variables in the docker-compose.yml file.

These parameters can be retrieved in two ways:

  1. From the current BWGW configuration files if the .ini file is no longer accessible. (recommended)
  2. From the original .ini file created during the initial installation, if it is still available or stored in a safe location.

The next two chapters outline both methods in detail.

Retrieving Parameters from Current Configuration Files

Locate the BWGW Supervisord service configuration file under /etc/supervisord.d and extract the value of the DJANGO_SETTINGS_MODULE environment variable from it.

.
[program:apio-gateway-1]
directory=/opt/apio-gateway_frontend/apio-gateway
user=django
command=/opt/apio-gw-core/bin/gunicorn apio_gateway_frontend.wsgi:application -b 127.0.0.1:8101 --timeout=60 --graceful-timeout=30 --workers=1 --threads=5 --log-level=DEBUG --access-logfile=/var/log/gunicorn/access-apio-gateway.log --error-logfile=/var/log/gunicorn/error-apio-gateway.log --user=django --group=django
autorestart=true
stdout_logfile=/var/log/supervisor/apio-gateway-1-stdout.log
stderr_logfile=/var/log/supervisor/apio-gateway-1-stderr.log
stdout_logfile_maxbytes=10000000
stdout_logfile_backups=5
stderr_logfile_maxbytes=10000000
stderr_logfile_backups=5
environment=PATH="/opt/apio-gw-core/bin",DJANGO_SETTINGS_MODULE="apio_gateway_frontend.settings.apio_gateway_settings"
stopsignal=KILL
stopasgroup=true

Interpret the value of DJANGO_SETTINGS_MODULE as a relative path under /opt/apio-gateway_frontend/apio-gateway/. Replace all dots (.) with slashes (/) and append .py to form the full path to the configuration file.

Example: apio_gateway_frontend.settings.apio_gateway_settings must be interpreted as /opt/apio-gateway_frontend/apio-gateway/apio_gateway_frontend/settings/apio_gateway_settings.py

This configuration file includes the values needed to set some of the docker-compose.yml environment variables outlined in the Installation chapter.

Verify in the existing Django admin interface that the Backend configuration already includes all necessary data. If the configuration is present, you may skip the remainder of this chapter, as the data has already been successfully provisioned into the database.

Among its various parameters, it includes a reference to the proq configuration file (parameter PROQ_SETTINGS), as shown in the example below:

python
APIO_SPECIFIC_DATA.update({
    'PROQ_SETTINGS' : '/proq/proq-32-58.cfg',
    'SYSTEM_DEFAULT_DOMAIN': 'netaxis.cloud',
    'DEFAULT_DOMAIN': 'netaxis.cloud',
    'DEFAULT_TIMEZONE': 'Europe/Brussels',
    'LOCAL_COUNTRY_CODE': 'BE',
})

Interpret the value of PROQ_SETTINGS as a relative path under /opt/apio-gateway_frontend/apio-gateway/apio_gateway_frontend/.

Example: /proq/proq-32-58.cfg must be interpreted as /opt/apio-gateway_frontend/apio-gateway/apio_gateway_frontend/proq/proq-32-58.cfg

This configuration file includes the values needed to set the rest of the environment variables outlined in the Installation chapter.

Map the values according to the specified mapping table.

Container ParameterFileParameter
BWGW_LOG_LEVELDJANGO_SETTINGS_MODULELOG_LEVEL
BWGW_DB_NAMEDJANGO_SETTINGS_MODULEDATABASES..NAME
BWGW_DB_USERNAMEDJANGO_SETTINGS_MODULEDATABASES..USER
BWGW_DB_PASSWORDDJANGO_SETTINGS_MODULEDATABASES..PASSWORD
BWGW_DB_HOSTDJANGO_SETTINGS_MODULEDATABASES..HOST
BWGW_DB_PORTDJANGO_SETTINGS_MODULEDATABASES..PORT
BWGW_DB_RENTENTIONderived from cleanup script /opt/apio-gw-core/ops/scripts/clean_audit_*.sh: parameter [retention_months] in /opt/apio-gw-core/ops/scripts/clean_audit.sh db_host db_user db_db db_password [retention_months] [db_port]
BWGW_NUM_PROCSderived from number of .ini files in /etc/supervisord.d/
BWGW_SYSTEM_DEFAULT_DOMAINDJANGO_SETTINGS_MODULEAPIO_SPECIFIC_DATA..SYSTEM_DEFAULT_DOMAIN
BWGW_DEFAULT_DOMAINDJANGO_SETTINGS_MODULEAPIO_SPECIFIC_DATA..DEFAULT_DOMAIN
BWGW_TIMEZONEDJANGO_SETTINGS_MODULEAPIO_SPECIFIC_DATA..DEFAULT_TIMEZONE
BWGW_COUNTRY_CODEDJANGO_SETTINGS_MODULEAPIO_SPECIFIC_DATA..LOCAL_COUNTRY_CODE
BWGW_AS_SYSTEM_USERNAMEdo not set (user is already created in DB)
BWGW_AS_SYSTEM_PASSWORDdo not set (user is already created in DB)
BWGW_AS_SUPER_USERNAMEdo not set (user is already created in DB)
BWGW_AS_SUPER_PASSWORDdo not set (user is already created in DB)
BWGW_DJANGO_ADMIN_USERNAMEdo not set (user is already created in DB)
BWGW_DJANGO_ADMIN_PASSWORDdo not set (user is already created in DB)
BWGW_AS_IPPROQ_SETTINGSmain_server_ip
BWGW_OCI_VERSIONPROQ_SETTINGSociVersion
BWGW_XSI_VERSIONPROQ_SETTINGSxsiVersion
BWGW_NSOSS_VERSIONPROQ_SETTINGSnsOssVersion

INFO

While the BWGW retrieves certain configuration parameters from the proq configuration file, any Broadworks configuration stored in the database takes precedence.

Retrieving Parameters from INI File

WARNING

While retrieving configuration parameters from the .ini file may be more convenient, keep in mind that this file serves as the source for generating the configuration files described in the previous chapter. If any of the generated configuration files were later modified, those changes may not be reflected in the original .ini file.

Read the .ini file located in the /opt/apio-gateway_frontend/apio-gateway-ops/ directory and map its values according to the specified mapping table.

Container ParameterINI Parameter
BWGW_LOG_LEVELlog_level
BWGW_DB_NAMEapio_db_name
BWGW_DB_USERNAMEapio_db_user
BWGW_DB_PASSWORDapio_db_pwd
BWGW_DB_HOSTapio_db_host
BWGW_DB_PORTapio_db_port
BWGW_DB_RENTENTIONapio_db_audit_retention_months
BWGW_NUM_PROCSapio_nb_of_running_processes
BWGW_SYSTEM_DEFAULT_DOMAINapio_system_default_domain
BWGW_DEFAULT_DOMAINapio_default_domain
BWGW_TIMEZONEapio_default_timezone
BWGW_COUNTRY_CODEapio_country_code
BWGW_AS_SYSTEM_USERNAMEapio_system_user_login
BWGW_AS_SYSTEM_PASSWORDapio_system_user_pwd
BWGW_AS_SUPER_USERNAMEapio_super_user_login
BWGW_AS_SUPER_PASSWORDapio_super_user_pwd
BWGW_DJANGO_ADMIN_USERNAMEapio_django_admin_user
BWGW_DJANGO_ADMIN_PASSWORDapio_django_admin_pwd
BWGW_AS_IPproq_main_server_ip
BWGW_OCI_VERSIONproq_oci_version
BWGW_XSI_VERSIONproq_xsi_version
BWGW_NSOSS_VERSIONproq_nsOss_version

Container Setup

After retrieving the parameters using one of the previously described methods, you can proceed to construct the docker-compose.yml file as outlined in the Installation chapter.

Once done initiate the container as described in the Installation chapter.

WARNING

Do not run the load-initial-data or create-django-admin commands as described in the installation chapter, since the provisioning data is already present in the existing database.