Please see the web application readme file in the web directory for more information about Drupal and how to configure the web application.
Please see the dashboard readme file in the dashboard directory for more information.
The Vagrant development environment tries to maximise all the work done for Drupal-VM as much as possible. Please follow the Drupal-VM readme below and install Drupal-VM in a convenient location.
NOTE: The old Vagrant development environment wraps docker in a VM, these files vagrant files are still in the repository but please do not use them.
- VirtualBox - tested with version 5.2.22
- Vagrant - tested with version 2.2.0
- Drupal-VM
- A copy of the Drupal-VM config.yml file in the BEIS S3 artifacts bucket.
- A copy of the latest sanitised PAR database from the BEIS S3 artifacts bucket.
Before starting the Drupal-VM make sure that you have cloned a copy of the website and run all the necessary setup on this. You will need to configure Drupal-VM so that the vagrant_synced_folders
for this project points to the correct local_path
of your application.
As part of the site setup run composer install from the project root folder. Ensure the vendor directory is created with all the required application components before moving on to the database section.
In order to run the site you will need to import a copy of the latest par database, download this and place in the backups
directory of the par project (create the folder if it doesn't' exist).
Import the database using drush (note the database should be truncated before re-importing)
cd /var/www/par/web
tar -zxvf ../backups/drush-dump-production-sanitized-latest.sql.tar.gz ../backups/drush-dump-production-sanitized-latest.sql
../vendor/bin/drush sql:cli < ../backups/drush-dump-production-sanitized-latest.sql
Tagging the master branch will cause the build to be packaged and stored in S3
git tag v0.0.31
git push --tags
Once a build has been packaged, it can be deployed to another environment as follows:
cd cf
./push.sh ENV_NAME VERSION
e.g.
./push.sh staging v0.0.31
Full instructions on setting AWS keys and environment variables for the target environment can be found in the push.sh script itself.
The build relies on a seed database which is a sanitised version of the production database. At regular periods this seed database needs to be updated:
cf ssh beis-par-production -c "python app/devops/tools/postgres_dump.py"
Go to the S3 artifacts bucket and download a copy of the drush-dump-production-unsanitized.sql file that was just created (and uploaded).
NOTE: You must always sanitize the database against the latest release code only with dev and test settings files turned off:
$config['config_split.config_split.dev_config']['status'] = FALSE;
$config['config_split.config_split.test_config']['status'] = FALSE;
Import the newly downloaded production db:
cd ./web
tar -zxvf ./location/of/downloaded/sql/drush-dump-production-unsanitized-latest.sql.tar.gz
../vendor/bin/drush @par.paas sql:drop -y
../vendor/bin/drush @par.paas sql:cli < ./location/of/downloaded/sql/drush-dump-production-unsanitized-latest.sql
cd ..
./drupal-update.sh
Check that the data looks right and then sanitise:
cd ./web
../vendor/bin/drush @par.paas sql:sanitize -y
Then dump the db, zip it and upload it back to the S3 artifacts bucket with the correct name:
tar -zcvf drush-dump-production-sanitized-latest.sql.tar.gz -C ./ drush-dump-production-sanitized-latest.sql
../vendor/bin/drush fsp s3backups drush-dump-production-sanitized-latest.sql.tar.gz drush-dump-production-sanitized-latest.sql.tar.gz```