Search by

webksde / drowl_upsi

webksde

Supports the DROWL Drupal Updateservice: Drush-driven start/finish workflow with backups, git commits, maintenance mode, URL checks and customer notifications.

Package info

gitlab.com/webksde-public/drupal/drowl_upsi

Homepage

Issues

Type:drupal-module

pkg:composer/webksde/drowl_upsi

Statistics

Installs: 103

Dependents: 0

Suggesters: 0

Stars: 0

0.0.16 2026-11-20 18:14 UTC

README

Supports the DROWL Drupal Updateservice. Updates are done with composer and Drush via SSH. This module performs the Drupal side tasks before and after composer update:

drush upsi-start   →   composer update   →   drush upsi-finish

The Updateservice is controlled via Drush. The admin page (/admin/config/development/drowl-upsi, permission administer drowl_upsi) shows the settings, the mail templates and the protocol (see Admin page).

Requirements

  • Drupal ^10.6 or ^11.4, Drush 13 (or 14), Backup and Migrate ^5.1. Drupal 10 support will be deprecated soon (Drupal 10 end of life); it uses procedural hook bridges (drowl_upsi.module, drowl_upsi_requirements()).
  • A configured and writable private file system ($settings['file_private_path']). The module cannot be installed without.
  • The base URL of the site must be set (site_url, e.g. drush drowl_upsi:config-set site_url https://www.example.com). All commands of the module use it for URLs (mails, URL check, Drush subprocesses), so neither --uri nor options.uri in drush.yml is needed. On multisite installations --uri is still needed to select the site.
  • system.site:mail must be set (sender of the mails).
  • The number of modules included in the contract (module_limit) must be set, e.g. drush drowl_upsi:config-set module_limit 150. It is empty after installing; until it is set, the module count is not shown in the status report and the success mail. Update 11002 clears the former default 150 on existing sites (other values are kept), so it is set from the contract.
  • A composer update history in <composer-root>/log/composer-update-history.md (the directory of composer.json): composer-lock-diff tables, each entry starting with a heading written by a composer script. Recommended script (locale independent date):

    "echo \"# `date +%FT%T%z` (`whoami`):\" >> log/composer-update-history.md"
    

    Supported dates: ISO 8601 (2026-11-17T10:14:32+0100, also date -Iseconds), and the English or German output of date without format (Tue Nov 17 10:14:32 AM CET 2026, Fr 21. Mär 17:10:33 CET 2025).

  • The project root must be a git repository. If the backup directory (private://backup_migrate/drowl_upsi) is inside the repository, it must be excluded via .gitignore.
  • Optional: the core module update (Update Status) for the list of available updates. Without it, the update check steps are skipped.

Run the commands in an interactive SSH session (ssh -t). Without a terminal, all questions are answered with their default (like --no-interaction).

Workflow

drush upsi [--no-mail] (or upsi-start)

  1. Welcome message and login: the operator's DROWL team member initials (2-5 letters, e.g. jd for John Doe) and the password (known to the DROWL team). The initials are turned into the e-mail address jd@webks.de, which is logged as user of all entries of the run. Three attempts; every attempt is logged (never the password). The login is asked even with -y, as long as there is a terminal. Without a terminal, set the environment variables DROWL_UPSI_OPERATOR (initials) and DROWL_UPSI_PASSWORD. There is no command line option, and the password should never be typed on the command line either (shell history); set it with read -rs DROWL_UPSI_PASSWORD && export DROWL_UPSI_PASSWORD. Failed attempts only log the e-mail address if the initials are valid.
  2. Lock, preflight (see below).
  3. If a run is already active: question "Restart?". A restart creates a new run; the maintenance mode state from before the first start is kept.
  4. New run: run ID, token, start time.
  5. update_check: list available updates, security updates first (red). Informative only.
  6. url_check: every URL must return 200 (after redirects), otherwise abort. If the site is already in maintenance mode, a 503 counts as "not checkable (maintenance mode)": a warning, the start proceeds.
  7. config_export: drush config:export -y.
  8. git_commit: git add -A and commit "DROWL Updateservice #ID: state before update" (no push). New, untracked files are listed before the commit, so unexpected files (dumps, credentials) are noticed; check them and the .gitignore before pushing.
  9. backup: database backup "BEFORE".
  10. maintenance_mode: enable maintenance mode, clear the page cache.
  11. composer_dry_run: composer update --dry-run in the composer root. Checks that the dependencies can be resolved and lists the packages that would change; on failure the start stops (run stays active). A dry run does not install anything, so patches are not applied or checked; with composer-exit-on-patch-failure (composer-patches 1.x; always in 2.x), a failing patch stops the real composer update and upsi-finish is not run.
  12. mail: show recipients, ask, send the start mail.
  13. Shows the next command between two lines, easy to copy (triple click), and copies it to the clipboard of your local terminal (OSC 52; iTerm2, Windows Terminal, kitty, WezTerm, Alacritty, tmux with set-clipboard on; other terminals ignore it):

    composer update && drush upsi-finish
    

    Run it in the project directory; upsi-finish only runs if composer update succeeded.

The whole update in one line, without a pause between start and finish (each command only runs if the previous one succeeded):

drush upsi-start && composer update && drush upsi-finish

If a run is already active and you decline "Restart?", upsi-start still succeeds and the chain continues with the active run; press Ctrl+C to stop.

drush upsi-finish [--no-mail]

Requires an active run. After an error the whole workflow is started again; all steps can be repeated.

  1. Lock, preflight.
  2. history_check: all entries of the composer update history written since the start of the run, with their combined production changes. Warning and question if there is none or the date of the last entry cannot be read.
  3. git_commit_composer: commit "DROWL Updateservice #ID: composer update".
  4. updb: drush updatedb -y. Abort on error.
  5. config_export.
  6. git_commit_config: commit "DROWL Updateservice #ID: database updates and config export".
  7. backup: database backup "AFTER".
  8. cache_rebuild: drush cache:rebuild.
  9. locale_update: drush locale:check and locale:update (only if locale is enabled; errors are warnings). The imported files are not listed; only the summary (e.g. "3 translation files imported. …") and warnings are shown. The full output is stored in the protocol entry.
  10. requirements_check: errors of the status report (informative only).
  11. url_check with maintenance mode bypass. On failure: abort (default), retry or continue. URLs of other hosts get no bypass header; their 503 counts as "not checkable (maintenance mode)" (warning, in the summary).
  12. update_check: remaining updates.
  13. module_count: active modules / included modules.
  14. Summary banner before the site goes online again: green if there were no warnings, otherwise yellow with all warnings of the preflight and the steps (e.g. failed URLs continued, status report errors, security updates).
  15. maintenance_disable: question whether to disable the maintenance mode. If the site was already in maintenance mode before the start, the default is "no" and the maintenance mode is kept with -y.
  16. mail: question for the success mail. If declined: question for a notice mail with a single-line note (empty input: no mail).
  17. End of run, total duration.

If upsi-finish fails to bootstrap after composer update (stale container), run drush cache:rebuild and then drush upsi-finish again.

Questions, -y, --no-interaction and --no

  • -y / --yes: all questions are answered with "yes", including the mails. Exceptions: the URL failure choice (default "abort") and the maintenance mode if it was enabled before the start (it stays enabled).
  • --no-interaction: all questions take their default. The defaults are "yes", except for the two exceptions above, so the result is the same as -y.
  • --no: all questions are answered with "no": no mails, the maintenance mode stays enabled.

Preflight

Runs at the beginning of start and finish and as drush drowl_upsi:preflight. Errors abort; on warnings you are asked whether to continue. Below the table, "How to fix" lists the fix for every error and warning, mostly as a ready to run command (e.g. drush drowl_upsi:config-set urls '…').

CheckResult
Directory is a git repositoryError
Current branch (detached HEAD)Warning
Private file system (including the backups) ignored by git, if inside the repositoryError
Private file system, backup destination and profile drowl_upsiError
Settings valid according to the configuration schema (e.g. after a config import)Error
Base URL (site_url) setError
Drush URI (--uri) differs from site_urlWarning
system.site:mail setError
URL list not empty (if url_check is enabled)Error
Recipient list empty (mail steps are skipped)Warning
Modules included (module_limit) setError
log/composer-update-history.md missing (normal before the first update)Warning
log/composer-update-history.md inside the web root (may be readable via the web)Warning

Errors and abort

On an error the workflow stops and the run stays active (maintenance mode included). Fix the problem and run the command again (upsi-start restarts, upsi-finish repeats all steps), or abort with drush upsi-abort.

upsi-abort asks whether to disable the maintenance mode (same rules as in finish), ends the run and logs run_abort.

The module does not restore databases. The backups are regular Backup and Migrate backups and can be restored with Backup and Migrate. Note that restoring the BEFORE backup also restores the active run (State); end it with drush upsi-abort afterwards.

Drush commands

CommandAliasDescription
drowl_upsi:start [--no-mail]upsi, upsi-startStart, see above
drowl_upsi:finish [--no-mail]upsi-finishFinish, see above
drowl_upsi:statusupsi-statusActive run, duration, maintenance mode, module count
drowl_upsi:abortupsi-abortAbort the active run
drowl_upsi:preflightRun all preflight checks without changing anything
drowl_upsi:url-checkCheck the URLs (with bypass header during a run)
drowl_upsi:config-get [KEY]Show all settings or one (dot notation)
drowl_upsi:config-set [KEY VALUE]Change a setting (login like upsi-start); without arguments, list all settings with format, example and current value
drowl_upsi:mail-preview TYPE [--note=]Render start, success or notice without sending
drowl_upsi:mail-test TYPE [--note=]Send to the DROWL recipients (BCC) only, subject [TEST] …
drowl_upsi:log [--limit=50] [--run=ID]Protocol including user, system user and git user
drowl_upsi:module-countActive modules / included (-v lists them)

start, finish and abort use a lock (drowl_upsi.command), so they cannot run in parallel. If the command is interrupted (Ctrl+C, lost SSH connection, kill), the lock is released and the interruption is logged (needs the PHP extension pcntl). After kill -9 the lock stays until it expires (2 hours); the error message shows the command to release it.

Configuration (drowl_upsi.settings)

KeyDescription
site_urlBase URL of the site (required), e.g. https://www.example.com
recipientsCustomer e-mail address(es) (contract)
module_limitNumber of modules included in the Updateservice (contract, required, empty after installing; 0 = unlimited)
urlsURLs to check in addition to the base URL (contract, optional), e.g. the contact and the imprint page. The base URL is always checked first. Each must return 200 after following up to 5 redirects; redirected URLs pass, the URL table notes the redirect and the final URL. The list must not contain duplicates or the base URL (compared without trailing slash, scheme and host case-insensitive); update 11004 removes them from existing settings
bccDROWL recipients (BCC): receive all mails as BCC, the mail-test mails and a notification of every settings change
reply_toReply-To address (empty: none)
steps.start.*, steps.finish.*Enable/disable each step (true/false)

A disabled step is shown as "skipped (disabled)" and logged.

Every change of the settings is logged (type config) with the old and new values, the source (settings form, YAML import, drush, config import) and the user, whatever way the settings were changed. It is also mailed to the DROWL recipients (BCC) before and after the change (internal mail in English, logged as mail config_change; not on install).

Required: site_url and module_limit (the preflight reports missing values as errors; config-set without arguments marks them). In the settings form, an empty site_url is prefilled with the URL of the site in the browser. The overview and the settings form warn if the saved site_url differs from the URL they are opened at (host and path; the scheme is not compared, as it is unreliable behind proxies terminating HTTPS). Expected on development or staging copies of the site.

config-set accepts the keys above in dot notation and validates them against the configuration schema (URLs, e-mail addresses, integers, booleans). On an error nothing is saved. Saving asks for the same login as upsi-start (initials and password; without a terminal DROWL_UPSI_OPERATOR and DROWL_UPSI_PASSWORD), so the change is logged with the operator. drush drowl_upsi:config-set without arguments (no login needed) lists all keys with their format, an example and the current value. Lists are comma separated:

drush drowl_upsi:config-set urls "https://example.com/kontakt,https://example.com/impressum"
drush drowl_upsi:config-set recipients "kunde@example.com, chef@example.com"
drush drowl_upsi:config-set recipients ""            # empty list
drush drowl_upsi:config-set reply_to updateservice@drowl.de
drush drowl_upsi:config-set module_limit 200
drush drowl_upsi:config-set steps.finish.locale_update false

Admin page

Everybody with the permission administer drowl_upsi sees the status, the settings (collapsed) and the mail templates. The protocol has its own page (tab "Protocol", …/drowl-upsi/protocol, 50 entries per page). The user column combines the Drupal user or Drush operator, the system user and the git user. The data of an entry (e.g. complete mails) opens in a dialog: values as list, multi-line values (mails, command output) as preformatted code with their line breaks.

Everybody with the permission sees the buttons "Edit settings" and "Import contract data (YAML)". Saving either form requires the DROWL team login, the same as for upsi-start and config-set: the initials (e.g. jd) and the password. Every attempt is logged; the change is logged with the operator (e.g. jd@webks.de) and mailed to the DROWL recipients (BCC). While the initial configuration is incomplete (recipients or a required setting missing, e.g. after update 11002 cleared module_limit), the overview shows what is missing. The forms have their own pages (…/drowl-upsi/settings, …/drowl-upsi/import, one form per page, so admin themes moving the form actions, e.g. Gin, work). Leaving a form with unsaved changes asks for confirmation (the browser's own dialog).

The password is a simple hurdle against accidental use and a way to know who changed something, not a security measure: it is stored as an unsalted hash in this public code and can easily be recovered. The actual protection is the restricted permission administer drowl_upsi for the admin page and shell access for Drush.

Contract import (YAML)

Only the contract data can be imported, no technical settings. The keys are the configuration keys; only the given keys are changed:

recipients:
  - kunde@example.com
module_limit: 150
urls:
  - https://www.example.com/kontakt
  - https://www.example.com/impressum

Mails

The mail texts are part of the module (German, plain text): templates/mail/start.txt.twig, success.txt.twig and notice.txt.twig. Sender: DROWL Updateservice – Site name <site mail> (the address stays the site mail because of SPF/DKIM; answers go to reply_to).

Subjects: ⏳ DROWL Updateservice: Gestartet – Site name (URL), ✅ DROWL Updateservice: Abgeschlossen – … and ⚠️ DROWL Updateservice: Hinweis – ….

Each template provides the blocks subject and body. They are rendered directly with Twig, not through the theme layer: themes cannot override them and Twig debug output never ends up in mails. Escaping is disabled ({% autoescape false %}), because the mails are plain text. Changes to the texts reach all sites with the next module update.

VariableContent
site_name, site_urlSite name and absolute front page URL (based on the site_url setting)
changesProduction changes of all history entries since the start of the run, combined into one table (first "From", last "To" per package; dev changes left out); empty if none
changes_dateDate of the last of these entries
module_count, module_limitActive modules and included modules (module_limit: empty if not set, ∞ if 0)
module_limit_exceededWhether the limit is exceeded
backup_before, backup_afterWhether the backup steps are enabled
start_date, finish_dateStart and end of the run
reply_toReply-To address
noteNote of the notice mail

Mails are sent through the active mail system. Avoid text in angle brackets (<…>) in the templates: core mail plugins convert the body with htmlToText(), which removes it. Long table lines may be wrapped by the mail system.

Modules counted: all installed modules except core modules, the installation profile and drowl_upsi itself. Once module_limit is set, the status report shows the count and lists the counted modules (machine names), like drowl_modulecount.

Maintenance mode

While a run is active, the maintenance page shows a fixed text (German for de, English otherwise). The configured maintenance message is never changed, so it cannot end up in a config export; it is active again as soon as the run ends.

During a run, the URL check sends the header X-Drowl-Upsi-Token (random token of the run) to URLs with exactly the scheme, host and port of site_url only, never to other hosts. Requests with a valid token bypass the maintenance mode and are never served from or stored in the page cache or the dynamic page cache. Visitors still get the maintenance page. The token is replaced at the end of upsi-start, at the beginning and end of upsi-finish and after drowl_upsi:url-check, so a token from a log or a backup is useless.

Installation and uninstallation

Installing creates:

  • the directory private://backup_migrate/drowl_upsi,
  • the Backup and Migrate destination drowl_upsi (directory, unlimited retention),
  • the Backup and Migrate settings profile drowl_upsi (gzip, no data for cache_*, search_api_db_*, search_dataset, search_index, search_total, batch, cachetags, flood, history, semaphore, sessions, watchdog). Backup and Migrate compares the real table names, so each entry is also listed with the DROWL table prefix wd_ (wd_sessions, wd_cache_*, …); the prefix of the active database connection is added at backup time as well. Update 11001 adds these entries to existing profiles (custom entries are kept).

Existing destination or profile entities with these IDs are reused.

Default bcc and reply_to: updateservice@drowl.de. Update 11003 replaces the former default drupal@webks.de on existing sites (other addresses are kept).

Uninstalling removes the protocol table. The destination, the profile and all backups are kept.

Development

Static analysis with PHPStan at level 2 (the module's phpstan.neon), from the project root:

vendor/bin/phpstan analyse -c web/modules/custom/drowl_upsi/phpstan.neon web/modules/custom/drowl_upsi

The project's phpstan.neon can include the module's file (includes: [web/modules/custom/drowl_upsi/phpstan.neon]) for its scanFiles; the project's own level then applies.

Tests (kernel, functional and Drush tests) run on Drupal ^10.6 and ^11.4:

vendor/bin/phpunit web/modules/custom/drowl_upsi/tests