mirror of
https://github.com/ansible-collections/community.mysql.git
synced 2025-07-28 15:41:26 -07:00
Fix replication settings
sh don't know 'echo -e', so we use bash instead. Also, we need to wait for the container to be healthy before trying to restart it. Otherwise that could corrupt it.
This commit is contained in:
parent
35531e741c
commit
b9d0e96deb
2 changed files with 20 additions and 8 deletions
13
.github/workflows/ansible-test-plugins.yml
vendored
13
.github/workflows/ansible-test-plugins.yml
vendored
|
@ -130,18 +130,21 @@ jobs:
|
|||
|
||||
steps:
|
||||
|
||||
- name: Setup tmate session
|
||||
uses: mxschmitt/action-tmate@v3
|
||||
# No need to check for service health. GitHub Action took care of it.
|
||||
|
||||
- name: Restart MySQL server with settings for replication
|
||||
run: |
|
||||
docker exec ${{ job.services.db_primary.id }} sh -c 'echo -e [mysqld]\\nserver-id=1\\nlog-bin=/var/lib/mysql/primary-bin > /etc/mysql/conf.d/replication.cnf'
|
||||
docker exec ${{ job.services.db_replica1.id }} sh -c 'echo -e [mysqld]\\nserver-id=2\\nlog-bin=/var/lib/mysql/replica1-bin > /etc/mysql/conf.d/replication.cnf'
|
||||
docker exec ${{ job.services.db_replica2.id }} sh -c 'echo -e [mysqld]\\nserver-id=3\\nlog-bin=/var/lib/mysql/replica2-bin > /etc/mysql/conf.d/replication.cnf'
|
||||
docker exec ${{ job.services.db_primary.id }} bash -c 'echo -e [mysqld]\\nserver-id=1\\nlog-bin=/var/lib/mysql/primary-bin > /etc/mysql/conf.d/replication.cnf'
|
||||
docker exec ${{ job.services.db_replica1.id }} bash -c 'echo -e [mysqld]\\nserver-id=2\\nlog-bin=/var/lib/mysql/replica1-bin > /etc/mysql/conf.d/replication.cnf'
|
||||
docker exec ${{ job.services.db_replica2.id }} bash -c 'echo -e [mysqld]\\nserver-id=3\\nlog-bin=/var/lib/mysql/replica2-bin > /etc/mysql/conf.d/replication.cnf'
|
||||
docker restart ${{ job.services.db_primary.id }}
|
||||
docker restart ${{ job.services.db_replica1.id }}
|
||||
docker restart ${{ job.services.db_replica2.id }}
|
||||
|
||||
- name: Wait for the primary to be healthy
|
||||
run: |
|
||||
while ! /usr/bin/docker inspect --format="{{if .Config.Healthcheck}}{{print .State.Health.Status}}{{end}}" ${{ job.services.db_primary.id }} && [[ "$SECONDS" -lt 120 ]]; do sleep 1; done
|
||||
|
||||
- name: >-
|
||||
Perform integration testing against
|
||||
Ansible version ${{ matrix.ansible }}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue