varnish / newrelic_varnish_plugin

Integration plugin between Varnish and New Relic
Other
21 stars 21 forks source link

Varnish plugin can only be run from the plugin directory #6

Open jamrok opened 11 years ago

jamrok commented 11 years ago

Hey,

I was writing an init script for this plugin and realised that I can't run the plugin from the absolute path.

I would have to change to the directory that had the plugin and run it from the current directory.

The fix that I came up with was to edit the [ /var/lib/gems/1.8/gems/newrelic_plugin-1.0.3/lib/newrelic_plugin/config.rb ] file and change: @config_file||="config/newrelic_plugin.yml" TO: @config_file||=(File.expand_path File.dirname($0))+"/config/newrelic_plugin.yml"

This allowed running from the absolute path since it will always be able to find the [ /config/newrelic_plugin.yml ] file.

I'm filing this issue here since [ https://github.com/newrelic-platform/newrelic_plugin ] doesn't allow us to, and I figured that you guys can get it pushed.

Thanks!

Enalmada commented 11 years ago

I had the same problem. For others searching this problem, until this is fixed, you can do something silly like this to change directory when starting the service.

su - $USER -c "bash -c 'cd $APPLICATION_PATH; ${APPLICATION_PATH}/newrelic_varnish_plugin > /dev/null 2>&1 & '"

(hacked together to get something working so could probably be better)