Initial Setup:
Configure your AWS profile:
aws configure --profile sunwave-dev
Log into aws docker registry where wack-o-mole database is:
aws ecr get-login-password --region us-east-1 --profile sunwave-dev | docker login --username AWS --password-stdin 517729021141.dkr.ecr.us-east-1.amazonaws.com
Pull and run the wack-o-mole image:
docker run --platform linux/amd64 -p 3306:3306 --name sunwave-mysql --network sunwave -e MYSQL_ROOT_PASSWORD=Welcome1 -d 517729021141.dkr.ecr.us-east-1.amazonaws.com/sunwave-mysql:1.0.0-SNAPSHOT --lower_case_table_names=1
Verify the mysql database container is up and running:
docker logs sunwave-mysql
Update to newest version:
Stop the existing container:
docker stop sunwave-mysql
Remove the container:
docker rm sunwave-mysql
Remove the docker image:
docker rmi 517729021141.dkr.ecr.us-east-1.amazonaws.com/sunwave-mysql:1.0.0-SNAPSHOT
Login into our aws docker registry:
aws ecr get-login-password --region us-east-1 --profile sunwave-dev | docker login --username AWS --password-stdin 517729021141.dkr.ecr.us-east-1.amazonaws.com
Pull the new image, create the container and run it:
docker run --platform linux/amd64 -p 3306:3306 --name sunwave-mysql --network sunwave -e MYSQL_ROOT_PASSWORD=Welcome1 -d 517729021141.dkr.ecr.us-east-1.amazonaws.com/sunwave-mysql:1.0.0-SNAPSHOT --lower_case_table_names=1
Make sure it’s running:
docker logs sunwave-mysql
Note the initial setup up will take a few minutes:
Update the data.
Get a dump of insert statements of your existing database:
docker exec -i sunwave-mysql sh -c "mysqldump -u root -p'Welcome1' --skip-extended-insert sunwave3" > sunwave3-insert-statements.sql
This example is for aws docker image. The key to use ”--skip-extended-insert”Pull out the table you need to update:
cat sunwave3-insert-statements.sql | grep sw_timeline_task > insert_sw_timeline_task.sql
Modify the sql file by copy the existing insert statement and modifying to suit your needs.
Run locally:
docker exec -i sunwave-mysql sh -c "exec mysql --force -uroot -pWelcome1 sunwave3" < insert_sw_timeline_task.sql
The--force
ignores any duplication errors while telling which statements are duplicates.Remove duplicates.
Update https://github.com/sunwavehealth/devops/blob/develop/database/docker/3_wack-o-mole.sql file with your new statements.
Reinstall the docker image see https://sunwavehealth.atlassian.net/wiki/spaces/~63696606d60bd2b365f87223/pages/61865999/wack-o-mole+database+usage#Update-to-newest-version%3A
Rerun your integration test.
Update the database structure.
Hunt down the required table alter/create statements from Jira or posting on engineering channel.
Update https://github.com/sunwavehealth/devops/blob/develop/database/docker/3_wack-o-mole.sql file.
Reinstall the docker images https://sunwavehealth.atlassian.net/wiki/spaces/~63696606d60bd2b365f87223/pages/61865999/wack-o-mole+database+usage#Update-to-newest-version%3A
Run Integration Tests.
Run all tests:
mvn integration-test -Dsunwave.health.emr.password=<your_password> -DskipITs=false
Run individual tests:
mvn integration-test -Dsunwave.health.emr.password=<your_password> -DskipITs=false -D it.test=com.sunwave.rest.AccountTimelineIT.java