Skip to content
This repository has been archived by the owner on Mar 24, 2020. It is now read-only.

deploy: restart damsolrizer #673

Merged
merged 1 commit into from
Jul 9, 2019
Merged

deploy: restart damsolrizer #673

merged 1 commit into from
Jul 9, 2019

Conversation

mcritchlow
Copy link
Member

@mcritchlow mcritchlow commented Jul 3, 2019

Fixes issues we're seeing with damspas deploys and NOT restarting damsolrizer.

Example output on a dry run of capistrano w/ this new task added:

~/projects/ucsd/damspas (feature/restart-damsolrizer) % docker-compose -f docker/dev/docker-compose.yml exec web cap production deploy --dry-run
[Deprecation Notice] `set :scm, :git` is deprecated.
To ensure your project is compatible with future versions of Capistrano,
remove the :scm setting and instead add these lines to your Capfile:

    require "capistrano/scm/git"
    install_plugin Capistrano::SCM::Git

00:00 git:wrapper
      01 mkdir -p /tmp
      02 #<StringIO:0x000055974ee47a10> /tmp/git-ssh-damspas-production-.sh
      03 chmod 700 /tmp/git-ssh-damspas-production-.sh
00:00 git:check
      01 git ls-remote https://github.com/ucsdlib/damspas.git HEAD
00:00 deploy:check:directories
      01 mkdir -p /pub/capistrano/shared /pub/capistrano/releases
00:00 git:clone
      The repository mirror is at /pub/capistrano/repo
00:00 git:update
      01 git remote set-url origin https://github.com/ucsdlib/damspas.git
      02 git remote update --prune
00:00 git:create_release
      01 mkdir -p /pub/capistrano/releases/20190703213446
      02 git archive master | /usr/bin/env tar -x -f - -C /pub/capistrano/releases/20190703213446
00:00 deploy:set_current_revision
      01 echo "" >> REVISION
00:00 deploy:migrate
      [deploy:migrate] Run `rake db:migrate`
00:00 deploy:migrating
      01 RBENV_ROOT=$HOME/.rbenv RBENV_VERSION=2.3.7 $HOME/.rbenv/bin/rbenv exec bundle exec rake db:migrate
00:00 whenever:update_crontab
      01 RBENV_ROOT=$HOME/.rbenv RBENV_VERSION=2.3.7 $HOME/.rbenv/bin/rbenv exec bundle exec whenever --update-crontab damspas --set environment=production --roles=web,app,db,sitemap_ping
00:00 deploy:symlink:release
      01 ln -s /pub/capistrano/releases/20190703213446 /pub/capistrano/releases/current
      02 mv /pub/capistrano/releases/current /pub/capistrano
00:00 deploy:write_version
      01 echo `git describe --all --always --long --abbrev=40 HEAD` `date +"%Y-%m-%d %H:%M:%S %Z"`  > /pub/capistrano/releases/20190703213446/public/version.txt
00:00 deploy:update_sitemap
      01 RBENV_ROOT=$HOME/.rbenv RBENV_VERSION=2.3.7 $HOME/.rbenv/bin/rbenv exec bundle exec rake sitemap:refresh
00:00 deploy:assets:precompile
      01 RBENV_ROOT=$HOME/.rbenv RBENV_VERSION=2.3.7 $HOME/.rbenv/bin/rbenv exec bundle exec rake RAILS_RELATIVE_URL_ROOT=/dc assets:precompile
00:00 deploy:restart
      01 mkdir -p /pub/capistrano/releases/20190703213446/tmp
      02 touch /pub/capistrano/releases/20190703213446/tmp/restart.txt
00:00 deploy:restart_damsolrizer
      01 sh $HOME/bin/damsolrizer.sh
00:00 deploy:log_revision
      01 echo "Branch master (at ) deployed as release 20190703213446 by " >> /pub/capistrano/revisions.log

Deployment test to QA

Damspas deployed with a running version of damsolrizer:

[conan@lib-hydrahead-qa ~]$ pgrep -f bin/damsolrizer
4619

Damspas re-deployed w/ this branch:

[conan@lib-hydrahead-qa ~]$ pgrep -f bin/damsolrizer
21057

Note, the PID's change, and damsolrizer is still up and running

Local Checklist

  • Tests written and passing locally?
  • Code style checked?
  • QA-ed locally?
  • Rebased with master branch?
  • Configuration updated (if needed)?
  • Documentation updated (if needed)?

What does this PR do?

Adds a capistrano task to restart damsolrizer on deployment.

@ucsdlib/developers - please review

@coveralls
Copy link

coveralls commented Jul 3, 2019

Coverage Status

Coverage decreased (-0.01%) to 65.909% when pulling 4268e93 on feature/restart-damsolrizer into 2bcbc9b on master.

@rstanonik
Copy link
Contributor

I modified x.damsolrizier.sh in all environments (qa, staging, production) to use environment variables.
It doesn't work in qa because RAILS_ENV for conan isn't set.

@mcritchlow
Copy link
Member Author

@rstanonik - Oh, sorry I missed this comment before making my last commit. So, should I vendor the main damsolrizer script, but leave x.damsolrizer.sh out of it and assume it'll always be in the same place? We can definitely go that route if you'd prefer.

@mcritchlow
Copy link
Member Author

@rstanonik - one thing we could probably do is add a new environment variable for damspas in our environment variables repo that sets the proper host that the script needs. Then we could vendor it and know it would already be setup. Thoughts?

@mcritchlow mcritchlow force-pushed the feature/restart-damsolrizer branch from d49809b to 6a11b01 Compare July 5, 2019 18:28
@mcritchlow
Copy link
Member Author

After speaking with @rstanonik and looking at the env vars repo, it seems @jhriv already solved this problem for us :) updating the PR accordingly :)

@mcritchlow mcritchlow force-pushed the feature/restart-damsolrizer branch from 6a11b01 to 4268e93 Compare July 9, 2019 22:29
@mcritchlow mcritchlow changed the title WIP: deploy: restart damsolrizer deploy: restart damsolrizer Jul 9, 2019
Copy link
Member

@lsitu lsitu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Thanks. 👍

@VivianChu
Copy link
Member

👍

1 similar comment
@hweng
Copy link
Contributor

hweng commented Jul 9, 2019

👍

@hweng hweng merged commit 14c76be into master Jul 9, 2019
@hweng hweng deleted the feature/restart-damsolrizer branch July 9, 2019 23:25
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants