Site Entity in Core

Created on 8 May 2024, 8 months ago
Updated 9 May 2024, 8 months ago

Problem/Motivation

A client needed a way to track multiple sites in a central location. They have many ongoing support contracts and need a way to find information they need to solve problems for their customers.

The basic requirements were:

  1. Store a list of sites and customers in a Drupal site (it was called Drupal Support Dashboard, DSD).
  2. Create an open source module that can send site info to the DSD. Create a REST endpoint for receiving this information and storing it for display.
  3. Create some views to easily search and browse sites and raise sites with issues such as cron isn't running.
  4. Allow users to login to sites remotely.

Out of this came the Site.module β†’ . It provides:

  1. A config entity called "SiteDefinition" that stores a few useful things like git URL and canonical URL. (Actually removed in 2.x but now I realize it should be put back.
  2. A content entity called "Site" that stores information about your site like URL, Drupal Site Title, and PHP version.
  3. Site entity is fieldable, allowing content to be stored without needing content types or other entities. Fields are sent along with the Site entity, if desired.
  4. Site entity is revisionable, providing a history of the site.
  5. A "State" and "State Reason" field that stores a single integer indicating the overall state of the site. The Drupal core status report and Site Audit module is used to affect state, and other plugins can be written.
  6. Creating a site entity checks the URL, saving the result to State. Information like expired certificates is saved.
  7. SiteProperty plugins load useful data into Field API fields. Many default plugins were written: https://git.drupalcode.org/project/site/-/tree/2.x/src/Plugin/SiteProper...
  8. Remote login is provided by SiteAction plugins. They provide the ability for one site to affect another. SiteAction plugins have the methods form() and apiResponse(). The form is presented on the Site Manager and POSTs to a Site, which returns the data via the apiResponse() method.
  9. Site API: A JSON:API endpoint for retrieving site entity data and POSTing SiteActions, both for client sites and Site Manager sites.
  10. Site Manager Connection: Add a URL of a Site Manager site to send the site entity on various events, such as cron, cache clear, or config changes.
  11. Remote config and state control. A Site Manager can send values to client sites to override config and state.

Proposed feature

TBD

Remaining tasks

TBD

User interface changes

TBD

API changes

TBD

Data model changes

TBD

Release notes snippet

TBD

✨ Feature request
Status

Active

Version

11.0 πŸ”₯

Component
BaseΒ  β†’

Last updated about 13 hours ago

Created by

πŸ‡ΊπŸ‡ΈUnited States Jon Pugh Newburgh, NY

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024