-
Notifications
You must be signed in to change notification settings - Fork 492
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Invoked tasks don't pick up ENV variables #11
Comments
Solved by invoking a task outside deploy as seen in #5. task :env do
queue %{
echo "-----> Loading environment"
#{echo_cmd %[source ~/.bash_profile]}
}
end
desc 'Deploys the current version to the server.'
task :deploy do
invoke :env
deploy do
invoke :'git:clone'
invoke :'bundle:install'
invoke :'rails:assets_precompile'
invoke :'mongoid:create_indexes'
end
end |
Doing If I were to make a really-lucky-shot-in-the-dark guess, your mongoid config probably looks like: development:
# stuff
production:
uri: <%= ENV['MONGODB_URI'] %> But you're invoking rake like so:
...which will probably pick up the development config, not the production config. You should try |
You can verify that the env vars are picked up like so:
|
...out of sheer curiosity, why are you reindexing after every deploy? Shouldn't you only perform a reindex if you change the fields that are being indexed? :) |
I have set the RAILS_ENV=production variable in .bash_profile.
Invoking that command executes I've managed to get the deploy script working but I had found some friction with Unicorn. I won't be able to work on it this coming week, but I'll post updates as soon as I can. |
Cool, looks like there's nothing wrong with ENV vars so I'm closing this. Feel free to open another issue if you encounter problems. Cheers! :) |
I was trying to deploy but my server is behind a proxy. I used the @razielgn hook to set env http_proxy variable and it worked. Thanks!
|
Thanks @matheusvetor it saved my symfony deploy. There should be an easier way to do this. |
👍 💯 |
I have the following .bash_profile on the server:
However when assets get precompiled an thus the Rails app gets loaded I get
Meaning mongodb's ENV variable isn't picked up.
When I force mina to invoke
source ~/.bash_profile && rake assets:precompile
everything goes right.The text was updated successfully, but these errors were encountered: