Skip to content

Commit b8733b0

Browse files
committed
SLT-17: Fallback to standard drush sql-dump when the gdpr.json file can't be located; Documentation;
1 parent 4a1bffc commit b8733b0

File tree

2 files changed

+43
-6
lines changed

2 files changed

+43
-6
lines changed

README.md

+33-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ This project template is an opinionated fork of the popular [Drupal-composer tem
88

99
- Copy this repository and push it to our organization.
1010
- Log in to CircleCI using your Github account and add the new project.
11-
11+
- Create and maintain a Personal Data mapping list for automatic data sanitization in `gdpr.json` file. See GDPR sanitization section for more information.
1212

1313
## How it works
1414

@@ -21,3 +21,35 @@ Have a look at the file for details, but in short this is how it works:
2121
- Create a custom docker image for Drupal and nginx, and push those to a docker registry (typically that of your cloud provider).
2222
- Install or update our helm chart while passing our custom images as parameters.
2323
- The helm chart executes the usual drush deployment commands.
24+
25+
## GDPR sanitization
26+
27+
SQL data dump for developers is parsed with [GDPR Tools](https://github.com/machbarmacher/gdpr-dump) project.
28+
You can create a `/gdpr.json` file with [Faker](https://packagist.org/packages/fzaninotto/faker) formatters that will allow replacing data as it's dumped from database using `mysqldump` / `drush sql-dump` command.
29+
30+
```
31+
{
32+
"users_field_data": {
33+
"name": {"formatter": "name"},
34+
"pass": {"formatter": "password"},
35+
"mail": {"formatter": "email"},
36+
"init": {"formatter": "clear"}
37+
}
38+
}
39+
```
40+
Available formatters:
41+
```
42+
**name** - generates a name
43+
**phoneNumber** - generates a phone number
44+
**username** - generates a random user name
45+
**password** - generates a random password
46+
**email** - generates a random email address
47+
**date** - generates a date
48+
**longText** - generates a sentence
49+
**number** - generates a number
50+
**randomText** - generates a sentence
51+
**text** - generates a paragraph
52+
**uri** - generates a URI
53+
**clear** - generates an empty string
54+
```
55+
You can also add extra elements and attributes, like `_cookies`, `_description` or `_purpose` to enrich the Personal Data information. Just make sure it's marked or prefixed so that it does not mess up GDPR dump when it looks for table data replacements.

chart/values.yaml

+10-5
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,18 @@ drupal:
1818
then
1919
drush cron;
2020
fi;'
21-
- schedule: '0 3 * * *'
21+
- schedule: '*/5 * * * *'
2222
command: 'bootstrapped=$(drush status --field=bootstrap);
2323
if [[ $bootstrapped = "Successful" ]] && [[ "$BRANCHNAME" = "$PRODUCTION_BRANCHNAME" ]];
2424
then
25-
export PATH=../vendor/bin:$PATH;
26-
rm /var/backups/db/${BRANCHNAME//[^[:alnum:]]/-}-latest.sql;
27-
drush sql-dump --extra-dump="--gdpr-replacements-file=../gdpr.json" --result-file /var/backups/db/${BRANCHNAME//[^[:alnum:]]/-}-latest.sql;
25+
DUMP_PATH=/var/backups/db/${BRANCHNAME//[^[:alnum:]]/-}-latest.sql;
26+
rm $DUMP_PATH;
27+
if [ -f ../gdpr.json ]; then
28+
export PATH=../vendor/bin:$PATH;
29+
drush sql-dump --extra-dump="--gdpr-replacements-file=../gdpr.json" --result-file $DUMP_PATH;
30+
else
31+
drush sql-dump --result-file $DUMP_PATH;
32+
fi
2833
fi;'
2934

3035
# will be generated random hashsalt if not provided here
@@ -88,4 +93,4 @@ clusterDomain: "silta.wdr.io"
8893
imagePullSecrets: []
8994

9095
branchname: "default"
91-
production_branchname: "master"
96+
production_branchname: "feature/SLT-17-gdpr-dump"

0 commit comments

Comments
 (0)