Skip to content

Commit 307f55c

Browse files
committed
feat: anonymization using DbToolsBundle
https://www.wrike.com/open.htm?id=1396105243
1 parent 3684122 commit 307f55c

File tree

5 files changed

+132
-4
lines changed

5 files changed

+132
-4
lines changed

faros-ng/deploy-pack/1.7/ansible/_variables.yml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,23 @@ lephare_install_adminer: false
2626
lephare_packagist_com_token: "{{ vault_lephare_packagist_com_token }}"
2727

2828
# (db-pull) Database settings
29-
db_pull_local_database_host: <local_database_host>
29+
db_pull_local_database_host: pgsql_17
3030
db_pull_local_database_name: <local_database_name>
31-
db_pull_local_database_user: <local_database_user>
32-
db_pull_local_database_password: <local_database_password>
33-
db_pull_local_database_port: <local_database_port> # MySQL/MariaDB: 3306, PostgreSQL: 5432
31+
db_pull_local_database_user: postgres
32+
db_pull_local_database_password: root
33+
db_pull_local_database_port: 5432
3434

3535
db_pull_local_backup_path: ../var/database/
3636
db_pull_remote_backup_path: "{{ ansistrano_deploy_to }}/var/database"
3737
db_pull_remote_database_host: localhost
3838
db_pull_remote_database_port: 5432
3939
db_pull_remote_database_password: "{{ vault_database_password }}"
40+
41+
# Requires an additional remote database dedicated to anonymization + installing `makinacorpus/db-tools-bundle`
42+
db_pull_anonymization: true
43+
44+
db_pull_anonymization_remote_database_user: <anonymization_remote_database_user>
45+
db_pull_anonymization_remote_database_host: <anonymization_remote_database_host>
46+
db_pull_anonymization_remote_database_name: <anonymization_remote_database_name>
47+
db_pull_anonymization_remote_database_password: "{{ vault_anonymization_remote_database_password }}"
48+
db_pull_anonymization_remote_database_port: 5432
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
vault_database_password: <remote_database_password>
22
vault_lephare_packagist_com_token: <lephare_packagist_com_token>
3+
vault_anonymization_remote_database_password: <anonymization_remote_database_password>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
faros_user:
2+
firstname: firstname
3+
lastname: lastname
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
db_tools:
2+
# Where to put generated backups.
3+
# Root directory of the backup storage manager. Default filename
4+
# strategy will always use this folder as root path.
5+
#storage_directory: '%kernel.project_dir%/var/db_tools'
6+
7+
# Filename strategies. You may specify one strategy for each doctrine
8+
# connection. Keys are doctrine connection names. Values are strategy
9+
# names, "default" (or null) or omitting the connection will use the
10+
# default implementation.
11+
# If you created and registered a custom one into the container as a
12+
# service, you may simply set the service identifier. If no service
13+
# exists, and your implementation does not require parameters, simply
14+
# set the class name.
15+
# Allowed values are:
16+
# - "default": alias of "datetime".
17+
# - "datetime": implementation is "%db_tools.storage_directory%/YYYY/MM/<connection-name>-<datestamp>.<ext>".
18+
# - CLASS_NAME: a class name to use that implements a strategy.
19+
# - SERVICE_ID: A service identifier registered in container that
20+
# implements a strategy.
21+
#storage_filename_strategy: default
22+
23+
# When old backups are considered obsolete.
24+
# (Use relative date/time formats : https://www.php.net/manual/en/datetime.formats.relative.php)
25+
#backup_expiration_age: '6 months ago' # default '3 months ago'
26+
27+
# Default timeout for backup process.
28+
#backup_timeout: 1200 # default 600
29+
30+
# Default timeout for restore process.
31+
#restore_timeout: 2400 # default 1800
32+
33+
# List here tables you don't want in your backups.
34+
# If you have more than one connection, it is strongly advised to configure
35+
# this for each connection instead.
36+
#backup_excluded_tables: ['table1', 'table2']
37+
38+
# Specify here paths to backup and restoration binaries and command line
39+
# options.
40+
# Warning: this will apply to all connections disregarding their database
41+
# vendor. If you have more than one connection and if they use different
42+
# database vendors or versions, please configure those for each connection
43+
# instead.
44+
# Default values depends upon vendor and are documented at
45+
# https://dbtoolsbundle.readthedocs.io/en/stable/configuration.html
46+
#backup_binary: '/usr/bin/pg_dump'
47+
#backup_options: '-Z 5 --lock-wait-timeout=120'
48+
#restore_binary: '/usr/bin/pg_restore'
49+
#restore_options: '-j 2 --clean --if-exists --disable-triggers'
50+
51+
# For advanced usage, you may also override any parameter for each connection.
52+
# Each key is a connection name, all parameters above are allowed for each
53+
# unique connection.
54+
# Keys are doctrine connection names.
55+
#connections:
56+
# connection_one:
57+
# # Complete list of accepted parameters follows.
58+
# url: "pgsql://username:password@hostname:port?version=16.0&other_option=..."
59+
# backup_binary: /usr/local/bin/vendor-one-dump
60+
# backup_excluded_tables: ['table_one', 'table_two']
61+
# backup_expiration_age: '1 month ago'
62+
# backup_options: --no-table-lock
63+
# backup_timeout: 2000
64+
# restore_binary: /usr/local/bin/vendor-one-restore
65+
# restore_options: --disable-triggers --other-option
66+
# restore_timeout: 5000
67+
# storage_directory: /path/to/storage
68+
# storage_filename_strategy: datetime
69+
# connection_two:
70+
# # ...
71+
72+
# Update this configuration if you want to look for anonymizers in a custom
73+
# folder.
74+
# Be aware that DbToolsBundle will always take a look at the default folder
75+
# dedicated to your custom anonymizers: %kernel.project_dir%/src/Anonymizer,
76+
# so you don't have to repeat it.
77+
#anonymizer_paths:
78+
# - '%kernel.project_dir%/src/Database/Anonymizer'
79+
80+
# For simple needs, you may simply write the anonymization configuration
81+
# here. Keys are connection names, values are structures which are identical
82+
# to what you may find in the "anonymizations.sample.yaml" example.
83+
#anonymization:
84+
# connection_one:
85+
# table1:
86+
# column1:
87+
# anonymizer: anonymizer_name
88+
# # ... anonymizer specific options...
89+
# column2:
90+
# # ...
91+
# table2:
92+
# # ...
93+
# connection_two:
94+
# # ...
95+
96+
# You can for organisation purpose delegate anonymization config into extra
97+
# YAML configuration files, and simply reference them here.
98+
# Paths can be either relative or absolute. Relative paths are relative to
99+
# the workdir option if specified, or from this configuration file directory
100+
# otherwise.
101+
# See the "anonymizations.sample.yaml" in this folder for an example.
102+
#anonymization_files:
103+
# connection_one: '%kernel.project_dir%/config/anonymization/connection_one.yaml'
104+
# connection_two: '%kernel.project_dir%/config/anonymization/connection_two.yaml'
105+
106+
# If you have only one connection, you can adopt the following syntax.
107+
anonymization_files: '%kernel.project_dir%/config/anonymizations.yaml'
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"bundles": {
3+
"MakinaCorpus\\DbToolsBundle\\Bridge\\Symfony\\DbToolsBundle": ["all"]
4+
},
5+
"copy-from-recipe": {
6+
"config/": "%CONFIG_DIR%/"
7+
}
8+
}

0 commit comments

Comments
 (0)