8000 Add phoebus_save_restore role, with Molecule tests by ralphlange · Pull Request #106 · epics-training/training-vm · GitHub
[go: up one dir, main page]

Skip to content

Add phoebus_save_restore role, with Molecule tests - #106

Open
ralphlange wants to merge 1 commit into
epics-training:mainfrom
ralphlange:save-restore
Open

ralphlange wants to merge 1 commit into
epics-training:mainfrom
ralphlange:save-restore

Conversation

@ralphlange
Copy link
Copy Markdown
Contributor

Runs the Phoebus save-and-restore service - already built by the phoebus
role - as a systemd service: it stores configurations and snapshots in
Elasticsearch and serves the Phoebus "Save & Restore" application through
its REST API. Modelled on the phoebus_services_save_restore role of
ControlSystemStudio/ansible-phoebus.

  • pulls in the elasticsearch role; enabling it also runs the phoebus role
    and installs graphics
  • REST API on port 8080, context path /save-restore (the Phoebus client
    default): save_restore_url, a role default; the phoebus role uses the
    same name for the client's jmasar.service.url preference (replacing the
    hardcoded epics-services-tst URL), so one setting configures both;
    the role checks that the URL is http:// with an explicit port >= 1024
    (the service runs unprivileged), a trailing slash is ignored
  • overrides of the packaged application.properties in
    /etc/save-and-restore/save-and-restore.properties: Elasticsearch,
    port, Spring logging at INFO, built-in demo users for authentication
    (instead of upstream's site-specific Active Directory)
  • EPICS access for server-side snapshots/restores as documented for the
    service (which does not read the client's preferences): the wrapper
    sets -Djca.use_env=true and -DdefaultProtocol
    (save_restore_default_protocol, default ca), EPICS_* environment
    variables go into save_restore_epics_env (default: none, i.e. the
    EPICS defaults)
  • /usr/local/bin/save-and-restore wrapper (no procServ); after starting,
    the role waits for the REST API to report Elasticsearch as connected
    and asserts the service is running
  • enabled in everything.yml and ci-phoebus-aa.yml (QEMU role tests)

Molecule scenario on the systemd platform (x86_64 and aarch64) that
builds Phoebus and tests the service end to end through its REST API:
it creates a folder and a configuration with a local PV, lets the
service take and save a snapshot, and reads it back, finds it by search
and in Elasticsearch; it also checks that the EPICS settings reach the
service process. Described in the scenario's README.

Developed with the assistance of generative AI.

Runs the Phoebus save-and-restore service - already built by the phoebus
role - as a systemd service: it stores configurations and snapshots in
Elasticsearch and serves the Phoebus "Save & Restore" application through
its REST API. Modelled on the phoebus_services_save_restore role of
ControlSystemStudio/ansible-phoebus.

- pulls in the elasticsearch role; enabling it also runs the phoebus role
  and installs graphics
- REST API on port 8080, context path /save-restore (the Phoebus client
  default): save_restore_url, a role default; the phoebus role uses the
  same name for the client's jmasar.service.url preference (replacing the
  hardcoded epics-services-tst URL), so one setting configures both;
  the role checks that the URL is http:// with an explicit port >= 1024
  (the service runs unprivileged), a trailing slash is ignored
- overrides of the packaged application.properties in
  /etc/save-and-restore/save-and-restore.properties: Elasticsearch,
  port, Spring logging at INFO, built-in demo users for authentication
  (instead of upstream's site-specific Active Directory)
- EPICS access for server-side snapshots/restores as documented for the
  service (which does not read the client's preferences): the wrapper
  sets -Djca.use_env=true and -DdefaultProtocol
  (save_restore_default_protocol, default ca), EPICS_* environment
  variables go into save_restore_epics_env (default: none, i.e. the
  EPICS defaults)
- /usr/local/bin/save-and-restore wrapper (no procServ); after starting,
  the role waits for the REST API to report Elasticsearch as connected
  and asserts the service is running
- enabled in everything.yml and ci-phoebus-aa.yml (QEMU role tests)

Molecule scenario on the systemd platform (x86_64 and aarch64) that
builds Phoebus and tests the service end to end through its REST API:
it creates a folder and a configuration with a local PV, lets the
service take and save a snapshot, and reads it back, finds it by search
and in Elasticsearch; it also checks that the EPICS settings reach the
service process. Described in the scenario's README.

Developed with the assistance of generative AI.
@georgweiss georgweiss left a comment •
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ralphlange, default port (8080) is the same for alarm logger and save-n-restore. For both services one can override this with JVM option -Dserver.port=<my favourite port>.

@ralphlange
Copy link
Copy Markdown
Contributor Author

The question is: what should we use on the Training-VM?

I would like to have stable (different) ports for the two services on the VM to avoid having to resolve the conflict every time.

@georgweiss
Copy link
Copy Markdown

If the training VM controls both services and Phoebus (including settings file) any port strategy would be "stable" by design. Or am missing something?

@ralphlange
Copy link
Copy Markdown
Contributor Author

True.
So the question is: What should be the port strategy?

@georgweiss
Copy link
Copy Markdown

How about:

  • Alarm Logger: 10000
  • Channel Finder: 10100
  • Olog: 10200
  • Save & restore: 10300

As for archiver... @jacomago might want to have a saying.

@jacomago
Copy link
Copy Markdown

Archiver is silly with default of 17665 for mgmt 17668 for retrieval. Not best, but is historical ports.

@shroffk
shroffk commented Nov 23, 2026
Copy link
Copy Markdown
Contributor

Ok,
there is already an ongoing discussion with CEA about default ports so I will try to merge these 2

also,
for the save and restore why can't we use
https://github.com/ControlSystemStudio/ansible-phoebus/tree/main/roles/phoebus_services_save_restore

@ralphlange
Copy link
Copy Markdown
Contributor Author

also, for the save and restore why can't we use https://github.com/ControlSystemStudio/ansible-phoebus/tree/main/roles/phoebus_services_save_restore

Already mentioned in one of the other tickets:
I looked at those roles, found them not in the state I would expect for a shared role, and decided to base the Training-VM roles on the matching ones from that set to make converging as easy as possible.
Ah, yes: Goal was to have the set of Training-VM roles ready (reasonable PRs) by yesterday.

@shroffk
shroffk commented Nov 23, 2026
Copy link
Copy Markdown
Contributor

Ok
I know the alarm services were not split up but I thought the save and restore was possible... anyway I understand the urgency for now and will use these as requirements.

@ralphlange
ralphlange commented Nov 23, 2026 •
Copy link
Copy Markdown
Contributor Author

Molecule tests?
Reasonable names?
Documentation?

But that's a discussion for that repository, not this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

0