Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Updates

Kanadr is updated with apt, from the vendor’s signed repository. A new version is reported in the portal; an operator administrator installs it with one button, or lets it install automatically within a time window they choose. Nothing installs without that choice.

Only Kanadr is updated this way. Debian security fixes (system, PostgreSQL, nginx…) install by themselves, once a day: see Debian security updates. Other Debian updates remain yours (sudo apt upgrade, see below).

Debian security updates

The image and the VPS installer install unattended-upgrades and turn it on. Every day, early in the morning (apt-daily-upgrade timer, machine time), it installs Debian security fixes and nothing else:

  • no other Debian updates, no Kanadr repository (kanadr is also on its exclusion list), no repository you may have added;
  • the machine is never rebooted automatically: after a kernel or system library fix, the /var/run/reboot-required file appears and the reboot is up to you, at a time that suits you (in active/passive, the passive first). The portal tells you (see Restart to plan);
  • an updated service (PostgreSQL, nginx…) is restarted by its package, as with apt by hand; each machine of an active/passive pair updates by itself;
  • old kernels are removed: each kernel fix installs a new one next to the previous ones, which would end up filling the disk. The running one and the most recent ones are always kept. A machine installed before this setting receives it when Kanadr is updated.

The settings are in /etc/apt/apt.conf.d/52kanadr-unattended (origins, exclusion, reboot) and /etc/apt/apt.conf.d/20auto-upgrades (activation); unattended-upgrades’ own file is left untouched. To check:

sudo unattended-upgrade --dry-run -d      # origins in use, packages that would be upgraded
sudo less /var/log/unattended-upgrades/unattended-upgrades.log
systemctl list-timers 'apt-daily*'

On a machine installed before this version, sudo apt install unattended-upgrades alone turns it on with Debian’s default configuration, which also admits ordinary Debian updates. To get the same settings as a recent installation:

sudo apt install unattended-upgrades
sudo tee /etc/apt/apt.conf.d/52kanadr-unattended >/dev/null <<'EOF'
#clear Unattended-Upgrade::Allowed-Origins;
#clear Unattended-Upgrade::Origins-Pattern;
Unattended-Upgrade::Origins-Pattern {
        "origin=Debian,codename=${distro_codename},label=Debian-Security";
        "origin=Debian,codename=${distro_codename}-security,label=Debian-Security";
};
#clear Unattended-Upgrade::Package-Blacklist;
Unattended-Upgrade::Package-Blacklist {
        "kanadr";
};
Unattended-Upgrade::Automatic-Reboot "false";
Unattended-Upgrade::Remove-Unused-Dependencies "false";
Unattended-Upgrade::Remove-Unused-Kernel-Packages "true";
EOF
sudo tee /etc/apt/apt.conf.d/20auto-upgrades >/dev/null <<'EOF'
APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Unattended-Upgrade "1";
EOF
sudo unattended-upgrade --dry-run -d 2>&1 | grep -E 'Allowed origins|blacklist'

The last command must list only the Debian-Security origins, and kanadr in the exclusion list.

Restart to plan

A kernel or system library fix is installed, but only takes effect when the machine restarts. Until it has restarted, it runs on the old kernel: the fixed vulnerabilities stay open. Nothing is blocked though, neither the following fixes nor Kanadr updates.

The portal tells the operator:

  • the Home page, under To deal with: “A system patch has been waiting for a machine restart”, with the number of days;
  • the Health section of Diagnostics, Machine line: “restart to plan”, with the date and the packages concerned;
  • the Updates card of the Settings;
  • the kanadr_redemarrage_machine_a_prevoir metric, which goes to 1 (RedemarrageMachineAPrevoir alert after a week, see Monitoring).

Restart the machine at a quiet time, calls in progress are cut off.

From the portal (operator administrator): in the Updates card of the Settings (the To deal with entry leads there), Restart the machine. The confirmation shows the machine that restarts, the number of calls in progress (read again every 5 seconds while it stays open) and the waiting packages; its button, Restart: calls cut off, portal unavailable for a few minutes, restarts right away. The portal shows “Machine restart requested”, then “reconnecting”, and reloads by itself as soon as the machine responds again; the notice is then gone. The button only appears when a patch is waiting for a restart, and it is refused during a Kanadr update; it stays allowed when the instance is read-only (expired licence). Support sees it without being able to do it; neither the AI assistant, nor the MCP server, nor an authorised application restart the machine. Each request is written to the audit log (machine.redemarrer, with the number of calls in progress and the packages). Through the API, with a key of the operator administrator: POST /organisations/{id}/machine/redemarrage.

On the server:

sudo systemctl reboot

The notice disappears on restart. In active/passive, it concerns the machine that answers (the active one), and the portal button only restarts that one (the confirmation says so): the passive takes over meanwhile, and the former active comes back as passive. Restart the passive by hand; to avoid any needless interruption, restart it first, then switch over.

Access to the repository

The vendor’s repository is reserved for the operators it knows: the package, the image and the installation scripts can only be downloaded by presenting one of these two credentials. The repository signing key and the users’ applications (desktop, mobile) remain public.

  • The instance’s license. As soon as a license is in place, Kanadr presents it to the repository itself: nothing to enter, when the license is installed or renewed. The repository accepts it while it is valid, and for 30 more days after it ends.

  • A download token, for a machine that has no license yet: first installation, trial. The vendor gives it to you; it is in your name and valid until a date. The installation commands take it as an option (--jeton) and install it on the machine. On a machine already installed:

    sudo kanadr depot jeton poser        # then paste the token, Enter, Ctrl-D
    

    The command checks the token, installs it for apt and queries the repository. A license loaded afterwards takes over; the token is no longer needed.

The credential is kept in /etc/apt/auth.conf.d/kanadr.conf, readable by root only: apt presents it each time it reads the repository, whether the update comes from the portal or from sudo apt. Do not copy it elsewhere.

If the repository refuses (license missing or expired for more than 30 days, token expired): no new version is visible any more, and the Updates card of the Settings says so, “The update repository refuses this instance”; on the server, sudo apt update answers 401 Unauthorized. Load a valid license, or ask the vendor for a token; access comes back within a minute, without a restart. Calls are not affected.

In active/passive, the passive machine receives the credential from the active one with the file copy: it is updated first with nothing more to do.

Declaring the repository

The vendor’s repository is https://apt.kanadr.com. The VM image and the VPS installer declare it by themselves; do it by hand only on a VM created from an older image (no /etc/apt/sources.list.d/kanadr.sources file, no update ever reported) or on a machine installed another way:

sudo curl -fsSL https://apt.kanadr.com/kanadr.gpg \
    -o /usr/share/keyrings/kanadr.gpg
sudo tee /etc/apt/sources.list.d/kanadr.sources >/dev/null <<'EOF'
Types: deb
URIs: https://apt.kanadr.com
Suites: stable
Components: main
Signed-By: /usr/share/keyrings/kanadr.gpg
EOF
sudo apt update

If apt update answers 401 Unauthorized, the machine has no credential yet: see Access to the repository.

Being notified

The package list refreshes every day. When a newer version is waiting:

  • the Home page reports it under To do;
  • the health card of the diagnostics shows the installed version and the waiting one;
  • so does the Updates card of Settings (General tab), with the link to the release notes when the instance knows their address;
  • the kanadr_mise_a_jour_disponible metric goes to 1 (MiseAJourDisponible alert, see Monitoring).

From the portal

Wherever the new version is reported (Home, diagnostics health, Settings), an operator administrator sees Update. After confirming:

  1. the portal shows “update in progress”;
  2. a system service of the machine installs the offered version of the Kanadr package only, keeping your settings;
  3. Kanadr restarts (usually one to two minutes) and applies its database migrations; the portal reconnects by itself, then shows the result; Reload the portal loads the new version of the interface.

The telephony engine is not restarted: calls in progress continue. Those going through Kanadr itself at that moment (leaving or listening to a voicemail message, browser phone) may be interrupted: prefer a quiet time. The update is written to the audit log, its request and then its result.

Make a backup first; before any migration, Kanadr also takes a snapshot of its database (see below).

The update is not done, and the reason is shown, if:

  • it would install, upgrade or remove a package other than Kanadr: do it on the server;
  • the offered version is no longer in the repository (refresh the page);
  • the repository does not respond, or the installation fails: the end of apt’s log is shown under End of the update log.

If the machine stops during the installation, the update is marked interrupted: on the server, sudo dpkg --configure -a, then start it again.

The button does not appear, replaced by an explanation, when this installation cannot be updated from the portal: development installation, machine without systemd, update service disabled (sudo systemctl enable --now kanadr-mise-a-jour.path turns it back on), or active/passive, where the update is done manually (see below).

Automatic update

Disabled by default, it is set in Settings, General tab, Updates card: tick Update Kanadr automatically and choose the time window (3 am to 5 am suggested; it can span midnight, 11 pm to 4 am for example), in the instance’s time zone. As soon as a version is released, Kanadr updates itself within the window, the same way as with the button.

After a failure, or an update that could not be done, automatic update is suspended: the card says so, and it only resumes after an update started manually succeeds.

On the server

The update service is kanadr-mise-a-jour; its state and the end of its log are in /var/lib/kanadr-mise-a-jour/:

sudo systemctl status kanadr-mise-a-jour.path kanadr-mise-a-jour.service
sudo journalctl -u kanadr-mise-a-jour.service
cat /var/lib/kanadr-mise-a-jour/etat

Kanadr itself gets no extra rights: it only drops the wanted version in a folder of its own, and the update service checks the request before installing anything.

Updating on the server

  1. Back up first (Backup).
  2. sudo apt update && sudo apt install --only-upgrade kanadr (Kanadr only), or sudo apt update && sudo apt upgrade (Kanadr and the Debian packages). The Kanadr package only restarts its own service, which applies the database migrations; a Debian update may restart other services (PostgreSQL for example): pick a quiet time.
  3. Check the health in the portal (Diagnostics page).

Before any migration, Kanadr takes a snapshot of its own database in /var/backups/kanadr (the last three are kept). It is not a full backup: neither the telephony engine data, nor the keyring, nor the files are in it.

In active/passive: the passive first, then kanadr bascule ceder on the active (the promoted passive migrates the database), then the former active.

Call rules rewritten after an update

A version may change how Kanadr writes your customers’ call rules into the telephony engine: outbound routes, call flows, restrictions. At the first start after an update, Kanadr therefore rewrites them once for all customers, in the background: the portal answers at once, calls in progress are not affected and nothing is restarted.

If the telephony engine does not answer at that moment, nothing is written and Kanadr retries by itself, at growing intervals (a quarter of an hour at most). A customer whose rules cannot be rewritten does not hold up the others; the retry then covers that customer only. The operation appears in the audit log (action dialplans.republier) and in the service log:

sudo journalctl -u kanadr | grep -i republication

Going back to an earlier version

sudo apt install --allow-downgrades kanadr=<version>

The package of the target version first brings the database back to its schema, using the binary still installed; if this fails, the installed version is kept and restarts. Going back destroys the data of the undone migrations (the snapshot keeps it): make a full backup first. In active/passive, go back on the active.

Settings after an update

/etc/kanadr/kanadr.env is never rewritten by an update, and no question is asked. A new setting, always optional, appears commented out in the template /usr/share/kanadr/kanadr.env: compare it with your settings after an update.

Desktop softphone after the update

The version that brings the desktop softphone turns on the telephony engine’s WebSocket listener (127.0.0.1:5066) and restarts the extensions’ SIP profile when no call is in progress. On some machines, the listener only opens when the telephony engine is fully restarted: if the Diagnostic page reports the softphone closed, run sudo systemctl restart kanadr-moteur at an off-peak time (calls in progress are cut). The image does it by itself at first boot.