Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

solr is not restart or start on rollback #2150

Open
w3villa-ankit opened this issue Feb 6, 2024 · 1 comment
Open

solr is not restart or start on rollback #2150

w3villa-ankit opened this issue Feb 6, 2024 · 1 comment

Comments

@w3villa-ankit
Copy link

this is my config

##`
namespace :puma do
desc 'Create Directories for Puma Pids and Socket'
task :make_dirs do
on roles(:app) do
execute "mkdir #{shared_path}/tmp/sockets -p"
execute "mkdir #{shared_path}/tmp/pids -p"
end
end

before :start, :make_dirs
end

namespace :deploy do
desc "Make sure local git is in sync with remote."
task :check_revision do
on roles(:app) do
unless git rev-parse HEAD == git rev-parse origin/master
puts "WARNING: HEAD is not the same as origin/master"
puts "Run git push to sync changes."
# exit
end
end
end
Rake::Task["sidekiq:quiet"].clear_actions #already handled by sidekiq service

desc 'Initial Deploy'
task :initial do
on roles(:app) do
before 'deploy:restart', 'puma:start'
invoke 'deploy'
end
end

desc 'Update Crontab'
task :crontab do
on roles(:app), in: :sequence, wait: 5 do
set(:whenever_command) { "cd /home/#{fetch(:user)}/#{fetch(:application)}/current && crontab -r && ~/.rvm/bin/rvm default do bundle exec whenever -i #{fetch(:application)}_#{fetch(:stage)} --set environment=#{fetch :rails_env}" }
end
end

desc "Reindex Solr"
task :reindex_solr do
on roles(:app),in: :sequence,wait: 5 do
execute "bash /home/#{fetch(:user)}/scripts/rsolr.sh"
# execute "cd /home/#{fetch(:user)}/#{fetch(:application)}/current && ~/.rvm/bin/rvm default do RAILS_ENV=#{fetch :rails_env} bundle exec rake sunspot:solr:reindex"
# execute "cd #{current_path} && RAILS_ENV=#{fetch :rails_env} #{fetch :rvm_binary} #{fetch :rvm_ruby_version} do bundle exec rake sunspot:solr:reindex"
end
end

desc 'Restart application'
task :restart do
on roles(:app), in: :sequence, wait: 5 do
invoke 'puma:restart'
end
end
desc 'notification messages'
task :create_notification do
on roles(:app_server), in: :sequence,wait: 5 do
within release_path do
with rails_env: fetch(:rails_env) do
execute :rake, 'notification:create'
end
end
end
end

desc 'clear cache'
task :clear_cache do
on roles(:app), in: :sequence, wait: 5 do
within release_path do
with rails_env: fetch(:rails_env) do
execute :rake, "cache:clear"
end
end
end
end

namespace :deploy do
task :reindex_solr do
# Your reindex_solr tasks
end

task :rollback do
  # Your rollback tasks
  invoke 'deploy:reindex_solr'
end

task :restart_solr do
  on roles(:app) do
    # Your Solr restart command
    invoke 'deploy:reindex_solr'
  end
end

end

before :starting, :check_revision
after :finishing, :compile_assets
after :finishing, :cleanup

after :finishing, :crontab

after :finishing, :restart
after :finishing, :reindex_solr
after :finishing, :restart_solr
after :finishing, :create_notification
after :finishing, :clear_cache
before 'deploy:starting', 'test:calculation_test_cases'
before 'deploy:starting', 'test:brakeman'
end

ps aux | grep puma # Get puma pid

kill -s SIGUSR2 pid # Restart puma

kill -s SIGTERM pid # Stop puma

`

@mattbrictson
Copy link
Member

Sorry, it is hard to see your config due to the formatting. Can you edit the issue description to place the code within triple-backticks so it is formatted correctly?

Also, if possible, can you include the output of cap deploy production --trace so that we can see the steps that were executed? It will help troubleshoot.

GitHub issue formatting, including the use of triple-backticks, is explained here: https://docs.github.com/github/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax

Here is another reference: https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/creating-and-highlighting-code-blocks

To edit your issue, select Edit under the ••• menu at the top of the issue description:

Screenshot 2024-02-06 at 7 42 24 AM

If the formatting is causing trouble, another option is to put your config file in a Gist and then paste the URL to the Gist here.

Thank you! 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants