Ruby agent installation: Rails plugin

These instructions are for installing the Ruby agent as a Rails plugin. For most use cases, you should instead install the agent gem.

Install the New Relic Rails plugin

New Relic strongly recommends installing the Ruby agent as a gem in order to have better control over versions and dependencies.

To install the Rails plugin from Github, use the following commands for Rails versions 2 or higher:

script/plugin install git://github.com/newrelic/rpm.git
mv vendor/plugins/rpm vendor/plugins/newrelic_rpm

This will export the Rails plugin into your application's vendor/plugins directory. If you cannot install the Rails plugin directly from the git URL, you can clone the repository into the vendor/plugins directory.

Update the configuration file

After installing the agent, copy the newrelic.yml file into the config subdirectory of your application. You can download a fresh newrelic.yml that includes your license key from the Account settings when logged in to New Relic.

As part of the installation process, change the default application name to a meaningful name.

Update the newrelic.yml file

Whenever you update the agent, double-check that your Ruby agent configuration file (config/newrelic.yml) is up to date: Open the default newrelic.yml file that lives in the Ruby agent's plugin folder (vendor/plugins/newrelic_rpm/newrelic.yml). Look for new configuration options that are not in your config/newrelic.yml file.

Update the Ruby agent

When using Subversion with the Rails plugin, be sure to remove the old agent plugin before reinstalling.

Use the gem if possible.

svn rm vendor/plugins/newrelic_rpm svn commit vendor/plugins -m "removing old version of newrelic" 

Then, to install the latest Ruby agent plugin:

script/rails plugin install git://github.com/newrelic/rpm.git vendor/plugins/newrelic_rpm
mv vendor/plugins/rpm vendor/plugins/newrelic_rpm
svn add vendor/plugins/newrelic_rpm
svn commit vendor/plugins -m "upgrading newrelic to version X.X.X"

Uninstall the Rails plugin

To uninstall the Rails plugin:

svn rm vendor/plugins/newrelic_rpm svn commit vendor/plugins

For more help

Additional documentation resources include:

  • New Relic for Ruby (compatibility and requirements, general information about installation, configuration, troubleshooting, and known issues)
  • Ruby agent installation (using the New Relic Ruby gem and configuration file)

Join the discussion about Ruby in the New Relic Online Technical Community! The Technical Community is a public platform to discuss and troubleshoot your New Relic toolset.

If you need additional help, get support at support.newrelic.com.