Google Groups Home
Help | Sign in
Setting Environment variables via run on RHEL
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  2 messages - Collapse all
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
chris.a.williams@gmail.co m  
View profile
 More options Oct 27 2006, 11:03 am
From: "chris.a.willi...@gmail.com" <chris.a.willi...@gmail.com>
Date: Fri, 27 Oct 2006 15:03:19 -0000
Local: Fri, Oct 27 2006 11:03 am
Subject: Setting Environment variables via run on RHEL
I'm running a Rails app which uses the Oracle database adapter. One of
the things required by the underlying Oracle client is to have the
ORACLE_HOME environment variable set properly (or the driver chokes
whenever Rails is loaded).

I'm using bash, and my bashrc file isn't getting loaded. But I also
can't seem to set the environment variables via run commands in a task
that gets fired off before any other actions.

I have the following task:

task :env_dump, :roles => :app do
  run "ORACLE_HOME=/opt/oracle/instantclient_10_2"
  run "echo $ORACLE_HOME"
  run "echo $PATH"
end

The path gets echoed out, but nothing gets spit out after the echo
$ORACLE_HOME line. I've also tried executing a script which sets the
environment, but that doesn't seem to work either. Until I can properly
set the environment variables, deployment needs to be done manually by
logging in (where the environment does get set up as soon as I login
via my .bashrc file).

Has anyone else seen this? Has anyone been able to get around it?


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
chris.a.williams@gmail.co m  
View profile
 More options Oct 27 2006, 11:15 am
From: "chris.a.willi...@gmail.com" <chris.a.willi...@gmail.com>
Date: Fri, 27 Oct 2006 15:15:24 -0000
Local: Fri, Oct 27 2006 11:15 am
Subject: Re: Setting Environment variables via run on RHEL
So after some digging, I've managed to find a way to get it to work:

First, I monkeypatched Capistrano as mentioned in the earlier thread:
capistrano, .bashrc, Debian and RedHat
http://groups.google.com/group/capistrano/browse_thread/thread/a59ce6...

Next I had to set :use_sudo to false in my deploy.rb:
set :use_sudo, false

Both of these together seem to work (but it seems a little ugly).


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2008 Google