The group's web sites

We are running three web sites for this group:

auditoryneuroscience.com is an educational site on auditory science which was created alongside the Auditory Neuroscience book. It is hosted on twinkle.

howyourbrainworks.net is an educational web site on general neuroscience which accompanies the CityU gateway education course by the same name. It is hosted on crescendo.

auditoryneuroscience.org (this web site) serves internal and external documents for the CityU hearing research group. It is hosted on crescendo. 

All these web sites are implemented with drupal, running on apache2 and a mysql database. The sites were installed with composer and composer should be used to update them when required. 

Installing a drupal web site - example

This web site was created by first making sure that a LAMP stack is up and running as described here.

Don't forget to:

sudo a2enmod rewrite
sudo systemctl restart apache2

If needed, install composer with "sudo apt get composer", then install drupal with

mkdir drupalsites; cd drupalsites
composer create-project drupal/recommended-project:8.9.1 crescendo.allowed
composer require drush/drush
cd web/sites; mkdir files; chmod a+w files
cp default.settings.php settings.php

Note that I here specified drupal version 8.9.1 because the recently released version 9 is not ready. Too many modules seem unavailable. Once that is done, point browser to localhost and run installation script. The script will ask you to create a database. You will need to specify a database user and password. These have to have the necessary privileges to create a mysql database for the site. Also make sure you grant privilege "lock tables" to the database user associated with your new web site so that you can backup the web site database with a mysqldump command. TO do this, log into mysql as root and run:
GRANT LOCK TABLES ON *.* TO 'labDrupal'@localhost;
(assuming that labDrupal is the name of the database user. You can look that up in sites/default/settings.php)

Backing up a web site's database

I keep shell scripts in directory DatabaseBackups which do stuff like this (Example for this web site):
NOW="$(date +"%d-%m-%Y")"
FNAME="jansLab.$NOW.sql.gz"
mysqldump -u labDrupal -h localhost -p####### --databases jansLabWebsite | gzip -9 > $FNAME

where ###### is the database user password

Adding a module to a web site. Example SMTP

This is how I added the smtp module to http://hearing.allowed.org/. Installation of other modules is similar.

cd ~/drupalsites/crescendo.allowed
composer require drupal/smtp
vendor/bin/drush en smtp

Then navigate to http://localhost/admin/config/system/smtp and configure the new smtp module.

Other useful modules to install:

File upload:
Install the module with
composer require drupal/editor_file 
composer require drupal/svg_image 

then enable in http://localhost/admin/modules and configure with http://localhost/admin/config/content/formats
Also ensure that the file upload limit in php.ini is not too small. If needed do
sudo gedit /etc/php/7.2/apache2/php.ini
and increase upload_max_filesize and post_max_size.

Useful maintenance commands

How to do a core update according to this source
composer outdated "drupal/*"
# this checks if there are modules out of date.
# if so, update using the following commands
vendor/bin/drush state:set system.maintenance_mode 1
vendor/bin/drush cr
composer update

vendor/bin/drush updatedb
vendor/bin/drush state:set system.maintenance_mode 0
vendor/bin/drush cr

(NOTE that sometimes the composer says ther eis nothing to update even though drupal reports that a core update is required. You may have to update the composer.json file by hand.)

Check the site's error log with http://localhost/admin/reports/dblog 

Domain Servers

The domains howyourbrainworks.net and neuralcodes.com are managed by greengeeks.com.

The domain thalamus.cafe is managed by godaddy and can be updated here: https://dcc.godaddy.com/manage/thalamus.cafe/dns 

The auditoryneuroscience.com and auditoryneuroscience.org domains are managed by domain24.de.

HTTPS encryption

We use letsencrypt.org to get  security certificates for the sites so that people can access via https protocol. The underlying mechanics are super complicated but thankfully there is "certbot" which automates much of the  hassle. For example, to get 'thalamus.cafe' ready for HTTPS,  once I had configured apache correctly to get it to work on http;//,  all I had to do is open a shell and call  "sudo certbot run -d thalamus.cafe' and it did all the hard  work. Check 'sudo certbot -h' for help.