shipit icon indicating copy to clipboard operation
shipit copied to clipboard

Deploy is using tar when there is no rsync

Open jankulma opened this issue 3 years ago • 1 comments

So I spent couple of hours debugging why the deploy works differently when launched from local vs from CI.

Turned out the docker image I was using on CI was missing rsync.

As rsync is listed in dependencies I would expected some error, but instead shipit uses tar:

# when no rsync is installed
Copy project to remote servers.
"copy" method is deprecated, please use "copyToRemote", "copyFromRemote", "scpCopyToRemote" or "scpCopyFromRemote". It will break in v5.0.0.
Running "mkdir -p /var/apps/myapp/releases/20210721062223" on host "207.154.247.89".
Running "cd /var/apps/myapp/releases/20210721062223 && tar -xzf tmp-398FN6d3fh21UK.tar.gz" on host "207.154.247.89".
Running "cd /var/apps/myapp/releases/20210721062223 && rm tmp-398FN6d3fh21UK.tar.gz" on host "207.154.247.89".
Finished copy.
# when rsync is installed
Copy project to remote servers.
"copy" method is deprecated, please use "copyToRemote", "copyFromRemote", "scpCopyToRemote" or "scpCopyFromRemote". It will break in v5.0.0.
Copy "/tmp/tmp-338fW2hhc27GEJS/" to "[email protected]:/var/apps/myapp/releases/20210721063312" via rsync
Finished copy.

When tar is used, the release is deployed not directly in "current" dir, but in "current/tmp-sdgf2342".

I'm not sure if this is a bug, but perhaps this will save someone some time.

jankulma avatar Jul 21 '21 06:07 jankulma

I experience the same issue as @jankulma mentioned the directory layout seems to be different based on the tooling used to copy the code to the remote server:

With rsync:

<deployTo>/releases/<release timestamp>/<code>

without rsync:

<deployTo>/releases/<release timestamp>/<tmp dir>/<code>

As a workaround, I installed rsync in the CI and move on, however, it looks like there is an option that controls this behavior, but I didn't try it out.

image

Nevertheless, it seems a little bit counter-intuitive that copying the source code with or without rsync produce a different layout, I'm more than happy to submit a patch, just wonder if this behavior is intended or not, additionally, I wonder if it would make sense to raise an error if rsync is not available when the copy method is set to rsync rather than fallback to another method?

sestrella avatar Aug 04 '21 15:08 sestrella