.. _resilience_installation: *********************** Resilience Installation *********************** .. important:: Before installing, make sure you understand the :ref:`resilience_architecture` and links between components. .. contents:: :local: This page describes the necessary steps to install and configure the resilience solution in XiVO. Overview ======== #. First the chosen XiVO deployment must be ready: whether it is intended to deploy a XiVO, a CC or an XDS solution, the deployment must be ready and configured. #. Then a slave stack must be installed and configured - see :ref:`resilience_installation_slave_stack`: #. a second XiVO must be installed (which will be the slave node). #. and for CC and XDS deployment: a second CC stack linked to the slave XiVO node must be installed. #. Finally configure the Resilience itself - see :ref:`resilience_installation_config_detail`: #. Configure one XiVO as master and fill in the slave address (**VoIP interface**) #. Configure the other XiVO as slave and fill in the master address (**VoIP interface**) #. Configure file synchronization #. Follow specific steps depending on the deployment type (XiVO, CC, XDS) That's it, you now have a HA configuration, and every hour all the configuration done on the master will be reported to the slave. .. _resilience_installation_slave_stack: Resilience Slave Stack Installation =================================== All Deployement --------------- .. important:: This is a mandatory step which applies to all deployment types: XiVO, CC and XDS. :ref:`Install a slave XIVO ` and configure (i.e. pass the Wizard) it. CC Deployement -------------- .. note:: This applies to deployment types: CC and XDS. :ref:`Install and configure a slave CC ` linked to the slave XiVO previously installed: this means that when requested fill in the XiVO Slave IP address etc. XDS Deployement --------------- .. note:: This applies to deployment types: XDS. *Nothing to install* Edge Deployement ---------------- .. note:: This applies to deployment types: Edge. * On **XiVO Slave** configure the TURN secret for asterisk: * Run the following script to generate the credentials for the TURN server (the ```` is the secret generated during :ref:`edge_config_turnsecret`): .. code-block:: bash xivo-edge-gen-turn-cred .. note:: This script will generate new turn username and password in :file:`/etc/asterisk/rtp.d/01-xivo-edge-turn-cred.conf` * On **CC Slave** follow :ref:`edge_config_xivocc_config` to make it Edge aware. .. _resilience_installation_config_detail: Resilience Configuration Details ================================ Configure one XiVO as Master ---------------------------- .. note:: Step to be run on **XiVO Master** #. In XiVO Web interface go to :menuselection:`Configuration --> Management --> High Availability` page #. Select :guilabel:`Type of this node` to ``Master`` #. In the :guilabel:`Remote address` enter the VoIP address of the **Slave** node .. figure:: images/ha_dashboard_master.png HA Dashboard Master #. Restart all services on XiVO: ``xivo-service restart all`` Configure the other XiVO as Slave --------------------------------- .. note:: Step to be run on **XiVO Slave** #. In XiVO Web interface go to :menuselection:`Configuration --> Management --> High Availability` page #. Select :guilabel:`Type of this node` to ``Slave`` #. In the :guilabel:`Remote address` enter the VoIP address of the **Master** node .. figure:: images/ha_dashboard_slave.png HA Dashboard Slave .. _resilience_installation_file_sync: Configure file synchronization ------------------------------ .. note:: Step to be run on **XiVO Master** #. Configure file synchronization: ``xivo-sync -i`` Post-Configugration Steps ------------------------- When HA nodes is configured and file synchronization is setup here are the remaining manual steps to do: * On **XiVO Master**: #. Force a first synchronization: .. important:: For the command below, ``jq`` must be installed and the file sync between Main and Slave must have been initiated - see :ref:`resilience_installation_file_sync`. .. code-block:: bash XSLAVE_ADDR=$(cat /etc/xivo/ha.conf |jq .remote_address|tr -d '"') /usr/sbin/xivo-master-slave-db-replication $XSLAVE_ADDR /usr/bin/xivo-sync * On **XiVO Slave**: #. Force an update of the XIVO_UUID: .. code-block:: bash function remove_xivo_uuid_from_env() { local sed_args_forsystemd=(-i 's/"XIVO_UUID=[a-f0-9\-]\{36\}"//g' /etc/systemd/system.conf) local sed_args_env=(-i '/export XIVO_UUID/d' /etc/default/xivo) if sed "${sed_args_forsystemd[@]}" && sed "${sed_args_env[@]}" && rm -f /etc/profile.d/xivo_uuid.sh; then true else false fi } echo "" echo "Current UUID in env and conf" grep XIVO_UUID /etc/profile.d/xivo_uuid.sh /etc/systemd/system.conf /etc/default/xivo echo "" echo "Removing current UUID from env and conf" remove_xivo_uuid_from_env echo "" echo "Updating UUID in conf" xivo-configure-uuid #. Restart services: .. code-block:: bash xivo-service restart all Specific steps -------------- .. note:: Specific steps depending on the deployment type. CC Deployment ^^^^^^^^^^^^^ Nothing to do yet. XDS Deployment ^^^^^^^^^^^^^^ The XiVO Master & Slave must share the same AMI secret. If you need to change it, adapt the slave stack with the master secret this way: * On **XiVO Master** execute the following which will configure the same AMI secret for xuc user on Master and Slave: .. important:: For the command below, ``jq`` must be installed and the file sync between Main and Slave must have been initiated - see :ref:`resilience_installation_file_sync`. .. code-block:: bash XMASTER_AMI_SECRET=$(grep -oP '^\s*secret\s*=\K.*' /etc/asterisk/manager.d/02-xivocc.conf) XSLAVE_ADDR=$(cat /etc/xivo/ha.conf |jq .remote_address|tr -d '"') ssh -i /root/.ssh/xivo_id_rsa root@$XSLAVE_ADDR "sed -i 's/secret.*/secret =$XMASTER_AMI_SECRET/' /etc/asterisk/manager.d/02-xivocc.conf; asterisk -rx 'manager reload'" XSLAVE_AMI_SECRET=$(ssh -i /root/.ssh/xivo_id_rsa root@$XSLAVE_ADDR "grep -oP '^\s*secret\s*=\K.*' /etc/asterisk/manager.d/02-xivocc.conf") if [ "$XMASTER_AMI_SECRET" == "$XSLAVE_AMI_SECRET" ]; then echo "Good! AMI secret are the same !" else echo "Wrong! AMI secret are still not the same. Please check manually" fi * On CC Slave: * edit :file:`/etc/docker/compose/custom.env` and set ``XIVO_AMI_SECRET`` with the same value as in the XiVOCC Master * recreate xucserver: .. code-block:: bash xivocc-dcomp up -d xuc xivocc-dcomp restart xuc # To be sure xuc is restarted anyway Each MDS needs the Slave CC to be able to establish connection as well as the Master Xuc. .. note:: Step to be done on each MDS nodes * On each MDS: * edit the existing :file:`/etc/asterisk/manager.d/02-xuc.conf` to add a new permit line (replace ``XIVOCC_SLAVE_IP`` with actual Slave XiVOCC IP address): .. code-block:: bash permit=XIVOCC_SLAVE_IP/255.255.255.255` * reload AMI: .. code-block:: bash asterisk -rx "manager reload"