Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: anonymization using DbToolsBundle #56

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions faros-ng/deploy-pack/1.7/ansible/_variables.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,23 @@ lephare_install_adminer: false
lephare_packagist_com_token: "{{ vault_lephare_packagist_com_token }}"

# (db-pull) Database settings
db_pull_local_database_host: <local_database_host>
db_pull_local_database_host: pgsql_17
db_pull_local_database_name: <local_database_name>
db_pull_local_database_user: <local_database_user>
db_pull_local_database_password: <local_database_password>
db_pull_local_database_port: <local_database_port> # MySQL/MariaDB: 3306, PostgreSQL: 5432
db_pull_local_database_user: postgres
db_pull_local_database_password: root
db_pull_local_database_port: 5432

db_pull_local_backup_path: ../var/database/
db_pull_remote_backup_path: "{{ ansistrano_deploy_to }}/var/database"
db_pull_remote_database_host: localhost
db_pull_remote_database_port: 5432
db_pull_remote_database_password: "{{ vault_database_password }}"

# Requires an additional remote database dedicated to anonymization + installing `makinacorpus/db-tools-bundle`
db_pull_anonymization: true

db_pull_anonymization_remote_database_user: <anonymization_remote_database_user>
db_pull_anonymization_remote_database_host: <anonymization_remote_database_host>
db_pull_anonymization_remote_database_name: <anonymization_remote_database_name>
db_pull_anonymization_remote_database_password: "{{ vault_anonymization_remote_database_password }}"
db_pull_anonymization_remote_database_port: 5432
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
vault_database_password: <remote_database_password>
vault_lephare_packagist_com_token: <lephare_packagist_com_token>
vault_anonymization_remote_database_password: <anonymization_remote_database_password>
3 changes: 3 additions & 0 deletions makinacorpus/db-tools-bundle/1.2/anonymizations.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
faros_user:
firstname: firstname
lastname: lastname
96 changes: 96 additions & 0 deletions makinacorpus/db-tools-bundle/1.2/config/packages/db_tools.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
db_tools:
# Where to put generated backups.
#storage:
# Root directory of the backup storage manager. Default filename
# strategy will always use this folder as root path.
#root_dir: '%kernel.project_dir%/var/db_tools'

# Filename strategies. You may specify one strategy for each doctrine
# connection. Keys are doctrine connection names. Values are strategy
# names, "default" (or null) or omitting the connection will use the
# default implementation.
# If you created and registered a custom one into the container as a
# service, you may simply set the service identifier. If no service
# exists, and your implementation does not require parameters, simply
# set the class name.
#filename_strategy:
# Backup filename strategy.
# "default" is an alias of "datetime"
#default: default
# "datetime" implementation is "%db_tools.storage.root_dir%/YYYY/MM/<connection-name>-<datestamp>.<ext>"
#other_connection_strategy: datetime
# Example of using a service name:
#yet_another_connection: app.db_tools.filename.custom_strategy
# Or a classe name:
#another_one: App\DbTools\Storage\MyCustomStrategy

# When old backups are considered obsolete
# (Use relative date/time formats : https://www.php.net/manual/en/datetime.formats.relative.php)
#backup_expiration_age: '6 months ago' # default '3 months ago'

# Timeout for backups.
# backup_timeout: 1200 # default 600

# Timeout for restores.
# restore_timeout: 2400 # default 1800

# List here tables (per connection) you don't want in your backups
#excluded_tables:
#default: ['table1', 'table2']

# Specify here paths to binaries, only if the system can't find them by himself
# platform are 'mysql', 'postgresql', 'sqlite'
#backupper_binaries:
#mariadb: '/usr/bin/mariadb-dump' # default 'mariadb-dump'
#mysql: '/usr/bin/mysqldump' # default 'mysqldump'
#postgresql: '/usr/bin/pg_dump' # default 'pg_dump'
#sqlite: '/usr/bin/sqlite3' # default 'sqlite3'
#restorer_binaries:
#mariadb: '/usr/bin/mariadb' # default 'mariadb'
#mysql: '/usr/bin/mysql' # default 'mysql'
#postgresql: '/usr/bin/pg_restore' # default 'pg_restore'
#sqlite: '/usr/bin/sqlite3' # default 'sqlite3'

# Default options to pass to the binary when backing up or restoring
# a database. Those options must be defined per connection.
# If you do not define some default options, here or by using the
# "--extra-options" option when invoking the command, the following
# ones will be used according to the database vendor:
# - When backing up:
# - MariaDB: --no-tablespaces
# - MySQL: --no-tablespaces
# - PostgreSQL: -Z 5 --lock-wait-timeout=120
# - SQLite: -bail
# - When restoring:
# - MariaDB: None
# - MySQL: None
# - PostgreSQL: -j 2 --clean --if-exists --disable-triggers
# - SQLite: None
#backupper_options:
#default: ''
#another_connection: ''
#restorer_options:
#default: ''
#another_connection: ''

# Update this configuration if you want to look for anonymizers in a custom folder.
# These are default paths that will always be registered even if you override
# the setting and don't repeat them:
#anonymizer_paths:
#- '%kernel.project_dir%/vendor/makinacorpus/db-tools-bundle/src/Anonymizer'
#- '%kernel.project_dir%/src/Anonymization/Anonymizer'

# Anonymization configuration.
anonymization:
# If you want to configure anonymization with attributes on
# Doctrine entities, you have nothing to add here: if doctrine/orm
# is available the DbToolsBundle will automatically look for it.
#
# If you want to load configuration from a yaml:
# 1/ If you want to configure anonymization only for the default
# DBAL connection, declare it like this:
yaml: '%kernel.project_dir%/config/anonymizations.yaml'
# 2/ If you use multiple connections, declare each configuration like this:
#yaml:
#- connection_one: '%kernel.project_dir%/config/anonymizations/connection_one.yaml'
#- connection_two: '%kernel.project_dir%/config/anonymizations/connection_two.yaml'