8000 Add Olog electronic logbook: mongodb, phoebus_olog and phoebus_olog_webclient roles by ralphlange · Pull Request #104 · epics-training/training-vm · GitHub
[go: up one dir, main page]

Skip to content

Add Olog electronic logbook: mongodb, phoebus_olog and phoebus_olog_webclient roles - #104

Open
ralphlange wants to merge 3 commits into
epics-training:mainfrom
ralphlange:olog
Open

ralphlange wants to merge 3 commits into
epics-training:mainfrom
ralphlange:olog

Conversation

@ralphlange
Copy link
Copy Markdown
Contributor

Summary

This PR adds the Olog electronic logbook to the Training-VM. It has three new roles: the Olog service, its MongoDB attachment storage, and the Olog web client. When the roles are enabled, the Phoebus logbook is set up to use Olog. The roles are modelled on the matching phoebus_services_* roles of ControlSystemStudio/ansible-phoebus, adapted to this repo's conventions:

  • Everything is installed from release archives, nothing is cloned.
  • Service roots live under /opt/epics-tools.
  • Architecture tokens are in vars/arch (x86_64 and aarch64), with no hard-coded architecture names.

New roles

  • mongodb: MongoDB 8.0.38 as a systemd service. Single node, listening on localhost only, no authentication. Olog stores its attachments here.
    • Installed from MongoDB's generic release archive and checked against the published .sha256.
    • The build is picked by distro: Ubuntu builds on the Debian family (MongoDB has no Debian build for aarch64), RHEL 9.3 builds on Rocky 9 and Fedora, RHEL 10 builds on EL10.
    • The WiredTiger cache is limited to 0.25 GB.
  • phoebus_olog: Olog v6.0.3 as a systemd service under an unprivileged olog user. Log entries go to Elasticsearch and attachments to MongoDB, so the role depends on java, elasticsearch and mongodb.
    • The source comes from the release tarball (GitHub publishes no binary release files for Olog) and is built with Maven, using the Maven install from the phoebus role.
    • HTTP on port 4180 (olog_url), HTTPS on port 4181 with Olog's self-signed certificate. These are the same ports ansible-phoebus uses.
    • Built-in accounts user/userPass and admin/adminPass, instead of ansible-phoebus's Active Directory login.
    • /opt/epics-tools/config/olog.properties holds only the settings that differ from Olog's defaults. Cross-origin (CORS) requests from the web client's address are allowed.
    • Adds a /usr/local/bin/olog wrapper. After starting the service, the role waits until Olog's REST API reports that it is connected to Elasticsearch.
  • phoebus_olog_webclient: Olog web client v2.8.0, also built from its release tarball. It is served on port 3000 as a systemd service under an unprivileged user, using the serve package with fallback to index.html for the app's own page links.
    • Node.js 22 LTS comes from the nodejs.org release archive and is checked against SHASUMS256.txt. Vite 7 needs at least 22.12.
    • The web client is built once by the role, not at every service start. The Olog URLs are compiled into the build, so changing them triggers a rebuild.
    • Adds a link on the Training-VM homepage. Depends on phoebus_olog.

Olog and the web client keep track of the unpacked version with a marker file in their source directory. On a version change, the source directory is replaced and rebuilt from scratch, so files from two versions never mix.

Changes to existing files

  • phoebus: when phoebus_olog or phoebus_olog_webclient is enabled, preferences.ini uses the olog-es logbook with olog_url and the default logbook operations. With the web client enabled, it also sets web_client_root_URL. Otherwise the logbook stays inmemory.
    • olog_url and olog_webclient_url have the same names in the client and the service roles, so setting them once in a setup file configures both consistently.
  • elasticsearch: only descriptions changed, since the role now also serves Olog.
  • Wiring:
    • playbook.yml and group_vars/all.yml get the three roles.
    • arch.mongodb and arch.nodejs tokens are added to vars/arch/*.yml.
    • The roles are enabled in everything.yml and ci-phoebus-aa.yml, and listed as commented-out options in local.yml.sample.
    • ansible/roles/README.md describes the new roles.
  • 8000

Testing

  • Molecule: each new role has a functional test scenario on the shared systemd container (ansible/molecule/systemd), run on x86_64 and aarch64. The individual tests are listed in each role's molecule/README.md.
    • mongodb: service state, listening on localhost only, unprivileged user, server version, and a hello command sent with a small MongoDB protocol client.
    • phoebus_olog, end to end through the REST API:
      • both backends connected, the HTTPS port answers, and the default logbooks exist;
      • writes without credentials are refused (401), and the built-in accounts can log in;
      • a log entry with an attachment, sent the way the clients send it, can be found by a text search, and the attachment can be read back from MongoDB;
      • cross-origin requests from the web client's address are allowed.
    • phoebus_olog_webclient: the services run and the app is served, including its own page links. The build contains the Olog URL with no leftover placeholders, and cross-origin requests and a login from the web client's address work.
  • QEMU role tests: ci-phoebus-aa now includes Olog and the web client, and changes to the new roles trigger test-roles-phoebus-aa.yml.
  • CI on the fork (e39ed89):
    • Run molecule tests: ✅ all 22 jobs passed, including the three new roles on both architectures
    • Build Cloud-Init VM Images: ✅
    • Roles: Phoebus & AA: ✅ Rocky, Fedora, Debian and Ubuntu (x86_64). Rocky passed on a re-run: the first attempt failed in the Phoebus build (unchanged by this PR) because a Spring Boot POM couldn't be downloaded from Maven Central.

Developed with the assistance of generative AI.

MongoDB (single node, localhost only, no authentication) as a systemd
service - the attachment storage of Olog.
Modelled on phoebus_services_mongodb of ControlSystemStudio/ansible-phoebus
(service root under /opt/epics-tools/services/mongodb with data/ and logs/),
but installed from MongoDB's generic release archive:

- MongoDB 8.0.38, verified against the published .sha256
- Ubuntu builds on the Debian family (Debian has no aarch64 build),
  RHEL 9.3 builds on Rocky 9 and Fedora, RHEL 10 builds on EL10
- arch.mongodb token in vars/arch
- WiredTiger cache limited to 0.25 GB
- after starting, the role waits for the port and asserts the service
  is running (with journal/log diagnostics on failure)

Molecule scenario on the systemd platform (x86_64 and aarch64):
service state, localhost-only listener, unprivileged user, server version,
and a "hello" command sent with a minimal wire protocol client;
described in the scenario's README.

Developed with the assistance of generative AI.
Runs the Olog electronic logbook service as a systemd service,
modelled on phoebus_services_phoebus_olog of ansible-phoebus.

- download the Olog v6.0.3 release tar and build it with Maven (from the phoebus role;
  log entries go to Elasticsearch (elasticsearch role),
  attachments to MongoDB (mongodb role), add both dependencies
- plain HTTP on port 4180 (olog_url, shared with
  the client preferences), HTTPS with Olog's self-signed certificate on
  4181 - same ports as ansible-phoebus
- in-memory authentication: built-in accounts user/userPass and
  admin/adminPass (instead of ansible-phoebus' Active Directory)
- /opt/epics-tools/config/olog.properties only holds overrides
  (spring.config.additional-location);
  CORS allows the web client's origin (olog_webclient_url)
- /usr/local/bin/olog wrapper; after starting,
  the role waits for the REST API to report Elasticsearch as connected
  and asserts the service running
- when enabled, the phoebus role configures the Phoebus logbook to use
  Olog (olog-es factory, default logbook "operations")
- enabled in everything.yml and ci-phoebus-aa.yml (QEMU role tests)

Molecule scenario on the systemd platform (x86_64 and aarch64)
that builds Olog and tests it end to end through the REST API:
service info with both backends, HTTPS port, default logbooks, authentication,
login with the built-in accounts, and a log entry with an attachment created
multipart (as the clients do), found by a text search and read back from
MongoDB; described in the scenario's README.

Developed with the assistance of generative AI.
Builds the Olog web client and serves it as a systemd service,
modelled on phoebus_services_phoebus_olog_webclient of ansible-phoebus.

- build service once (not at every service start)
- Node.js 22 LTS (Vite 7 needs >= 22.12) from the nodejs.org release
  archive, verified against SHASUMS256.txt; arch.nodejs token in vars/arch
- web client v2.8.0 from its release tar; the Olog URLs (olog_url) are compiled into the build
  through .env.production.local, so changing them triggers a rebuild
- served by "serve" (single page application fallback) on port 3000
  (olog_webclient_url), as an unprivileged user;
  after starting, the role waits for the page to be served
- linked on the Training-VM homepage; the Phoebus logbook gets the web
  client's URL (web_client_root_URL)
- pulls in the phoebus_olog role
- enabled in everything.yml and ci-phoebus-aa.yml (QEMU role tests)

Molecule scenario on the systemd platform (x86_64 and aarch64):
services, the served application and its client-side routes,
the Olog URL in the build (no placeholders left),
and CORS requests and a login from the web client's origin;
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.

Ideally I'd like to run a test, can you wait for that?

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.

2 participants

0