Skip to content
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

Different command for SSHkit on local environment? #32

Open
cibulka opened this issue Oct 31, 2015 · 4 comments
Open

Different command for SSHkit on local environment? #32

cibulka opened this issue Oct 31, 2015 · 4 comments
Assignees
Labels

Comments

@cibulka
Copy link

cibulka commented Oct 31, 2015

In my production server, I can't install stuff globally. Because of that, in my deploy/production.rb file, I have the following config:

SSHKit.config.command_map[:composer] = "/home/web720/composer.phar"

This is respected by capistrano-wpcli, but unfortunately it is used the same way on local as well, which results in following error for me:

| => bundle exec cap production wpcli:uploads:rsync:pull
INFO [29d88580] Running /usr/bin/env rsync -avz --rsh=ssh --progress [email protected]:/www/itvar.cz/wwwroot/www/shared/web/app/uploads/ web/app/uploads/ as Cibulka@localhost
(Backtrace restricted to imported tasks)
cap aborted!
SSHKit::Command::Failed: rsync exit status: 65280
rsync stdout: Nothing written
rsync stderr: ssh: connect to host 81.91.83.149 port 22: Operation timed out
rsync: connection unexpectedly closed (0 bytes received so far) [receiver]
rsync error: unexplained error (code 255) at /SourceCache/rsync/rsync-45/rsync/io.c(453) [receiver=2.6.9]

Tasks: TOP => wpcli:uploads:rsync:pull
(See full trace by running task with --trace)

Is it possible to make capistrano-wpcli use different command on production (/home/web720/composer.phar) and development (composer)?

Thanks in advance!

@jeremyzahner
Copy link
Collaborator

Hi @cibulka.

As far as i can see your command from above has nothing to do with composer since you are trying to sync uploads.

Your connection to the server fails.

@jeremyzahner jeremyzahner self-assigned this Nov 14, 2015
@cibulka
Copy link
Author

cibulka commented Nov 17, 2015

Jeremy, thanks for an answer!

And yes, you are right - the main issue is with port 22. So I guess that before dealing with development/production command for Composer (composer//home/web720/composer.phar) I need to resolve the issue with the port setting.

Because of that, do you have any updates on #28? Thank you!

@davestevens
Copy link
Contributor

With regards to using different commands on remote and local servers we use

SSHKit.config.command_map[:wp] = "$(if [ $(which wp) ]; then echo 'wp'; else echo 'php55-cli #{shared_path.join(wp-cli.phar)'; fi)"

which will use wp if its available (local) or use the other define when not (remote).

So you'd want something like:

SSHKit.config.command_map[:composer] = "$(if [ $(which composer) ]; then echo 'composer'; else echo '/home/web720/composer.phar'; fi)"

in your config/deploy/production.rb file.

@henscu
Copy link

henscu commented Apr 7, 2018

@davestevens your fix works for me, thanks!

Is there a more elegant solution, like using sh instead of run_locally as mentioned by @leehambley in capistrano/sshkit#153 (comment) ..?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants