-
Notifications
You must be signed in to change notification settings - Fork 10
DevOps: Synchronizing :diffusion_histories_count's
Emmanuel Nwakire edited this page Jul 12, 2024
·
10 revisions
The :diffusion_histories_count
column was added to the practices
table to alleviate N+1 queries being carried out in the loading of the /search
page as identified by the bullet gem. For details see the jira ticket
- Have an account
- Browse to http://internal-jenkinsdevops-837096002.us-gov-west-1.elb.amazonaws.com/
- Login
- Click "DEV - update diffusion histories count":
- Click the "Configure" tab from the left nav bar:
- Verify the script has the correct server designated, in the below screenshot the script is pointing to the PROD server, to change this simply edit "PROD_SERVER" in the "Execute shell" "Command" text box to
STG_SERVER
orDEV_SERVER
(the full script is provided at the bottom of this wiki page for posterity):
- Click "Apply" and "Save" and go back to the previous page.
- From here click "Build Now" to run the rake task on the server you have designated. (see the 2nd screenshot above)
- The rake task is set up to print the
id
anddiffusion_history_count
of eachPractice
as it runs. To see the console output click the status icon for the build under the "Build History" beneath the left nav bar (see the 2nd screenshot above). The console output will look like this when complete:
This is the "Execute shell" "Command" script found in the "Configuration" page:
ssh ec2-user@$PROD_SERVER "CONTAINER_ID=\$(sudo docker ps -q -f ancestor=[124858472090.dkr.ecr.us-gov-west-1.amazonaws.com/diffusion-marketplace:ruby-2.7.8](http://124858472090.dkr.ecr.us-gov-west-1.amazonaws.com/diffusion-marketplace:ruby-2.7.8)); sudo docker exec \$CONTAINER_ID bundle exec rake practice:update_diffusion_histories_counts;"
As mentioned, to change this to run on another server simply change PROD_SERVER
to the desired server. So this would be the script for STG:
ssh ec2-user@$STG_SERVER "CONTAINER_ID=\$(sudo docker ps -q -f ancestor=[124858472090.dkr.ecr.us-gov-west-1.amazonaws.com/diffusion-marketplace:ruby-2.7.8](http://124858472090.dkr.ecr.us-gov-west-1.amazonaws.com/diffusion-marketplace:ruby-2.7.8)); sudo docker exec \$CONTAINER_ID bundle exec rake practice:update_diffusion_histories_counts;"
for DEV:
ssh ec2-user@$DEV_SERVER "CONTAINER_ID=\$(sudo docker ps -q -f ancestor=[124858472090.dkr.ecr.us-gov-west-1.amazonaws.com/diffusion-marketplace:ruby-2.7.8](http://124858472090.dkr.ecr.us-gov-west-1.amazonaws.com/diffusion-marketplace:ruby-2.7.8)); sudo docker exec \$CONTAINER_ID bundle exec rake practice:update_diffusion_histories_counts;"