IAS Drupal 7 Sites Documentation

Developer Topics

Contents

FAQ

Hosting

This is a Drupal multisite hosted on Acquia Cloud Enterprise.

Issue Management

Issues are managed in Zivtech’s Jira.

Workflow

We use the Git Feature Branch Workflow.

It is recommended to maintain Git remotes in working copies as follows:

$ git remote -v
acquia	iasedu@svn-15689.prod.hosting.acquia.com:iasedu.git (fetch)
acquia	iasedu@svn-15689.prod.hosting.acquia.com:iasedu.git (push)
github	git@github.com:zivtech/ias.git (fetch)
github	git@github.com:zivtech/ias.git (push)
origin	git@gitlab.com:theias/di/iasedu.git (fetch)
origin	git@gitlab.com:theias/di/iasedu.git (push)

Continuous Integration

For every pull request, Probo.CI executes jobs and builds a demo site.

Evaluating Issues

Issue Priorities

Priority Description Example Issues
Low It can wait “Themes have no thumbnail screenshot”
Normal Most issues “Sidebar links don’t look like links”
High Serious broken functionality, broken pages, very bad styling, client-identified priorities, important features “File contextual links are displaying to anonymous visitors”, “Giving confirmation/error page is unstyled”
Highest Are almost always bugs: security issues, incorrect data displayed, broken sites “EntityMalformedException if the homepage (maybe others) references a node that has been deleted”

Reviewing Pull Requests

See the Pull Request Template.

Testing

Type Runner Execution
PHP coding standards phpcs CI
JavaScript coding standards eslint CI
CSS and SASS coding standards stylelint CI
Behavioral behat Jenkins (nightly)
Visual regression backstop Manual
Unit simpletest CI

Local Development

Get the files and databases:

scripts/local/download_files.sh
scripts/local/download_database_backups.sh

Restore databases to local MySQL.

# iasedu main site example:
gzcat ~/Downloads/acquia-backups/prod-iasedu-iasedu-2016-05-07.sql.gz | mysql -u root -p iasedu

Set up /etc/hosts:

127.0.0.1       iasedu.local
127.0.0.1       crossroads.local

Add a settings.local.php to each site directory (connection details may vary):

// sites/default/settings.local.php
$base_url = "http://iasedu.local:8080";
$cookie_domain = '.local';
$conf['cas_cert'] = "../certs/ca-bundle.crt";
$conf['file_public_path'] = "sites/default/files";
$conf['file_private_path'] = "sites/default/files-private";
$conf['file_temporary_path'] = '/tmp';
$databases['default']['default'] = [
  'database' => 'iasedu',
  'username' => 'root',
  'password' => '',
  'host' => 'localhost',
  'port' => '',
  'driver' => 'mysql',
  'prefix' => '',
];
// If you want to use memcached to be similar to the production
// configuration, uncomment these lines:
/*
$conf['memcache_key_prefix'] = __DIR__;
$conf['cache_backends'][] = './sites/all/modules/contrib/memcache/memcache.inc';
$conf['cache_default_class'] = 'MemCacheDrupal';
$conf['cache_class_cache_form'] = 'DrupalDatabaseCache';
$conf['memcache_stampede_protection'] = TRUE;
$conf['lock_inc'] = './sites/all/modules/contrib/memcache/memcache-lock.inc';
$conf['memcache_key_prefix'] = __FILE__;
*/

// sites/crossroads/settings.local.php
$base_url = "http://crossroads.local:8080";
$cookie_domain = '.local';
$conf['cas_cert'] = "../certs/ca-bundle.crt";
$conf['file_public_path'] = "sites/crossroads/files";
$conf['file_private_path'] = "sites/crossroads/files-private";
$conf['file_temporary_path'] = '/tmp';
$databases['default']['default'] = [
  'database' => 'crossroads',
  'username' => 'root',
  'password' => '',
  'host' => 'localhost',
  'port' => '',
  'driver' => 'mysql',
  'prefix' => '',
];

Configure virtual hosts (ports and directories will vary):

# The default virtual host.
<VirtualHost *:8080>
    DocumentRoot "/Users/cjm/Sites/"
</VirtualHost>

<VirtualHost *:8080>
    DocumentRoot "/Users/cjm/Sites/iasedu/docroot"
    ServerName crossroads.local
</VirtualHost>

<VirtualHost *:8080>
    DocumentRoot "/Users/cjm/Sites/iasedu/docroot"
    ServerName iasedu.local
</VirtualHost>

# etc...

You may have to clear caches before a site will run. Example:

drush --uri=default cc all

Browse the sites:

Naming Conventions

This is super important. Anguish awaits those who don’t read this section.

Site Machine Names

Each of the sites in this project has a machine name which is also its database name. The machine name often is not the same as the site’s directory name.

In addition to the representing the database name, the site machine name is also used to construct the local site hostname, in the form:

{machine_name}.local

Hostnames

Every site has a development and a staging site. There is no point in writing them all down because the URLs are constructed according to a pattern, where “host” is the DNS hostname:

Examples:

SSL

On Acquia Cloud, all sites have SSL. SSL redirection is handled in Drupal’s own .htaccess file.

Release Management

  1. On Acquia Cloud, copy the production databases and files to staging.

  2. Push the master branch to Acquia, git push acquia master then deploy it to staging.

  3. Execute manual tests. Stop the release if there are surprises.

  4. Tag and deploy one of two ways:

    • Deploy the master branch from staging to production on Acquia Cloud. It will be tagged automatically. git fetch acquia to fetch the tag to your working copy then push the tag to GitLab: git push <tag> origin.
    • Tag the release yourself on the master branch using CalVer, push the tag to Acquia and to GitLab, then deploy the tag to production on Acquia Cloud. Tags should look like these examples:

      • 2016-01-04
      • 2016-01-04.0
      • 2016-01-04.1
  5. The current Acquia Cloud hook scripts clear Varnish caches on staging but not on production. If it is desired to clear Varnish caches on production, do that manually in Acquia Cloud.

  6. An Acquia Cloud hook script emails a short message to stakeholders about the deploy.

  7. Mark completed issues done in Jira.