/
wack-o-mole database usage

wack-o-mole database usage

Initial Setup:

  1. TODO Add instructions for installing aws-cli

  2. TODO How to get AWS Secret Key

  3. Configure your AWS profile:

aws configure --profile sunwave-dev

  1. Log into 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

  1. Pull and run the wack-o-mole image:

docker run

--platform linux/amd64 -p 3306:3306

--name sunwave-mysql-8.0.16

--network sunwave -e MYSQL_ROOT_PASSWORD=Welcome1

-d 517729021141.dkr.ecr.us-east-1.amazonaws.com/sunwave-mysql-8:8.0.16

--lower_case_table_names=1

  1. Verify the MySQL database container is up and running: docker logs sunwave-mysql-8.0.16

Update to newest version:

  1. Stop the existing container:

docker stop sunwave-mysql-8.0.16

  1. Remove the container:

docker rm sunwave-mysql-8.0.16

  1. Remove the docker image:

docker rmi 517729021141.dkr.ecr.us-east-1.amazonaws.com/sunwave-mysql-8:8.0.16

  1. 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

  1. Pull the new image, create the container, and run it:

docker run

--platform linux/amd64 -p 3306:3306

--name sunwave-mysql-8.0.16

--network sunwave

-e MYSQL_ROOT_PASSWORD=Welcome1

-d 517729021141.dkr.ecr.us-east-1.amazonaws.com/sunwave-mysql-8:8.0.16

--lower_case_table_names=1

  1. Make sure it’s running: docker logs sunwave-mysql-8.0.16 Note the initial setup up will take a few minutes:

     

Update the data.

  1. Get a dump of insert statements of your existing database:

docker exec -i sunwave-mysql-8.0.16 sh -c "mysqldump -u root -p'Welcome1' --skip-extended-insert sunwave3" > sunwave3-insert-statements.sql

  1. This example is for AWS docker image. The key to use ”--skip-extended-insert”

  2. Pull out the table you need to update: cat sunwave3-insert-statements.sql | grep sw_timeline_task > insert_sw_timeline_task.sql

  3. Modify the sql file by copy the existing insert statement and modifying to suit your needs.

  4. 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.

  5. Remove duplicates.

  6. Update https://github.com/sunwavehealth/devops/blob/develop/database/docker/4_data.sql file with your new statements.

  7. Reinstall the docker image see wack-o-mole database usage | Update to newest version:

  8. Rerun your integration test.

Update the database structure.

  1. Hunt down the required table alter/create statements from Jira or posting on engineering channel.

  2. Update https://github.com/sunwavehealth/devops/blob/develop/database/docker/3_wack-o-mole.sql file.

  3. Reinstall the docker images wack-o-mole database usage | Update to newest version:

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

 

Related content

Turn on sql trace debugging. *DO NOT CHECK THESE FILES IN.
Turn on sql trace debugging. *DO NOT CHECK THESE FILES IN.
Read with this
My Mac Setup for Sunwave
My Mac Setup for Sunwave
Read with this
Rest API Security
Rest API Security
Read with this