Capistrano 3 / rbenv / no PTY / best practices

92 views
Skip to first unread message

justin...@buyerquest.com

unread,
Nov 4, 2016, 9:02:43 AM11/4/16
to Capistrano
Versions:
  • Ruby - ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-linux] (from /opt/rbenv/shims/ruby)
  • Capistrano - 3.5.0
  • Rake / Rails / etc - not installed / used
Platform:
  • We are deploying a custom PHP application to a cluster, the deploy works fine, until the code tries to run compass, then we receive the following:
Running "compass:release" (compass) task
DEBUG [325e3552] Warning: Command failed: /bin/sh: compass: command not found Use --force to continue.

I read http://capistranorb.com/documentation/advanced-features/ptys/ and it specifically calls out that rbenv causes issues, however the documentation doesn't provide links on how to fix anything. Now, we're not using multiple versions of Ruby as mentioned in the document, but we are using rbenv so we can run Ruby 2.2 on CentOS 6.x. The default on Cent 6 is 1.8 and our want / need is to use 2.2 because it is several orders faster with Compass than 1.8. But rbenv relies on files in /etc/profile.d.

I would be appreciative if someone could just point me to documentation on how to properly implement a solution - do I just use the 'with bash_env: "some path" do' method? Or is the "right" answer that we are forced to use Ruby 1.8 because that is the RPM / platform specific and supported version (I probably would be willing to break with standards if that is the case though - Ruby 2.2 is 2x-4x faster than Ruby 1.8 from what I am seeing). 
 
  • CentOS 6.x

Lee Hambley

unread,
Nov 6, 2016, 11:51:16 AM11/6/16
to Capistrano
Justin,

Were you still struggling with this?

--
You received this message because you are subscribed to the Google Groups "Capistrano" group.
To unsubscribe from this group and stop receiving emails from it, send an email to capistrano+unsubscribe@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/capistrano/3be2949c-e9c4-4a94-88d4-aaa13c500589%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

justin...@buyerquest.com

unread,
Nov 7, 2016, 9:51:32 AM11/7/16
to Capistrano


On Sunday, November 6, 2016 at 11:51:16 AM UTC-5, Lee Hambley wrote:
Justin,

Were you still struggling with this?
On 4 November 2016 at 14:00, <justin...@buyerquest.com> wrote:
Versions:
  • Ruby - ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-linux] (from /opt/rbenv/shims/ruby)
  • Capistrano - 3.5.0
  • Rake / Rails / etc - not installed / used
Platform:
  • We are deploying a custom PHP application to a cluster, the deploy works fine, until the code tries to run compass, then we receive the following:
Running "compass:release" (compass) task
DEBUG [325e3552] Warning: Command failed: /bin/sh: compass: command not found Use --force to continue.

I read http://capistranorb.com/documentation/advanced-features/ptys/ and it specifically calls out that rbenv causes issues, however the documentation doesn't provide links on how to fix anything. Now, we're not using multiple versions of Ruby as mentioned in the document, but we are using rbenv so we can run Ruby 2.2 on CentOS 6.x. The default on Cent 6 is 1.8 and our want / need is to use 2.2 because it is several orders faster with Compass than 1.8. But rbenv relies on files in /etc/profile.d.

I would be appreciative if someone could just point me to documentation on how to properly implement a solution - do I just use the 'with bash_env: "some path" do' method? Or is the "right" answer that we are forced to use Ruby 1.8 because that is the RPM / platform specific and supported version (I probably would be willing to break with standards if that is the case though - Ruby 2.2 is 2x-4x faster than Ruby 1.8 from what I am seeing). 
 
  • CentOS 6.x

--
You received this message because you are subscribed to the Google Groups "Capistrano" group.
To unsubscribe from this group and stop receiving emails from it, send an email to capistrano+...@googlegroups.com.


Yes - I am still unable to get the deploys to work properly. Do you have any recommendations? I'm fine with RTFM, but hadn't found the manual yet to read so would appreciates links to the manual if you have them ;) 

Thank you,

Lee Hambley

unread,
Nov 7, 2016, 11:32:27 AM11/7/16
to Capistrano
To unsubscribe from this group and stop receiving emails from it, send an email to capistrano+unsubscribe@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/capistrano/6ee22808-01d9-4c3b-b9e5-e8b94ce8077a%40googlegroups.com.

justin...@buyerquest.com

unread,
Nov 9, 2016, 10:38:07 AM11/9/16
to Capistrano
No - let me try that and I'll post back to this list. Thank you.

justin...@buyerquest.com

unread,
Nov 14, 2016, 4:08:37 PM11/14/16
to Capistrano
I've updated the code to use that module, but I don't think it's doing what we need. I think the problem stems from our setup and I'm not sure how to work around it. We're using NPM to call Grunt which in turn runs Compass. When Grunt runs Compass, we receive this error:


DEBUG [42d8fbc2] Running "compass:release" (compass) task DEBUG [42d8fbc2] Warning: Command failed: /bin/sh: compass: command not found Use --force to continue. Aborted due to warnings.


Compass is installed, but only as part of rbenv:

[justin.spies@ip-111-111-111-111 ~] :) which compass

/opt/rbenv/shims/compass



When I SSH to the server and run the Grunt command manually, however, it works just fine:

[justin.spies@ip-111-111-111-111 dev.yoursite.com] :( sudo su - builds

[sudo] password for justin.spies: 

[builds@ip-111-111-111-111 ~] :) cd /var/www/dev.yoursite.com/

[builds@ip-111-111-111-111 dev.yoursite.com] :) grunt

Running "compass:release" (compass) task

    write skin/frontend/buyerquest/default/css/admin.css (9.968s)

    write skin/frontend/buyerquest/default/css/login.css (1.455s)


So I'm not sure if there is something I can do differently in Capistrano or if there is some kind of limitation in Grunt / Compass / Ruby / Capistrano / Bash. Any thoughts would be appreciated.

Lee Hambley

unread,
Nov 15, 2016, 3:52:22 AM11/15/16
to Capistrano
Hi Justin

http://capistranorb.com/documentation/faq/why-does-something-work-in-my-ssh-session-but-not-in-capistrano/ is a good place to start to work out what's going on. Your situation is unusual in that you are relying on rbenv to be active when you run nodejs, to have access to a suite of Ruby gems. You might be able to use :rbenv_map_bins, but more likely you'll need to approach someone who uses rbenv in production to find out how to make this work for you. 

Honestly, having been in the same situation some years ago, I dropped compass. Ruby using JavaScript to build Ruby to compile CSS struck me as unnecessarily complicated, so I simplified everything. (Compass is a monster.)

The problem is though that the rbenv plugin for Capistrano takes care for the binaries in :rbenv_map_bins, but not for node, started via ruby, starting javascript to start ruby.

I'm not sure this is the message you want. The bottom line is don't use rbenv in production. I always use BrightBox's packages [1] when I can, or find someone who provides binary packages for my OS. You can always take binaries from rvm and unpack them into /usr/local or wherever.

To unsubscribe from this group and stop receiving emails from it, send an email to capistrano+unsubscribe@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/capistrano/7390c6dc-bb76-4ae1-937c-cdba6f76ad04%40googlegroups.com.

justin...@buyerquest.com

unread,
Nov 21, 2016, 4:00:48 PM11/21/16
to Capistrano
Lee - no this is good info and what I needed. This is our last site using Compass at the moment and this may just push us to invest the time we need to get rid of Compass. I'm on the Ops, not the Dev side, so will need to take this back to the Devs and get buy in, but I appreciate the feedback.

I had read that link you provided as well, the thing is just getting all the pieces together. I'm wondering if this is a real world example where the docs can be updated to outline best practices?

I'm not familiar with BrightBox and a search for only BrightBox turned up a lot of results (most not relevant). Would be great to get a link from you so I can share that with our Developers.

Lee Hambley

unread,
Nov 22, 2016, 4:32:42 AM11/22/16
to Capistrano
Hey Justin,

Lee - no this is good info and what I needed. This is our last site using Compass at the moment and this may just push us to invest the time we need to get rid of Compass. I'm on the Ops, not the Dev side, so will need to take this back to the Devs and get buy in, but I appreciate the feedback.

​You'll probably find out that you're using one or two functions from Compass that you can find somewhere else implemented 100% in Sass or something else.​

I had read that link you provided as well, the thing is just getting all the pieces together. I'm wondering if this is a real world example where the docs can be updated to outline best practices?

​The docs are (un-)fortunately ​working as intended, we made a decision not to write specific docs for specific tools, rather preferring to stick to POSIX/shell standards, since they apply as the "foundation" of all other tools. It can mean that people struggle, since it's a dying field of knowledge.

I'm not familiar with BrightBox and a search for only BrightBox turned up a lot of results (most not relevant). Would be great to get a link from you so I can share that with our Developers.

​They're a hosting company from England, I'm not affiliated with them at all (I think someone from my usergroup used to work for them?) They provide packages (and a package repository) for Rubies on Debian and Ubuntu 


It's the easiest way to get Ruby in tonnes of versions on Debianish distros imho.

If you don't want to trust a hosting company from England you can also unpack such packages: 


​Directly into `/usr/local`​ to achieve the same. rvm has a binary install option that avoids compiling Ruby in the common case, but they're not magic, they're just tarballs that rvm usually unpacks into a special directory, and manages with symlinks and env vars. I prefer the BrightBox packages, frankly, but this is a valid solution.

​Ahoy,​

Reply all
Reply to author
Forward
0 new messages