On this page
- Update monitoring dashboard software from Deeson
- How it works
- Warden server application
- Web server
- PHP
- Composer
- MongoDb
- Installing Warden server application
- Warden Drupal module
- Installing the Warden module
- Using drush with Warden
- Configuring the website
- For Drupal 7
- For Drupal 8
- Connecting the website with the server dashboard
- Configuring the cron job
- Notes
- Libraries
- Permissions
- Symfony app.php directory
- Installing the Warden Drupal module - troubleshooting
- Installing the Drush file
- Drush URI configuration for warden-update
- Error logs
- Warden server application dashboard
- Warden Drupal module
Warden installation
Update monitoring dashboard software from Deeson
How it works
- Install the Warden server dashboard application (Symfony)
- Install and enable the Warden module on the Drupal website(s) you would like to monitor
Once the Warden Drupal module has registered each site, it will appear as ‘pending’ on the list of sites in the Warden server dashboard.
In order for the Warden server dashboard application to retrieve the information from each website and the latest update information from Drupal.org a bash script needs to be run regularly on the server with cron.
Warden server application
Before installing Warden make sure the server has the following:
- A web server (eg. nginx or Apache)
- PHP
- Mongodb
- Composer
Web server
Warden can be installed on both nginx or Apache. Both will just need fairly standard configuration in order to get a Symfony application running.
PHP
Install PHP 7.1 or 7.2. You are also prompted to install lots of PHP packages as you go along using something like apt Package Manager.
Composer
Warden is built using Symfony2 which uses Composer to manage its dependencies. Install Composer locally or globally on the server.
curl -s http://getcomposer.org/installer | php
MongoDb
Up-to-date instructions on the Warden Github Readme.
Installing Warden server application
1. Get a copy of the latest stable release (currently tagged 1.4.0 at the time of writing) Warden server files on Github.
Example:
git clone https://github.com/teamdeeson/warden.git --branch 1.4.0
Replace 1.4.0 with the tag of the latest stable release.
2. In the cloned directory run
composer install
3. Add installation parameters when prompted
The installation process should complete with a prompt for you to enter parameters for your install. If you leave them blank they will assume their default values (given in brackets in yellow). You will need your security token later to connect your Drupal websites to the server application dashboard.
Details about the basic installation parameters can be found in the README.md file.
4. Finally you will be asked to create the admin user you will use to log into the main Warden dashboard in your browser.
5. Point your URL: The Virtual Host/Server Block will need to point to the web folder within the Warden server application directory.
6. Once these steps are complete you should be able to browse to your dashboard (at whatever URL you chose in the previous step) and log in using the credentials created on installation.
Warden Drupal module
Installing the Warden module
The Warden Drupal module can be downloaded and installed/enabled as usual.
Using drush with Warden
The module directory contains a file called warden.drush.inc file which provides the following drush commands:
Drupal 7:
drush warden-check-connection
Drupal 8:
drush warden-check
This tests the connection between the Drupal website and Warden by getting the public key.
drush warden-update
This updates the Warden server with the latest data from the Drupal website.
drush warden-show-module-data
This displays the module data that will be sent to Warden.
Configuring the website
Once the Warden module is installed and enabled, go to the sites/default/settings.php file and add the configuration options.
A full list of the configuration options (and default values) which are available can be found in the module Readme file.
An example of the very bare minimum configuration necessary is below. It tells the website where the Warden dashboard is, allows the dashboard to request information from the website and points to where modules are installed:
For Drupal 7
$conf[‘warden_server_host_path’] = ‘https://yourwardendashboardurl.com’;
$conf[‘warden_allow_requests’] = TRUE;
$conf['warden_preg_match_contrib'] = '{^sites\/([A-z,\.,\-]+)\/modules\/*}';
For Drupal 8
$config['warden.settings']['warden_server_host_path'] = 'https://yourwardendashboardurl.com';
$config['warden.settings'][‘warden_allow_requests’] = 'https://yourwardendashboardurl.com';
$config['warden.settings']['warden_preg_match_contrib'] = '{^modules\/contrib\/*}';
The 'warden_preg_match_contrib' is a regular expression which should point to the directory where your contrib modules are kept (eg. /sites/all/modules/contrib or modules/contrib).
You might need to add more configuration options - for example the IP address of the warden server which is allowed to request callback information from the website, or an HTTP authentication username and password.
Once these configurations have been added flush the Drupal cache.
Connecting the website with the server dashboard
Visit /admin/config/system/warden and press the ‘add this site to your Warden dashboard’ button which will connect the website to the Warden dashboard. The websites should now appear in the websites list on the dashboard as ‘pending’.
Configuring the cron job
To test the bash script you can run the cron.sh file manually from your terminal:
./scripts/cron.sh @dev
You will be in the @dev environment by default but you could alternatively specify @prod or @test if you want to update different environments.
Example crontab running every day, checking for new sites hourly:
01 16 * * * /var/www/yourwebsite.com/public_html/scripts/cron.sh @dev
01 * * * * /var/www/yourwebsite.com/public_html/scripts/cron.sh @dev --new-only
Notes
Libraries
To populate the Warden server application dashboard with information about the libraries that each website uses this information needs to be added manually to the settings.php file for each website.
Alternatively you could write a Drupal module per website which checks which libraries the website is using and adds that information to the array in the settings.php file, or have some code which runs at a server level to check which libraries and versions are installed on each website and writes to a file which is included in the settings.php file for each website.
Permissions
The web server user (eg. www-data) will need correct permissions to be able to write to the var/cache and var/logs folders correct ownership of the entire warden directory and it’s content.
Symfony app.php directory
The web directory in the Warden server application dashboard has an index file called app.php so your server may need to have mod_rewrite activated to allow the Warden .htaccess file to set the web directory index file to be app.php
Installing the Warden Drupal module - troubleshooting
The command
composer require drupal/warden
will install the Drupal module using composer. Installing the module using other methods on a composer managed site can result in the following error:
Fatal error: Class 'WardenApi\Api' not found in /modules/contrib/warden/src/Service/WardenManager.php
To rectify, uninstall the module and try again using the composer command above.
Installing the Drush file
In some environments the warden.drush.inc file needs to go into a new directory called drush at the same level as the directory containing the Drupal website.
After the file has been added run
drush cc drush
to clear the drush cache.
Drush URI configuration for warden-update
The warden-update function uses the website’s $base_url which Drush sometimes replaces with ‘http://default’.
If the environment does not have the drush uri defined then either add $options['uri'] = ‘http://yourdrupalwebsite.com’; to a sites/default/drushrc.php file, or define --uri when running the command as below:
drush --uri=http://yourdrupalwebsite.com warden-update
Error logs
Warden server application dashboard
The Warden server logs are found in app/logs within the Warden server - the two files are dev.logs and prod.logs.
Warden Drupal module
The module writes errors in the normal way to the Recent log messages page on the Drupal website.
Help improve this page
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion