Continuous Integration
Environments
A complete environments is a Virtual Machine with:
- Ubuntu 20.04 LTS
- Drupal 9.x (with LAMP, apache2, mariadb 15.x & php 8.x
- Node-Red 2.2.x
... and environments types are
Production
network.guifi.net (VM 5612) at main PROD cluster (clu01), BCNZF site.
Test
test.network.guifi.net. Weekly snapshot (Sundays 10am) from PROD
Development
At developers wish...
Process for promoting to PROD
Merging developments - Promoting TEST/PRE to PROD
Scenario description:
main: main branch ci: development(continuous integration) branch
Pull CI branch
Assuming all changes have been already committed to the CI branch, checkout:
git pull
git checkout ci
Ensure composer / module dependencies
composer install
Update drupal database
Clean cache
dush cr
drush updb
Import configuration
drush cim
Clean cache
dush cr
OLD
Drupal official docs on configuration synchronization between sites using drush: https://www.drupal.org/docs/configuration-management/workflow-using-drush
So, in the case of promoting from our test.network.guifi.net (TEST/PRE) to network.guifi.net (PROD), follow the next steps:
1.- Preliminar:
After a clean snapshot at test from prod, apply the changes you want to test, and if everything looks ok, then apply to prod by completing the next steps.
Be sure that the unique differences between PRE & PROD are the ones you want to promote, and that the "config" directory located at "sites/default/files/config_*/ is either clean, or even better, remove it's contents to ensure that is clean:
cd /var/www/html/net9/web/sites/default/files
cd config_*
rm -rf *
2.- Export current configuration at PRE/TEST site as user "fundacio" using drush:
cd /var/www/html/net9/web
drush config:export
3.- Move exported configuration to PROD:
Example, by using SCP, and pulling the configuration from the config_* dir on the PROD site:
scp -r fundacio@192.168.69.30:/var/www/html/net9/web/sites/default/files/config_1APXmitMdFgAqPkyMv8yEvIzp_vadbSiv1XiqDnqxsDEUZ2po130SmwZ66pvcd_M6dfdabgiug/* .
4.- Import configuration on PROD
Finally, apply the changes with drush import:
drush config:import
By running this,l you will be prompted for applying the
changes. Take a look on what's being applied to ensure it's related and consistent with the changes being promoted.