For PROD: Stop docker containers on both servers, but upgrade the containers one server at a time. This way you can quickly get the site back up on the previous server.
One at a time to reduce risk.
#Stop both
salt 'customer-portal*' test.ping
salt 'customer-portal*' cmd.run 'docker container ls'
salt 'customer-portal*' cmd.run 'docker stop portal nginx'
#Update First Portal Server
salt -C 'customer* and G@ec2:availability_zone:us-gov-east-1a' test.ping
salt -C 'customer* and G@ec2:availability_zone:us-gov-east-1a' cmd.run 'docker rm portal nginx'
salt -C 'customer* and G@ec2:availability_zone:us-gov-east-1a' cmd.run 'docker images'
salt -C 'customer* and G@ec2:availability_zone:us-gov-east-1a' cmd.run 'docker rmi <image-ids>'
salt -C 'customer* and G@ec2:availability_zone:us-gov-east-1a' state.sls docker.portal --output-diff
#Update Second Portal Server
salt -C 'customer* and G@ec2:availability_zone:us-gov-east-1b' test.ping
salt -C 'customer* and G@ec2:availability_zone:us-gov-east-1b' cmd.run 'docker rm portal nginx'
salt -C 'customer* and G@ec2:availability_zone:us-gov-east-1b' cmd.run 'docker images'
salt -C 'customer* and G@ec2:availability_zone:us-gov-east-1b' cmd.run 'docker rmi <image-ids>'
salt -C 'customer* and G@ec2:availability_zone:us-gov-east-1b' state.sls docker.portal --output-diff
For TEST: Both at the same time
salt 'customer-portal*' test.ping
salt 'customer-portal*' cmd.run 'docker container ls'
salt 'customer-portal*' cmd.run 'docker stop portal nginx'
salt 'customer-portal*' cmd.run 'docker rm portal nginx'
salt 'customer-portal*' cmd.run 'docker images'
salt 'customer-portal*' cmd.run 'docker rmi <image-ids>'
salt 'customer-portal*' state.sls docker.portal --output-diff
To verify the version, login to Portal and go to the Staff Tools.
From the XDR Wiki page
Last time we tried the ec2_tags
grain targeting did not work.
salt -G 'ec2_tags:Name:customer-portal' cmd.run "docker images" – You will need to grab the docker image ID for the container that needs to be updated
salt -G 'ec2_tags:Name:customer-portal' cmd.run "docker stop portal"
salt -G 'ec2_tags:Name:customer-portal' cmd.run "docker rm portal"
salt -G 'ec2_tags:Name:customer-portal' cmd.run "docker rmi ${image id from above}
salt -G 'ec2_tags:Name:customer-portal' state.sls docker
salt -G 'ec2_tags:Name:customer-portal' state.sls docker.portal
#login to ECR using the docker salt state
salt 'customer-portal*' state.sls docker.portal --output-diff test=true
#create a new branch and modify the file to the needed tags then push it up.
salt 'customer-portal*' state.sls docker.portal-revert saltenv=feature/bp_na_salt_portal_tag
#once you are done delete the branch
Portal's PostgreSQL DB is stored in AWS RDS.
Steps: