Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

bluepill binary path was not set correctly in RVM-controlled Ruby environment #6

Closed
wants to merge 4 commits into from

5 participants

@alexclear

This patch detects RVM and sets bluepill binary path accordingly

@jgarber

This would have saved me some trouble. Hope it gets merged in soon!

@dergachev

Just ran into this problem too. Very frustrating!

@dergachev

The changes in this pull request didn't actually work for me.

As a workaround I added the following code to my recipe:
https://github.com/dergachev/audioskim/blob/master/site-cookbooks/passenger_rvm/recipes/bluepill.rb

@sethvargo

Hey @alexclear! Thank you for supporting the Opscode Cookbooks! Our process has a couple prerequisites before we can merge your contribution. We need to ensure you've completed a Contributor License Agreement (CLA) and a ticket on our ticket tracker for the release workflow. Pull requests are optional, but should always include the ticket number that they're related to for cross-referencing. Please take a moment to review the below wiki page for the appropriate steps:

@sethvargo

Ohai!

I'm going to close this due to inactivity, but please reopen if you have more time to work on this issue :smile:!

@sethvargo sethvargo closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
View
9 attributes/default.rb
@@ -15,7 +15,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-default["bluepill"]["bin"] = "#{languages[:ruby][:bin_dir]}/bluepill"
+if "#{languages[:ruby][:bin_dir]}" =~ /^.*rvm\/rubies\/(.*)\/bin$/
+ default['bluepill']['gemset'] = $~[1]
+ default['bluepill']['bin'] = "#{languages[:ruby]['gems_dir']}/bin/bluepill"
+ default['bluepill']['rvm_detected'] = true
+else
+ default["bluepill"]["bin"] = "#{languages[:ruby][:bin_dir]}/bluepill"
+ default['bluepill']['rvm_detected'] = false
+end
default["bluepill"]["logfile"] = "/var/log/bluepill.log"
default["bluepill"]["pid_dir"] = "/var/run/bluepill"
default["bluepill"]["state_dir"] = "/var/lib/bluepill"
View
1  metadata.rb
@@ -4,4 +4,5 @@
description "Installs bluepill gem and configures to manage services, includes bluepill_service LWRP"
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version "1.0.7"
+name "bluepill"
recipe "bluepill::default", "Installs bluepill rubygem and set up management directories"
View
7 recipes/default.rb
@@ -31,3 +31,10 @@
group node["bluepill"]["group"]
end
end
+
+if node["bluepill"]["rvm_detected"]
+ execute "create_wrapper" do
+ command "rvm wrapper #{node["bluepill"]["gemset"]} bootup bluepill"
+ not_if "which bootup_bluepill"
+ end
+end
View
17 templates/centos/bluepill_init.erb
@@ -8,10 +8,25 @@
# Default-Start: 3 4 5
# Default-Stop: 0 1 2 6
-BLUEPILL_BIN=<%= node['bluepill']['bin'] %>
BLUEPILL_CONFIG=<%= @config_file %>
SERVICE_NAME=<%= @service_name %>
+<% if node['bluepill']['rvm_detected'] %>
+# Load RVM into a shell session *as a function*
+if [[ -s "$HOME/.rvm/scripts/rvm" ]] ; then
+ # First try to load from a user install
+ source "$HOME/.rvm/scripts/rvm"
+elif [[ -s "/usr/local/rvm/scripts/rvm" ]] ; then
+ # Then try to load from a root install
+ source "/usr/local/rvm/scripts/rvm"
+else
+ printf "ERROR: An RVM installation was not found.\n"
+fi
+BLUEPILL_BIN=`which bootup_bluepill`
+<% else %>
+BLUEPILL_BIN=<%= node['bluepill']['bin'] %>
+<% end %>
+
case "$1" in
start)
echo "Loading bluepill configuration for $SERVICE_NAME "
Something went wrong with that request. Please try again.