Skip to content

unl/nebraska-today

Repository files navigation

UNL News

A Drupal installation hosted at https://news.unl.edu/ developed by the Digital Experience Group.

Requirements

See Drupal System Requirements

While it is possible to run Drupal on a variety of web servers, database servers, etc., the officially supported configuration at UNL is as follows:

  • Linux (any modern, supported distribution)
  • PHP 8.1 or greater
  • Apache 2.4 or greater
  • MariaDB 10.6 or greater

Latest verified working configuration:

  • PHP 8.1.10
  • Apache 2.4.54
  • MariaDB 10.7.3

Composer, PHP's dependency manager, is necessary to install this project. See Install Composer.

Note: The instructions below refer to the global composer installation. It may be necessary to replace composer with php composer.phar (or similar).

Pre-Installation

Navigate to the project root and install the project:

composer install

Install the UNLedu Web Framework

The unl_five theme requires the UNLedu Web Framework.

There are two methods to install the UNLedu Web Framework:

  1. Automated
  2. Manual

Automated

The unl/wdntemplates package is already downloaded to /vendor/unl/wdntemplates. Run the following command:

composer install-wdn

This command will create a symlink of /vendor/unl/wdntemplates/wdn at /web/wdn.

The wdntemplates package is a Node.js project that uses Grunt. This command will also install the Node.js project and run the default Grunt task.

To receive upstream updates, navigate to vendor/unl/wdntemplates and run git pull.

Manual

Download the UNLedu Web Framework sync set to /web/wdn.

Install ImageMagick

  • If you do not have ImageMagick software installed on your device, you can do so using the following commands. This software is necessary to process/add images.
brew install imagemagick
brew install ghostscript

For more infromation regaridng installation go to https://imagemagick.org/script/download.php

Install Drupal

cp web/sites/default/default.settings.php web/sites/default/settings.php
cp web/sites/default/default.settings.local.php web/sites/default/settings.local.php

Edit web/sites/default/settings.local.php and set the LDAP password.

Navigate to http://example.unl.edu/nebraska-today/web/ (or set up a virtual host, news-local.unl.edu is the recommended name) in your browser. (See Installing Drupal)

When asked to select an Installation Profile, select Use existing configuration.

Additional setup

Some things needed are Drupal "content" and not saved to config/sync. These need to be manually created (both on a local instance and an initial production deployment).

Cron setup

Cron is disabled on /admin/config/system/cron because there isn't an option to run it often enough. Set up a crontab entry to run every 5 minutes so that articles set to publish with Scheduler are promptly published.

*/5 * * * * curl -s "https://news.unl.edu/cron/{{key-that-appear-on-/admin/config/system/cron}}" > /dev/null

Common Settings for All Sites

Settings that apply to all sites can be included in one of two places:

  1. web/sites/default/news-settings.php which is committed to the repo.
  2. web/sites/default/settings.local.php which is not committed and is appropriate for sensitive info or environment specific overrides to things set in (1).

Upgrading Drupal Core (or a module)

Run this on a development site and commit composer.json, composer.lock, and any changes to config/sync. The process is the same for a module, just change the project in the first composer command.

composer update "drupal/core-*" --with-all-dependencies
drush updatedb
drush cache:rebuild
drush config:export

Run on a deployment after updating code base:

composer install
drush updatedb
drush cache:rebuild
drush config:import

Configuration Management

This project uses Configuration Management (abbreviated CMI) to store the present/base/main configuration of the site.

After making changes, use drush config:export to export config to config/sync and commit.

Import current config state with drush config:import.

Config Split

This project uses Config Split to manage configuration among production, stage, and development. Certain modules, such as Twig Xdebug and Config Inspector are only enabled on development.

In the development config split, a number of settings are enabled, disabled, or modified: Caching is disabled; Twig caching is disabled and Twig autoloading is enabled; debug cacheability headers are enabled; CSS and JS aggregation is disabled; and file permission hardening is disabled. See /web/sites/default/news-settings.php for more details. These settings can be overridden in settings.local.php.

Drush

Available in the vendor directory: vendor/bin/drush <drush-commands>