Phoebus Save-and-restore setup

The Phoebus Save-and-restore service is used by clients to manage configuration and snapshots of PV values. These snapshots can then be used by clients for comparison or for restoring PVs.

This guide focuses on installing and configuring the Save-and-Restore service on a single server.

For more details and documentation about Phoebus Save-and-Restore, you can examine the Save-and-restore official documentation.

Pre-requisites

  • Having a NixOS machine with a flake configuration.

If you’re not sure how to do this, you can follow the Creating an Archiver Appliance instance tutorial, which is a good introduction on how to make a NixOS VM.

If you have such a configuration, make sure that:

  • You have the epnix flake input

  • You have added epnix as an argument to your flake outputs

  • You have imported EPNix’ NixOS module

For example:

flake.nix
 {
   # ...
   inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05";
+  inputs.epnix.url = "github:epics-extensions/EPNix/nixos-24.05";

   # ...
   outputs = {
     self,
     nixpkgs,
+    epnix,
   }: {
     nixosConfigurations.nixos = nixpkgs.lib.nixosSystem {
       modules = [
+        epnix.nixosModules.nixos

         # ...
       ];
     };
   };
 }

Enabling the Phoebus Save-and-restore service

To enable the Phoebus Save-and-restore service, add this to your configuration:

phoebus-save-and-restore.nix
{lib, ...}: {
  services.phoebus-save-and-restore = {
    enable = true;
    openFirewall = true;
  };

  # Phoebus save-and-restore needs ElasticSearch.
  # If not already enabled elsewhere in your configuration,
  # Enable it with the code below:
  services.elasticsearch = {
    enable = true;
    package = pkgs.elasticsearch7;
  };

  # Elasticsearch, needed by Phoebus Save-and-restore, is not free software (SSPL | Elastic License).
  # To accept the license, add the code below:
  nixpkgs.config.allowUnfreePredicate = pkg:
    builtins.elem (lib.getName pkg) [
      "elasticsearch"
    ];
}

From the Phoebus graphical client side, add this configuration

phoebus-client-settings.ini
# Replace the IP address with your server's IP address or domain name
org.phoebus.applications.saveandrestore/jmasar.service.url=http://192.168.1.42:8080

Warning

URLs for future versions of Phoebus Save-and-restore will need to change to: http://192.168.1.42:8080/save-restore