Loading CHANGELOG +3 −2 Original line number Original line Diff line number Diff line CHANGELOG CHANGELOG ========= ========= 3.0-dev 3.0.7 ------- ----- - [FEATURE] Allow setting to search replace db content - [IMP] Set data directory list to sync in variable - [IMP] Set data directory list to sync in variable 3.0.6 3.0.6 Loading README.md +21 −0 Original line number Original line Diff line number Diff line Loading @@ -161,6 +161,27 @@ To execute this task only, run this command: bin-dir/syncontent --ansible-tags=db bin-dir/syncontent --ansible-tags=db ``` ``` For TYPO3, most of the time after restoring data, the domain records need to be adjusted to match your local setup. In this case, you can provide a list of pair value so that this tool can search and replace it before restoring to your local system. To do that, create a file called `main.yml` in `ansible/roles/database/defaults/` directory and add the following content: ``` --- # Content replacement in database replacement: 1: search: live-domain.com replace: local-site:8080 2: search: live-domain2.net replace: domain2.local-site:8080 ``` `replacement`, `search` and `replace` are keyword but for `1` and `2` you can use any strings to define your content type. Just add more array list with `search` and `replace` pair if needed. ### 3. cleanup ### 3. cleanup The last step is to run some necessary commands needed by the framework for the application to work. The last step is to run some necessary commands needed by the framework for the application to work. Loading ansible/roles/database/defaults/.gitignore 0 → 100644 +1 −0 Original line number Original line Diff line number Diff line /* ansible/roles/database/defaults/main.ymldeleted 100644 → 0 +0 −2 Original line number Original line Diff line number Diff line --- # defaults file for database ansible/roles/database/tasks/typo3.yml +5 −0 Original line number Original line Diff line number Diff line Loading @@ -5,6 +5,11 @@ synchronize: mode=pull src="{{ remote_dump }}" dest="/tmp/{{ ssh_user }}/db_dump.sql" synchronize: mode=pull src="{{ remote_dump }}" dest="/tmp/{{ ssh_user }}/db_dump.sql" when: not from_cache|bool when: not from_cache|bool - name: Search and replace content in database dump local_action: replace dest="/tmp/{{ ssh_user }}/db_dump.sql" regexp="{{ item.value.search }}" replace="{{ item.value.replace }}" with_dict: replacement | default({}) when: not from_cache|bool - name: Drop local database - name: Drop local database local_action: shell {{ bin_path }}/dockertypo3 run db mysqladmin -h db -u root -proot drop dockertypo3 -f local_action: shell {{ bin_path }}/dockertypo3 run db mysqladmin -h db -u root -proot drop dockertypo3 -f chdir="{{ local_path }}" chdir="{{ local_path }}" Loading Loading
CHANGELOG +3 −2 Original line number Original line Diff line number Diff line CHANGELOG CHANGELOG ========= ========= 3.0-dev 3.0.7 ------- ----- - [FEATURE] Allow setting to search replace db content - [IMP] Set data directory list to sync in variable - [IMP] Set data directory list to sync in variable 3.0.6 3.0.6 Loading
README.md +21 −0 Original line number Original line Diff line number Diff line Loading @@ -161,6 +161,27 @@ To execute this task only, run this command: bin-dir/syncontent --ansible-tags=db bin-dir/syncontent --ansible-tags=db ``` ``` For TYPO3, most of the time after restoring data, the domain records need to be adjusted to match your local setup. In this case, you can provide a list of pair value so that this tool can search and replace it before restoring to your local system. To do that, create a file called `main.yml` in `ansible/roles/database/defaults/` directory and add the following content: ``` --- # Content replacement in database replacement: 1: search: live-domain.com replace: local-site:8080 2: search: live-domain2.net replace: domain2.local-site:8080 ``` `replacement`, `search` and `replace` are keyword but for `1` and `2` you can use any strings to define your content type. Just add more array list with `search` and `replace` pair if needed. ### 3. cleanup ### 3. cleanup The last step is to run some necessary commands needed by the framework for the application to work. The last step is to run some necessary commands needed by the framework for the application to work. Loading
ansible/roles/database/defaults/.gitignore 0 → 100644 +1 −0 Original line number Original line Diff line number Diff line /*
ansible/roles/database/defaults/main.ymldeleted 100644 → 0 +0 −2 Original line number Original line Diff line number Diff line --- # defaults file for database
ansible/roles/database/tasks/typo3.yml +5 −0 Original line number Original line Diff line number Diff line Loading @@ -5,6 +5,11 @@ synchronize: mode=pull src="{{ remote_dump }}" dest="/tmp/{{ ssh_user }}/db_dump.sql" synchronize: mode=pull src="{{ remote_dump }}" dest="/tmp/{{ ssh_user }}/db_dump.sql" when: not from_cache|bool when: not from_cache|bool - name: Search and replace content in database dump local_action: replace dest="/tmp/{{ ssh_user }}/db_dump.sql" regexp="{{ item.value.search }}" replace="{{ item.value.replace }}" with_dict: replacement | default({}) when: not from_cache|bool - name: Drop local database - name: Drop local database local_action: shell {{ bin_path }}/dockertypo3 run db mysqladmin -h db -u root -proot drop dockertypo3 -f local_action: shell {{ bin_path }}/dockertypo3 run db mysqladmin -h db -u root -proot drop dockertypo3 -f chdir="{{ local_path }}" chdir="{{ local_path }}" Loading