-
Notifications
You must be signed in to change notification settings - Fork 48
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
Fetch :deploy_to from stage file #22
Comments
Could be a Cap bug but try defining set :deploy_to, -> { '/var/www/my_app' } Some workaround like the following may work as well: # deploy.rb
if fetch(:stage) == 'production'
set :deploy_to, '/home/http/my_app/deploy'
else
set :deploy_to, '/var/www/my_app'
end |
Thanks for your input! The lambda thing didn't seem to help. The workaround would though. But I would rather have the config separate. But you think that it could be an issue in SSHKit rather maybe? (I guess that makes more sense). |
capistrano/capistrano#845 Seem related to |
Oh one more thing to try is: SSHKit.config.command_map[:composer] = "#{fetch(:shared_path).join("composer.phar")}"
# and maybe even (not sure if SSHKit supports the lambda usage)
SSHKit.config.command_map[:composer] = -> { "#{fetch(:shared_path).join("composer.phar")}" } |
Results in The weird thing I guess, to me, is that composer.phar is downloaded to the correct path. So having :deploy_to set in both deploy.rb and production.rb/staging.rb works for everything except when capistrano/composer tries to run composer. I'm not 100% sure but I assume its that SSHKit line. It doesn't fetch the right :shared_path somehow. |
If I do:
In a task in :deploy namespace after :starting for example. I get the correct path. So maybe SSHKit runs "to early" or something. |
http://stackoverflow.com/questions/24650384/access-to-shared-path-in-deploy-rb Good to see you're not alone. |
I guess you could try: set :composer_path = -> { fetch(:shared_path).join('composer.phar') }
SSHKit.config.command_map[:composer] = composer_path But not sure about that since you're supposed to use |
Ah. Yeah. I Googled it but didnt find that one. -1 Google skills. :) I moved the command_map line into that task. Which worked. So my assumption maybe was correct. I guess that's an "ok" solution.
Not sure that is the "right" solution though :) |
I tried a couple of different other like your last example there. But none work. My task solution works at least. Even though it doesn't feel like a 100% proper solution. :) Thanks for your time though! |
anks feedmeastraycat for your solution. I had the same problem and got it working thanks to yours which is the best so far (at least for me :)) |
The "task solution" is kind of ugly. And if you have more than one executable it's not very user friendly. Can we reopen this issue? |
👍 for a constant solution @gagarine @davidlonjon ! Please also see issue #43. |
Any news on this? |
In my deploy.rb I have
set :deploy_to, '/var/www/my_app'
but in my production.rb I have to haveset :deploy_to, '/home/http/my_app/deploy'
. Composer is downloaded and installed into/home/http/my_app/deploy/shared/
but when Capistrano tries to run it to install the vendor dir it fails because it looks for/var/www/my_app
.The only way to get around this is to move the correct
set :deploy_to
directly in the deploy.rb file. But now I have to change it manually each time I deploy to staging or dev.Not sure if I have done something wrong though. :) I'm still quite new to Capistrano and my only Ruby knowledge is from Capistrano.
These are my composer settings in deploy.rb:
The text was updated successfully, but these errors were encountered: