Good day. Can you please tell if it is possible to perform through the capistrano during a delay

before 'deploy: finished', 'newrelic: notice_deployment'

but that license_key would be taken not from my local newrelic.yml , but from production

so that I could, without having a file newrelic.yml on the local computer, do a warmup and run

before 'deploy: finished', 'newrelic: notice_deployment'

Gemfile: gem 'newrelic_rpm'

Capfile: require 'new_relic/recipes'

 #deproy.rb set :linked_files, %w(config/database.yml config/secrets.yml config/newrelic.yml) set :newrelic_role, ['app'] before 'deploy:finished', 'newrelic:notice_deployment' 

Log

 Unexpected error attempting to connect to rpm.newrelic.com:443 license_key was not set in newrelic.yml for production: /Users/lutsko/.rvm/gems/ruby-2.3.1@cargoport/gems/newrelic_rpm-3.17.1.326/lib/new_relic/cli/commands/deployments.rb:84:in `run' /Users/lutsko/.rvm/gems/ruby-2.3.1@cargoport/gems/newrelic_rpm-3.17.1.326/lib/new_relic/recipes/capistrano3.rb:55:in `send_deployment_notification_to_newrelic' /Users/lutsko/.rvm/gems/ruby-2.3.1@cargoport/gems/newrelic_rpm-3.17.1.326/lib/new_relic/recipes/capistrano3.rb:14:in `block (3 levels) in <top (required)>' /Users/lutsko/.rvm/gems/ruby-2.3.1@cargoport/gems/sshkit-1.11.4/lib/sshkit/backends/abstract.rb:29:in `instance_exec' /Users/lutsko/.rvm/gems/ruby-2.3.1@cargoport/gems/sshkit-1.11.4/lib/sshkit/backends/abstract.rb:29:in `run' /Users/lutsko/.rvm/gems/ruby-2.3.1@cargoport/gems/sshkit-1.11.4/lib/sshkit/runners/parallel.rb:12:in `block (2 levels) in execute' 00:00 newrelic:notice_deployment license_key was not set in newrelic.yml for production 
  • Hmm, there really is a stupid situation. Ideally, notice should be sent via SSH from the server, but it seems that the designated task for Capistrano works locally. - D-side
  • Can someone meet a normal recipe for capistrano that would solve my problem - Mikhail Lutsko

2 answers 2

Judging by the source code :

 if fetch(:newrelic_role) on roles(fetch(:newrelic_role)) do send_deployment_notification_to_newrelic end else run_locally do send_deployment_notification_to_newrelic end end 

You simply do not have :newrelic_role . There should be an array of roles with NewRelic, a la:

 set :newrelic_role, ['app'] 

(It's not very clear why the key is in the singular; maybe one role will work.)

  • so I have already tried, to no avail Unexpected error attempting to connect to rpm.newrelic.com:443 license_key was not set in newrelic.yml for production: - Mikhail Lutsko
  • @ Mikhaillutsko means, find out if he still performs it locally, or there is really no such file on the production at this moment. - D-side
  • Well, judging by the bektreys he locally goes through run_locally - Mikhail Lutsko
  • @ Mikhail Lutsko well, magic does not happen. Either you do not really have :newrelic_role , or you have a different version of these recipes. Which way? - D-side
  • newrelic_rpm-3.17.1.326 - Mikhail Lutsko

In general, to solve my problem, I had to write a dachshund, because I did not find a ready-made solution. Maybe someone will come in handy

 namespace :new_relic do desc 'Uploaded deployment information to New Relic' task :notice_deployment do run_locally do local_config_path = Pathname.new('tmp') ENV['NEW_RELIC_CONFIG_PATH'] = "#{local_config_path}/newrelic.yml" system "scp -P 9999 username@host:#{deploy_to}/shared/config/newrelic.yml #{local_config_path}" invoke 'newrelic:notice_deployment' system "rm -r #{local_config_path}/newrelic.yml" end end end after 'deploy:finished', 'new_relic:notice_deployment' 

If you have any suggestions how to do better, please write