You might find yourself needing to anonymize a database in Warden to either pass off to another developer, or move it forward into ephemeral / staging environments. This is fairly easy to achieve with Smile-SA GDPR Dump.

First lets download the resources we need, we will store them in the dev folder as we can exclude this in our deployment pipelines.

wget -o dev/gdpr-dump
wget -o dev/gdpr-dump.yaml
chmod +x dev/gdpr-dump

Next we can edit the yaml to set our correct Magento version and catch any non core tables we might have followed by running the anonymizer script.

DB_HOST=db DB_USER=magento DB_PASSWORD=magento DB_NAME=magento dev/gdpr-dump dev/gdpr-dump.yaml | gzip > dev/z_anonymized_db.$(date +%s).sql.gz

Now we should have a anonymized GZIP’d database we can share / move forward into environments.