After many hurdles, struggles, and "learning moments", I pushed my site to staging successfully. Unfortunately, I am running into numerous issues when I try to push updates to a deployed site.
I read this question where the answer was basically that every deployment/update process is going to be different and you have to figure it out yourself. I researched this and came up with a process, but it is broken and results in a failed update, or loss of data added by test users. If I use this process in production I am concerned it will also result in an outage, so I am hoping to iron it out and understand what I'm doing wrong.
Change Context
In this case, assume I deployed a version of the site to staging. After this, I make local changes to the site, including:
- Deleting a SAML module that is causing issues and replacing it with another module
- Configuration changes including views and custom content type changes
- Styling changes to my custom theme
In the meantime, the staging site is being tested, so users have created content. In other words, I can't simply import my local database, and instead need to update the staging database with any config changes that occurred in my local site. I also .gitignore
my settings.php
file and my files
folder.
Lastly, all of these changes are working locally and dummy content in my local database is behaving as expected. It is only the staging site that is having problems when I try to pull my local changes and update the database.
Current Process
This is the broken process I have now. The steps marked i) are ones I found when researching the process, but which do not work for me. The steps marked ii) and subsequent steps are the workarounds I attempted to fix the issue, but either seem dubious, or outright fail to it.
- I make changes mentioned in the above context, and run
drush cex
to export my config. - Using git, I merge changes into my main branch.
- i) I SSH into the staging server and attempt to pull the changes, but this results in an error saying that the pull failed because git would overwrite a large list of files. I don't have the list any more, but they included
composer.json
which I am okay to replace, but also includes numerous other files that were created automatically or are module dependencies. - ii) I do a
git reset --hard
andgit pull
again, which works this time, but is slightly concerning because of the destroyed files. - i) I run
drush cim
which results in the error:
[error] Drupal\Core\Config\ConfigImporterException: There were errors validating the config synchronization.
Unable to install the <em class="placeholder">miniorange_saml</em> module since it does not exist. in Drupal\Core\Config\ConfigImporter->validate() (line 814 of /var/www/websites/cabstg/web/core/lib/Drupal/Core/Config/ConfigImporter.php).
ii) I figured this occurred because locally, I uninstalled the module before removing it from my
composer.json
and modules folder. When I pulled the change, it removed this module without uninstalling it from the staging database. I found answers that suggested to re-add the module and remove it as an admin so that it is removed from the staging database, then to remove it from root. I rancomposer require 'drupal/miniorange_saml:^3.0'
in staging, then manually uninstalled it, removed it from composer, and rancomposer update
like I did locally to remove this module. Then, I runDrush cim
again. Unfortunately, it results in the same error once again.iii) I took the additional step of searching my config directory for "miniOrange" but could not find it, so I do not why
Drush cim
is attempting to "install the miniorange_saml" in the first place. If anything, it should be uninstalling miniorange and any related configuration/data.iiii) I ran
Drush updb
in case this error is caused by an old entry in the database, and rerunDrush cim
but this does not work.
From here, I am not sure how to proceed further and I am forced to re-deploy the site. This means that I can either deploy a backup without the changes I made so I can keep the data added by users in staging, or I can push my change and import my working local database at the cost of losing content that the users added.
I feel like I am missing a step or misunderstanding this process. How do I push this change correctly?
Additional info
I read numerous questions on stack exchange with a similar error, but most of these were caused by blocks and not modules. I attempted the solutions where they seemed applicable, but no solution has worked for me yet.