Deployer: rsync make dir failed - no such file or directory

Created on 26 Oct 2017  ·  10Comments  ·  Source: deployphp/deployer

| Q | A
| ----------------- | ---
| Issue Type | Bug, Question, Feature Request
| Deployer Version | 6.0.3
| Local Machine OS | Linux
| Remote Machine OS | Linux

Description

If you're reporting a bug, please include following information

Steps to reproduce

Upload files in a directory not under source control.

Content of deploy.php

// build assets
task('deploy:build_assets', function () {
   runLocally('gulp build --production');
   upload(__DIR__ . '/themes/m/assets/dist/css', '{{release_path}}/themes/m/assets/dist/css');
   upload(__DIR__ . '/themes/m/assets/dist/fonts', '{{release_path}}/themes/m/assets/dist/fonts');
   upload(__DIR__ . '/themes/m/assets/dist/img', '{{release_path}}/themes/m/assets/dist/img');
})->desc('Build assets');

Output log

With enabled option for verbose output -vvv.

[prod_1] > rsync -azP -e 'ssh -A' /home/jacmoe/vhosts/jacmoe/themes/m/assets/dist/css [email protected]:/var/www/virtual/jacmoe/jacmoes/releases/30/themes/m/assets/dist/css
[prod_1] < sending incremental file list
[prod_1] < rsync: mkdir "/var/www/virtual/jacmoe/jacmoes/releases/30/themes/m/assets/dist/css" failed: No such file or directory (2)
[prod_1] < rsync error: error in file IO (code 11) at main.c(576) [receiver=3.0.6]
[prod_1] < rsync: connection unexpectedly closed (202 bytes received so far) [sender]
[prod_1] < rsync error: error in rsync protocol data stream (code 12) at io.c(226) [sender=3.1.2]
➤ Executing task deploy:failed

Mkdir fails because the directory doesn't exist? :p

I have recently upgraded to the latest Deployer version, and this behavior has changed.

The above code ran perfectly with previous version.

The directories in question doesn't exist in my repository because they are generated.

However, when I try and work around it by adding a .gitkeep/.gitignore to them, Deployer doesn't do the right thing either:

/var/www/virtual/jacmoe/jacmoes/releases/30/themes/m/assets/dist/css becomes /var/www/virtual/jacmoe/jacmoes/releases/30/themes/m/assets/dist/css/css ??!

All 10 comments

Do I need to do anything extra in order for Deployer to handle generated files to be uploaded to the server?

Try run this directly in terminal:

rsync -azP -e 'ssh -A' /home/jacmoe/vhosts/jacmoe/themes/m/assets/dist/css [email protected]:/var/www/virtual/jacmoe/jacmoes/releases/30/themes/m/assets/dist/css

New deployer uses rsync for uploads as it much more mature and feature rich programm then scp or pipes other ssh.

Also please read this: https://deployer.org/docs/api#upload
tldr;

You may have noticed that there is a trailing slash (/) at the end of the first argument in the above command, this is necessary to mean "the contents of build".

The alternative, without the trailing slash, would place build, including the directory, within public. This would create a hierarchy that looks like: {{release_path}}/public/build

The command works if I type it manually, after adjusting the release number.

If I type in a release number not there, it will fail with the same error message, which actually makes sense.

Perhaps it is using the old release number, i.e. not incremented ?

I will also try with and without the trailing slash.

I haven't got the time right now - will test tomorrow - thanks! 😄

Perhaps it is using the old release number, i.e. not incremented ?

Do you call deploy:build_assets before or after deploy:release? It is incremented there.

I call it after deploy:vendors, right before symlink and unlock - I will do a couple of tests again...

OK, I know what the problem is now:

This command fails, because dist is not present:
rsync -azP -e 'ssh -A' /home/jacmoe/vhosts/jacmoe/themes/m/assets/dist/css [email protected]:/var/www/virtual/jacmoe/jacmoes/releases/35/themes/m/assets/dist/css

Now I changed the build_assets command to the following:

// build assets
task('deploy:build_assets', function () {
   runLocally('gulp build --production');
   upload(__DIR__ . '/themes/m/assets/dist', '{{release_path}}/themes/m/assets');
})->desc('Build assets');

More brute force, simpler, and - most importantly! it works 😄

I guess it is a limitation of rsync that it does not want to recursively create directories.

I can live with that. ;)

Solved!

Thanks for the help! 👍

I guess it is a limitation of rsync that it does not want to recursively create directories.

Will check it and hack it)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

greatwitenorth picture greatwitenorth  ·  4Comments

antonmedv picture antonmedv  ·  5Comments

lsv picture lsv  ·  4Comments

krve picture krve  ·  4Comments

dima-stefantsov picture dima-stefantsov  ·  4Comments