├── README.md ├── newrelic.yml └── plugin.rb /README.md: -------------------------------------------------------------------------------- 1 | # New Relic for Discourse 2 | 3 | This is a Discourse plugin to get your forums reporting performance data to [New Relic][new-relic]. It is meant to be used with the [Discourse Docker Image][discourse-docker], so installation instructions will follow that route. It was originally written by [Sam Saffron][original], but I've updated the version of the New Relic RPM gem and supplied a newrelic.yml file that will be parsed by ERB. 4 | 5 | ## Installation 6 | 7 | Assuming you've followed the above instructions for the Discourse Docker image: 8 | 9 | 1. SSH into your forum server as the user running docker (probably root) 10 | 2. `cd /var/discourse` 11 | 3. Open up `containers/app.yml` 12 | 4. In the `env:` section, add `NEW_RELIC_LICENSE_KEY: ` 13 | 5. In the `env:` section, add `NEW_RELIC_APP_NAME: ` 14 | 6. (optional) In the `env` sesion, add `NEW_RELIC_AGENT_VERSION: ` 15 | 7. In the `hooks` section at the bottom, add the following to `cmd:` 16 | 17 | ```yaml 18 | - git clone https://github.com/davidcelis/new_relic-discourse.git 19 | ``` 20 | 7. (optional) In the `run` section at the bottom, add the following to get notified about new 'deployments': 21 | 22 | ```yaml 23 | - exec: curl -H "x-api-key:" -d "deployment[app_name]=" -d "deployment[description]=This is an app id deployment" https://api.newrelic.com/deployments.xml 24 | ``` 25 | 26 | The next time you bootstrap and start a new container for your forums, it'll start reporting into New Relic! Yay! To restart Discourse so that it picks up the new plugin, just SSH into your server and do the following: 27 | 28 | ```sh 29 | $ cd /var/discourse 30 | $ ./launcher rebuild app 31 | $ ./launcher start app 32 | ``` 33 | 34 | Or, you can visit the `/admin/upgrade` URL on your Discourse installation's frontend and upgrade as you would normally. 35 | 36 | [new-relic]: http://www.newrelic.com/ 37 | [discourse-docker]: https://github.com/discourse/discourse/blob/master/docs/INSTALL-digital-ocean.md 38 | [original]: https://meta.discourse.org/t/newrelic-plugin/12986 39 | 40 | -------------------------------------------------------------------------------- /newrelic.yml: -------------------------------------------------------------------------------- 1 | # 2 | # This file configures the New Relic Agent. New Relic monitors Ruby, Java, 3 | # .NET, PHP, Python, Node, and Go applications with deep visibility and low 4 | # overhead. For more information, visit www.newrelic.com. 5 | # 6 | # Generated November 7, 2018, for version 5.4.0.347 7 | #<%= "\n# #{generated_for_user}\n#" if generated_for_user %> 8 | # For full documentation of agent configuration options, please refer to 9 | # https://docs.newrelic.com/docs/agents/ruby-agent/installation-configuration/ruby-agent-configuration 10 | 11 | common: &default_settings 12 | # Required license key associated with your New Relic account. 13 | license_key: <%= ENV['NEW_RELIC_LICENSE_KEY'] %> 14 | 15 | # Your application name. Renaming here affects where data displays in New 16 | # Relic. For more details, see https://docs.newrelic.com/docs/apm/new-relic-apm/maintenance/renaming-applications 17 | app_name: <%= ENV['NEW_RELIC_APP_NAME'] %> 18 | 19 | # To disable the agent regardless of other settings, uncomment the following: 20 | # agent_enabled: false 21 | 22 | # Logging level for log/newrelic_agent.log 23 | log_level: info 24 | 25 | 26 | # Environment-specific settings are in this section. 27 | # RAILS_ENV or RACK_ENV (as appropriate) is used to determine the environment. 28 | # If your application has other named environments, configure them here. 29 | development: 30 | <<: *default_settings 31 | app_name: <%= ENV['NEW_RELIC_APP_NAME'] %> (Development) 32 | 33 | test: 34 | <<: *default_settings 35 | # It doesn't make sense to report to New Relic from automated test runs. 36 | monitor_mode: false 37 | 38 | staging: 39 | <<: *default_settings 40 | app_name: <%= ENV['NEW_RELIC_APP_NAME'] %> (Staging) 41 | 42 | production: 43 | <<: *default_settings 44 | -------------------------------------------------------------------------------- /plugin.rb: -------------------------------------------------------------------------------- 1 | # name: New Relic RPM 2 | # about: Report performance data to http://www.newrelic.com/ 3 | # version: 5.4.0.347 4 | # authors: Sam Saffron, David Celis 5 | 6 | ENV['NRCONFIG'] = File.expand_path('../newrelic.yml', __FILE__) 7 | gem 'newrelic_rpm', ENV['NEW_RELIC_AGENT_VERSION'] || '5.4.0.347' 8 | 9 | NewRelic::Control.instance.init_plugin config: Rails.configuration 10 | 11 | after_initialize do 12 | ForumsController.newrelic_ignore only: [:status] 13 | end 14 | --------------------------------------------------------------------------------