drupal-ping

This provides a _ping.php file which can be used in load balancers to check if the instance is ok

MIT License

Downloads
207.5K
Stars
3
Committers
13

Bot releases are visible (Hide)

drupal-ping - Rename custom ping script Latest Release

Published by ragnarkurmwunder about 1 year ago

Renamed _ping.custom.php to _ping.custom.example.php to avoid delays in misconfigured systems.
composer.json must contain a proper dropin-paths configuration or this package will pollute the webroot.

drupal-ping - Better Memcached handling. +Improvements

Published by ragnarkurmwunder over 1 year ago

  • Produce 'warning' instead of 'error' if Memcached fails. Reason: Drupal still keeps going, although slower.
  • Add Drupal logging if available. Reason: Not all systems use syslog() or error_log().
  • Capture output during the checks execution phase and display it. Reason: Sometimes if anything produces unexpected output that spoils response headers. So need to handle them differently.

Credits go to @hkirsman for the improvements of this release!

drupal-ping - Dev env refactor. Remove some mtime code.

Published by ragnarkurmwunder over 1 year ago

  • Remove test file existence checking. It was fixed by keeping mtime in the filename.
  • README: Refactor development and testing documentation
  • Update tests
  • Refactor testing environment
drupal-ping - NFS mtime fix

Published by ragnarkurmwunder over 1 year ago

Fix the NFS mtime issue by storing the timestamp in the filename.

drupal-ping - NFS weirdnesses handling

Published by ragnarkurmwunder over 1 year ago

Try to handle NFS shortcomings that show up especially when the ping is executed very frequently on a multi-container environment, in parallel. The main problems are:

  • Filesystem test tiles show up much later after the creation, so immediate file operations on that file would fail.
  • Mtime on those test files is random, usually much less than a current timestamp. This prevents ping to understand if the file is a leftover from some earlier execution or from a running parallel ping.
drupal-ping - D10 compatibility

Published by ragnarkurmwunder over 1 year ago

  • Added D10 constraint to the info file
drupal-ping - Bugfix

Published by ragnarkurmwunder over 2 years ago

Ping failed when it could not write to the public dir.
This is fixed now and covered by two new additional tests.

drupal-ping - Improvement

Published by ragnarkurmwunder over 2 years ago

  • Env variable values containing newlines provide inconsistent debug tokens. Fixed.
drupal-ping - Tuning

Published by ragnarkurmwunder over 2 years ago

Tuning

  • Do not use GIT or PHP prefixes for the debug token calculation. They tend to differ between web and shell. This would lead to a situation where the shell-generated token is unusable over the web.
drupal-ping - Refactor

Published by ragnarkurmwunder over 2 years ago

Refactor

  • Refactor error messages into JSON for easier automation
  • Refactor debug token generation
drupal-ping - 2.2.2: Fix: Filesystem Cleanup

Published by ragnarkurmwunder over 2 years ago

Fix

  • Filesystem cleanup check results in a warning (not an error anymore) if leftover files were discovered and cleaned up.

Improvement

  • README
drupal-ping - 2.2.1: Fix

Published by ragnarkurmwunder over 2 years ago

Improvements

  • Fix missing drupal/drupal require from composer.json
  • Development environment improvement
drupal-ping - Add Filesystem cleanup checker

Published by ragnarkurmwunder over 2 years ago

New features

  • Add Public filesystem Cleanup checker. Clean up leftover files by 'Create a file in public filesystem checker'. Sometimes when a (network-based) filesystem crashes or has other problems, temporary test files start to accumulate. This checker cleans them up, and reports errors.
  • Add Psalm code scanner to keep the pinger in good shape.
drupal-ping - Refactor, tests

Published by ragnarkurmwunder over 2 years ago

Improvements

  • Add PhpUnit tests with max coverage.
  • Apply code scanners: PHP syntax checking, phpcs (standards, PHP compatibility), phpstan
  • Refactor Lando testing env
  • More sophisticated debug code generation
  • Strict type checking
  • Turn code into classes for better testing and architecture
  • Fix handful of small bugs (revealed by tests)
  • Commandline php _ping.php defaults to debug mode, and reveals the debug token.
  • No functional changes.
drupal-ping - Refactor, debugging, elasticsearch

Published by ragnarkurmwunder over 2 years ago

Breaking changes

  • composer.json needs a different syntax - see README.

New features

  • Debugging option - allows seeing time profile and statuses of individual checks
  • Service exposure protection
  • Time profiling
  • Improved logging, Lando is supported now
  • Logs slow checks
  • Memcache cluster support, connection check by low-level PHP functions (faster)
  • Elasticsearch support, by curl(), cluster support, advanced configurability
  • Filesystem check is now split in two: create and delete
  • Individual check status tracking
  • For _ping.php developers there is now Lando testing env. See README.

Example of debug output

https://example.com/_ping.php?debug=hash

Look up the hash value in README.

INTERNAL ERROR 500

db                   error      result_count=0 expected=1 Master database invalid results.
memcache             disabled   
redis                disabled   
elasticsearch        disabled   
fs-scheme-create     success    
fs-scheme-delete     success    
custom-ping          disabled   

    19.865 ms - bootstrap
    10.680 ms - check_fs_scheme_create
     1.149 ms - check_fs_scheme_delete
     1.045 ms - check_custom_ping
     0.831 ms - check_db
     0.013 ms - check_memcache
     0.012 ms - check_redis
     0.010 ms - check_elasticsearch
    33.794 ms - total

Example of log output

All ping log entries are prefixed by ping:.

There are 3 types of records:

  • slow
  • warning
  • error
Mar 29 19:21:17 hostname php: ping: slow: check_db: duration=1003.642356 ms
Mar 30 15:54:59 hostname php: ping: error: unset: bootstrap(): SQLSTATE[HY000] [2002] No such file or directory
Mar 30 15:54:59 hostname php: ping: error: db: check_db(): SQLSTATE[HY000] [2002] No such file or directory
Mar 30 15:54:59 hostname php: ping: error: fs-scheme-create: check_fs_scheme_create(): \Drupal::$container is not initialized yet.
Mar 30 16:00:00 hostname php: ping: warning: memcache: host=localhost port= 11211 response='END' - Unexpected response
drupal-ping -

Published by tharna about 4 years ago

Add support for Drupal 9

drupal-ping -

Published by tharna over 6 years ago

Better memcache check.

Package Rankings
Top 7.89% on Packagist.org
Badges
Extracted from project README
Build Status Latest Stable Version Total Downloads Latest Unstable Version License