From 48e8662ac56ead7cb47f2845cb79396edc2ae1b3 Mon Sep 17 00:00:00 2001 From: Jake Plimack Date: Thu, 19 Mar 2015 13:09:04 -0600 Subject: [PATCH 1/5] make sure to run with a shell, which `newrelic` should not have --- templates/default/service.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) mode change 100644 => 100755 templates/default/service.erb diff --git a/templates/default/service.erb b/templates/default/service.erb old mode 100644 new mode 100755 index 69b1d65..5129689 --- a/templates/default/service.erb +++ b/templates/default/service.erb @@ -32,7 +32,7 @@ start() { echo "Starting $NAME" cd $DAEMONDIR touch $PIDFILE ; chown <%= @user %> $PIDFILE - su <%= @user %> -c "<%= @run_command %> $DAEMON >> $DAEMONDIR/plugin_daemon.log 2>&1 & echo \$! > $PIDFILE" + su <%= @user %> -s '/bin/bash' -c "<%= @run_command %> $DAEMON >> $DAEMONDIR/plugin_daemon.log 2>&1 & echo \$! > $PIDFILE" fi } @@ -79,4 +79,4 @@ case "${1}" in ;; esac -exit 0 \ No newline at end of file +exit 0 From ce3c0f6b44ced8e0256ce444d412cc971e28e156 Mon Sep 17 00:00:00 2001 From: Jake Plimack Date: Thu, 19 Mar 2015 13:11:32 -0600 Subject: [PATCH 2/5] vendor gems if not running as priviledged user --- definitions/bundle_install.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/definitions/bundle_install.rb b/definitions/bundle_install.rb index 67e5163..8db5132 100644 --- a/definitions/bundle_install.rb +++ b/definitions/bundle_install.rb @@ -7,8 +7,12 @@ # bundle install execute 'bundle install' do cwd params[:path] - command "bundle install" + if params[:user] == 'root' + command 'bundle install' + else + command 'bundle install --path vendor/bundle' + end user params[:user] only_if { File.directory?(params[:path]) } end -end \ No newline at end of file +end From 52a56589fc4d899857c444c6b1acaa6543bb89be Mon Sep 17 00:00:00 2001 From: Jake Plimack Date: Mon, 23 Mar 2015 12:53:16 -0600 Subject: [PATCH 3/5] s/install_plugin/newrelic_plugin/g --- recipes/aws_cloudwatch.rb | 2 +- recipes/example.rb | 2 +- recipes/memcached_java.rb | 2 +- recipes/memcached_ruby.rb | 2 +- recipes/mysql.rb | 2 +- recipes/rackspace_load_balancers.rb | 2 +- recipes/wikipedia_example_java.rb | 2 +- recipes/wikipedia_example_ruby.rb | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/recipes/aws_cloudwatch.rb b/recipes/aws_cloudwatch.rb index e12b223..0580a83 100644 --- a/recipes/aws_cloudwatch.rb +++ b/recipes/aws_cloudwatch.rb @@ -26,7 +26,7 @@ package 'libxslt-devel' end -install_plugin 'newrelic_aws_cloudwatch_plugin' do +newrelic_plugin 'newrelic_aws_cloudwatch_plugin' do plugin_version node[:newrelic][:aws_cloudwatch][:version] install_path node[:newrelic][:aws_cloudwatch][:install_path] plugin_path node[:newrelic][:aws_cloudwatch][:plugin_path] diff --git a/recipes/example.rb b/recipes/example.rb index 7629e2b..33bee49 100644 --- a/recipes/example.rb +++ b/recipes/example.rb @@ -12,7 +12,7 @@ verify_license_key node[:newrelic][:license_key] -install_plugin 'newrelic_example_plugin' do +newrelic_plugin 'newrelic_example_plugin' do plugin_version node[:newrelic][:example][:version] install_path node[:newrelic][:example][:install_path] plugin_path node[:newrelic][:example][:plugin_path] diff --git a/recipes/memcached_java.rb b/recipes/memcached_java.rb index 880ca67..591d834 100644 --- a/recipes/memcached_java.rb +++ b/recipes/memcached_java.rb @@ -13,7 +13,7 @@ verify_license_key node[:newrelic][:license_key] -install_plugin 'newrelic_memcached_java_plugin' do +newrelic_plugin 'newrelic_memcached_java_plugin' do plugin_version node[:newrelic][:memcached_java][:version] install_path node[:newrelic][:memcached_java][:install_path] plugin_path node[:newrelic][:memcached_java][:plugin_path] diff --git a/recipes/memcached_ruby.rb b/recipes/memcached_ruby.rb index 567f190..ceeb498 100644 --- a/recipes/memcached_ruby.rb +++ b/recipes/memcached_ruby.rb @@ -12,7 +12,7 @@ verify_license_key node[:newrelic][:license_key] -install_plugin 'newrelic_memcached_ruby_plugin' do +newrelic_plugin 'newrelic_memcached_ruby_plugin' do plugin_version node[:newrelic][:memcached_ruby][:version] install_path node[:newrelic][:memcached_ruby][:install_path] plugin_path node[:newrelic][:memcached_ruby][:plugin_path] diff --git a/recipes/mysql.rb b/recipes/mysql.rb index 9778d18..974a472 100644 --- a/recipes/mysql.rb +++ b/recipes/mysql.rb @@ -13,7 +13,7 @@ verify_license_key node[:newrelic][:license_key] -install_plugin 'newrelic_mysql_plugin' do +newrelic_plugin 'newrelic_mysql_plugin' do plugin_version node[:newrelic][:mysql][:version] install_path node[:newrelic][:mysql][:install_path] plugin_path node[:newrelic][:mysql][:plugin_path] diff --git a/recipes/rackspace_load_balancers.rb b/recipes/rackspace_load_balancers.rb index 09652e7..8dbd647 100644 --- a/recipes/rackspace_load_balancers.rb +++ b/recipes/rackspace_load_balancers.rb @@ -26,7 +26,7 @@ package 'libxslt-devel' end -install_plugin 'newrelic_rackspace_load_balancers_plugin' do +newrelic_plugin 'newrelic_rackspace_load_balancers_plugin' do plugin_version node[:newrelic][:rackspace_load_balancers][:version] install_path node[:newrelic][:rackspace_load_balancers][:install_path] plugin_path node[:newrelic][:rackspace_load_balancers][:plugin_path] diff --git a/recipes/wikipedia_example_java.rb b/recipes/wikipedia_example_java.rb index b10e01b..2419ffd 100644 --- a/recipes/wikipedia_example_java.rb +++ b/recipes/wikipedia_example_java.rb @@ -12,7 +12,7 @@ verify_license_key node[:newrelic][:license_key] -install_plugin 'newrelic_wikipedia_example_java_plugin' do +newrelic_plugin 'newrelic_wikipedia_example_java_plugin' do plugin_version node[:newrelic][:wikipedia_example_java][:version] install_path node[:newrelic][:wikipedia_example_java][:install_path] plugin_path node[:newrelic][:wikipedia_example_java][:plugin_path] diff --git a/recipes/wikipedia_example_ruby.rb b/recipes/wikipedia_example_ruby.rb index d1599ad..488c4d3 100644 --- a/recipes/wikipedia_example_ruby.rb +++ b/recipes/wikipedia_example_ruby.rb @@ -12,7 +12,7 @@ verify_license_key node[:newrelic][:license_key] -install_plugin 'newrelic_wikipedia_example_ruby_plugin' do +newrelic_plugin 'newrelic_wikipedia_example_ruby_plugin' do plugin_version node[:newrelic][:wikipedia_example_ruby][:version] install_path node[:newrelic][:wikipedia_example_ruby][:install_path] plugin_path node[:newrelic][:wikipedia_example_ruby][:plugin_path] From 3352f41da31468c665d4f2e4942ea48857762bbd Mon Sep 17 00:00:00 2001 From: Jake Plimack Date: Mon, 23 Mar 2015 12:56:15 -0600 Subject: [PATCH 4/5] rename definition --- definitions/{install_plugin.rb => newrelic_plugin.rb} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename definitions/{install_plugin.rb => newrelic_plugin.rb} (100%) diff --git a/definitions/install_plugin.rb b/definitions/newrelic_plugin.rb similarity index 100% rename from definitions/install_plugin.rb rename to definitions/newrelic_plugin.rb From bf0308dbea446fe80cbd6f2237b0e06276746b73 Mon Sep 17 00:00:00 2001 From: Jake Plimack Date: Mon, 23 Mar 2015 12:59:10 -0600 Subject: [PATCH 5/5] ugh --- definitions/newrelic_plugin.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/definitions/newrelic_plugin.rb b/definitions/newrelic_plugin.rb index b9e6c66..35db9ad 100644 --- a/definitions/newrelic_plugin.rb +++ b/definitions/newrelic_plugin.rb @@ -1,4 +1,4 @@ -define :install_plugin do +define :newrelic_plugin do tar_file = File.join(params[:install_path], "#{params[:name]}-#{params[:plugin_version]}.tar.gz") @@ -38,4 +38,4 @@ only_if { File.directory?(params[:plugin_path]) && Dir.entries(params[:plugin_path]).sort == %w(. ..) } end -end \ No newline at end of file +end