banago / PHPloy

PHPloy - Incremental Git (S)FTP deployment tool that supports multiple servers, submodules and rollbacks.
http://wplancer.com/phploy/
1.42k stars 197 forks source link

ftp_fput(): Can't open that file: Is a directory #113

Closed bobrocke closed 9 years ago

bobrocke commented 9 years ago

I'm getting this error:

RockBox:www.grav.dev bob$ phploy

---------------------------------------------------
|              PHPloy v3.0.16-stable              |
---------------------------------------------------

SERVER: production
 ^ 1 of 4 user/pages/03.accordions/accordions.md
 ^ 2 of 4 user/pages/04.stylesheet/stylesheet.md

Oh Snap: ftp_fput(): Can't open that file: Is a directory

And using this deploy.ini file:

[production]
scheme = ftp
port = 21
user = myusername
pass = mypassword
host = myftpserver
path = mypath
passive = true
skip[] = '.editorconfig'
skip[] = '.gitignore'
skip[] = 'config.codekit'
skip[] = 'dandelion.yml'
skip[] = 'deployment-config.json'
skip[] = 'staging.yml'
skip[] = 'production.yml'
skip[] = 'htaccess.txt'
skip[] = '.idea/*'
skip[] = 'nginx.conf'
skip[] = 'README.md'
skip[] = '*.ini'

What is it that I'm doing wrong?

bobrocke commented 9 years ago

I thought it might have been my submodules, but this didn't work, either:

RockBox:www.grav.dev bob$ phploy --submodules

---------------------------------------------------
|              PHPloy v3.0.16-stable              |
---------------------------------------------------

Scanning repository...
   Found 2 submodules.
   Found submodule user/plugins/materializer. 
      Scanning for sub-submodules...
   Found submodule user/themes/materialize. 
      Scanning for sub-submodules...

SERVER: production
 ^ 1 of 4 user/pages/03.accordions/accordions.md
 ^ 2 of 4 user/pages/04.stylesheet/stylesheet.md

Oh Snap: ftp_fput(): Can't open that file: Is a directory
banago commented 9 years ago

@bobrocke it seems a directory with the same name exists in the server. Can you check that through FileZilla or something similar? Please let me know.

bobrocke commented 9 years ago

Yes, there are many directories. I thought that was the point - update a web site.

banago commented 9 years ago

This is only happening for one particular file. You have a file and a directory with the same name so they collide. Makes sense? Seems to be this: user/pages/04.stylesheet/stylesheet.md

bobrocke commented 9 years ago

OK. So bug? There's nothing wrong or odd about a file and a folder with the same names.

But here they are not: 04.stylesheet != stylesheet.md

banago commented 9 years ago

In theory, this is a proper check. I think your next file to be uploaded might be the caveat. What's the third file? Check if a folder with that name exists on the server.

bobrocke commented 9 years ago

phploy -l says:

RockBox:www.grav.dev bob$ phploy -l

---------------------------------------------------
|              PHPloy v3.0.16-stable              |
---------------------------------------------------

PHPloy is running in LIST mode. No remote files will be modified.

SERVER: production
   Files that will be uploaded in next deployment:
      user/pages/03.accordions/accordions.md
      user/pages/04.stylesheet/stylesheet.md
      user/plugins/materializer
      user/themes/materialize

It looks like it wants to start uploading the submodule materializer, which is a folder that exists. Why won't phploy just overwrite changed files as needed?

banago commented 9 years ago

Seems there is a bug there - submodule names should be removed from uploads; that is the bug. Will let you know when I fix it, hopefully over the weekend. Thanks for your persistence.

banago commented 9 years ago

@bobrocke this issue is now fixed. Please grab the latest version and check for yourself. Thanks very much for your time tinkering with PHPloy. Happy deploying! :smile_cat:

bobrocke commented 9 years ago

It does not work for me:

RockBox:www.grav.dev bob$ phploy --submodule

---------------------------------------------------
|              PHPloy v3.0.18-stable              |
---------------------------------------------------

SERVER: production
 ^ 1 of 4 user/pages/03.accordions/accordions.md
 ^ 2 of 4 user/pages/04.stylesheet/stylesheet.md
PHP Warning:  ftp_fput(): Can't open that file: Is a directory in phar:///usr/local/bin/phploy/vendor/banago/bridge/src/Backend/Ftp.php on line 140
PHP Stack trace:
PHP   1. {main}() /usr/local/bin/phploy:0
PHP   2. include() /usr/local/bin/phploy:10
PHP   3. Banago\PHPloy\PHPloy->__construct() phar:///usr/local/bin/phploy/phploy.php:11
PHP   4. Banago\PHPloy\PHPloy->deploy() phar:///usr/local/bin/phploy/src/PHPloy.php:266
PHP   5. Banago\PHPloy\PHPloy->push() phar:///usr/local/bin/phploy/src/PHPloy.php:793
PHP   6. Banago\Bridge\Bridge->put() phar:///usr/local/bin/phploy/src/PHPloy.php:982
PHP   7. Banago\Bridge\Backend\FTP->put() phar:///usr/local/bin/phploy/vendor/banago/bridge/src/Bridge.php:79
PHP   8. ftp_fput() phar:///usr/local/bin/phploy/vendor/banago/bridge/src/Backend/Ftp.php:140

Warning: ftp_fput(): Can't open that file: Is a directory in phar:///usr/local/bin/phploy/vendor/banago/bridge/src/Backend/Ftp.php on line 140

Call Stack:
    0.0020     304640   1. {main}() /usr/local/bin/phploy:0
    0.0029     393208   2. include('phar:///usr/local/bin/phploy/phploy.php') /usr/local/bin/phploy:10
    0.0059     698880   3. Banago\PHPloy\PHPloy->__construct() phar:///usr/local/bin/phploy/phploy.php:11
    0.4430     719384   4. Banago\PHPloy\PHPloy->deploy() phar:///usr/local/bin/phploy/src/PHPloy.php:266
    1.1046     888280   5. Banago\PHPloy\PHPloy->push() phar:///usr/local/bin/phploy/src/PHPloy.php:793
    3.1758     892552   6. Banago\Bridge\Bridge->put() phar:///usr/local/bin/phploy/src/PHPloy.php:982
    3.1758     892552   7. Banago\Bridge\Backend\FTP->put() phar:///usr/local/bin/phploy/vendor/banago/bridge/src/Bridge.php:79
    3.1759     893456   8. ftp_fput() phar:///usr/local/bin/phploy/vendor/banago/bridge/src/Backend/Ftp.php:140

Oh Snap: Could not upload file 'user/plugins/materializer'

Do I have something else wrong?

banago commented 9 years ago

Something doesn't see right. Can you please paste what you get from phploy -l once again?

bobrocke commented 9 years ago

I made other changes in the meantime so I'll go from the start:

---------------------------------------------------
|              PHPloy v3.0.18-stable              |
---------------------------------------------------

SERVER: production
removed 1 of 2 system/src/Grav/Common/Filesystem/RecursiveFileFilterIterator.php
removed 2 of 2 vendor/mrclay/minify/README.txt
 ^  1 of 55 CHANGELOG.md
 ^  2 of 55 composer.json
 ^  3 of 55 system/config/system.yaml
 ^  4 of 55 system/defines.php
 ^  5 of 55 system/src/Grav/Common/Filesystem/Folder.php
 ^  6 of 55 system/src/Grav/Common/Grav.php
 ^  7 of 55 system/src/Grav/Common/Markdown/Parsedown.php
 ^  8 of 55 system/src/Grav/Common/Markdown/ParsedownExtra.php
 ^  9 of 55 system/src/Grav/Common/Markdown/ParsedownGravTrait.php
 ^ 10 of 55 system/src/Grav/Common/Page/Collection.php
 ^ 11 of 55 system/src/Grav/Common/Page/Medium/ParsedownHtmlTrait.php
 ^ 12 of 55 system/src/Grav/Common/Page/Page.php
 ^ 13 of 55 system/src/Grav/Common/Page/Pages.php
 ^ 14 of 55 system/src/Grav/Common/TwigExtension.php
 ^ 15 of 55 system/src/Grav/Common/Uri.php
 ^ 16 of 55 system/src/Grav/Common/User/Authentication.php
 ^ 17 of 55 system/src/Grav/Common/User/User.php
 ^ 18 of 55 system/src/Grav/Common/Utils.php
 ^ 19 of 55 system/src/Grav/Console/Cli/InstallCommand.php
 ^ 20 of 55 user/pages/03.accordions/accordions.md
 ^ 21 of 55 user/pages/04.stylesheet/stylesheet.md
PHP Warning:  ftp_fput(): Can't open that file: Is a directory in phar:///usr/local/bin/phploy/vendor/banago/bridge/src/Backend/Ftp.php on line 140
PHP Stack trace:
PHP   1. {main}() /usr/local/bin/phploy:0
PHP   2. include() /usr/local/bin/phploy:10
PHP   3. Banago\PHPloy\PHPloy->__construct() phar:///usr/local/bin/phploy/phploy.php:11
PHP   4. Banago\PHPloy\PHPloy->deploy() phar:///usr/local/bin/phploy/src/PHPloy.php:266
PHP   5. Banago\PHPloy\PHPloy->push() phar:///usr/local/bin/phploy/src/PHPloy.php:793
PHP   6. Banago\Bridge\Bridge->put() phar:///usr/local/bin/phploy/src/PHPloy.php:982
PHP   7. Banago\Bridge\Backend\FTP->put() phar:///usr/local/bin/phploy/vendor/banago/bridge/src/Bridge.php:79
PHP   8. ftp_fput() phar:///usr/local/bin/phploy/vendor/banago/bridge/src/Backend/Ftp.php:140

Warning: ftp_fput(): Can't open that file: Is a directory in phar:///usr/local/bin/phploy/vendor/banago/bridge/src/Backend/Ftp.php on line 140

Call Stack:
    0.0019     304472   1. {main}() /usr/local/bin/phploy:0
    0.0028     393032   2. include('phar:///usr/local/bin/phploy/phploy.php') /usr/local/bin/phploy:10
    0.0057     698736   3. Banago\PHPloy\PHPloy->__construct() phar:///usr/local/bin/phploy/phploy.php:11
    0.4367     719104   4. Banago\PHPloy\PHPloy->deploy() phar:///usr/local/bin/phploy/src/PHPloy.php:266
    1.0838     899224   5. Banago\PHPloy\PHPloy->push() phar:///usr/local/bin/phploy/src/PHPloy.php:793
   12.2601     910736   6. Banago\Bridge\Bridge->put() phar:///usr/local/bin/phploy/src/PHPloy.php:982
   12.2601     910736   7. Banago\Bridge\Backend\FTP->put() phar:///usr/local/bin/phploy/vendor/banago/bridge/src/Bridge.php:79
   12.2602     911640   8. ftp_fput() phar:///usr/local/bin/phploy/vendor/banago/bridge/src/Backend/Ftp.php:140

Oh Snap: Could not upload file 'user/plugins/materializer'

And:

RockBox:www.grav.dev bob$ phploy -l

---------------------------------------------------
|              PHPloy v3.0.18-stable              |
---------------------------------------------------

PHPloy is running in LIST mode. No remote files will be modified.

SERVER: production
   Files that will be deleted in next deployment:
      system/src/Grav/Common/Filesystem/RecursiveFileFilterIterator.php
      vendor/mrclay/minify/README.txt
   Files that will be uploaded in next deployment:
      CHANGELOG.md
      composer.json
      system/config/system.yaml
      system/defines.php
      system/src/Grav/Common/Filesystem/Folder.php
      system/src/Grav/Common/Grav.php
      system/src/Grav/Common/Markdown/Parsedown.php
      system/src/Grav/Common/Markdown/ParsedownExtra.php
      system/src/Grav/Common/Markdown/ParsedownGravTrait.php
      system/src/Grav/Common/Page/Collection.php
      system/src/Grav/Common/Page/Medium/ParsedownHtmlTrait.php
      system/src/Grav/Common/Page/Page.php
      system/src/Grav/Common/Page/Pages.php
      system/src/Grav/Common/TwigExtension.php
      system/src/Grav/Common/Uri.php
      system/src/Grav/Common/User/Authentication.php
      system/src/Grav/Common/User/User.php
      system/src/Grav/Common/Utils.php
      system/src/Grav/Console/Cli/InstallCommand.php
      user/pages/03.accordions/accordions.md
      user/pages/04.stylesheet/stylesheet.md
      user/plugins/materializer
      user/plugins/simplesearch/CHANGELOG.md
      user/plugins/simplesearch/blueprints.yaml
      user/plugins/simplesearch/hebe.json
      user/plugins/simplesearch/templates/partials/simplesearch_item.html.twig
      user/themes/materialize
      vendor/autoload.php
      vendor/composer/autoload_classmap.php
      vendor/composer/autoload_real.php
      vendor/composer/installed.json
      vendor/donatj/phpuseragentparser/CONTRIBUTING.md
      vendor/donatj/phpuseragentparser/Source/UserAgentParser.php
      vendor/filp/whoops/src/Whoops/Resources/css/whoops.base.css
      vendor/maximebf/debugbar/src/DebugBar/Resources/widgets.js
      vendor/mrclay/minify/README.md
      vendor/rockettheme/toolbox/File/src/File.php
      vendor/rockettheme/toolbox/File/src/MarkdownFile.php
      vendor/rockettheme/toolbox/README.md
      vendor/twig/twig/CHANGELOG
      vendor/twig/twig/lib/Twig/Autoloader.php
      vendor/twig/twig/lib/Twig/Environment.php
      vendor/twig/twig/lib/Twig/Error.php
      vendor/twig/twig/lib/Twig/Extension/Core.php
      vendor/twig/twig/lib/Twig/Loader/Filesystem.php
      vendor/twig/twig/lib/Twig/Loader/String.php
      vendor/twig/twig/lib/Twig/Node/Embed.php
      vendor/twig/twig/lib/Twig/Node/Expression/Call.php
      vendor/twig/twig/lib/Twig/Node/Expression/Name.php
      vendor/twig/twig/lib/Twig/Node/Import.php
      vendor/twig/twig/lib/Twig/Node/Include.php
      vendor/twig/twig/lib/Twig/Node/Module.php
      vendor/twig/twig/lib/Twig/NodeVisitor/Optimizer.php
      vendor/twig/twig/lib/Twig/Template.php
      vendor/twig/twig/lib/Twig/Test/NodeTestCase.php

See anything that helps?

banago commented 9 years ago

So, the issues are the these two:

user/plugins/materialize
user/themes/materializer

These two should normally be ignored and should not show as files to upload. This part works fine me, i.e. ignoring submodule names.

At this point, can you please what you get if you run git submodule?

bobrocke commented 9 years ago
RockBox:www.grav.dev bob$ git submodule
 90f0d77c05fb0eb4b18a9e1c87643752028ea019 user/plugins/materializer (1.2.2-4-g90f0d77)
 6ace3c18a350e1de0f3dac0aaa0787ee5d51b1fc user/themes/materialize (1.3.4)
banago commented 9 years ago

Found the bug - will push fix soon. Thanks @bobrocke

bobrocke commented 9 years ago

Great! And thanks for the fabulous help.

banago commented 9 years ago

Hey @bobrocke - it should fly now :joy_cat: Please grab latest version and let me know.

bobrocke commented 9 years ago

I think that fixed it!

To deploy a site with submodules do I need phploy --submodules AND phploy?

banago commented 9 years ago

Awesome to hear that!

By default submodules are turned off since they are not supposed to get deployed very often, so it saves unnecessary checks. Thus, to deploy submodules too, run this:

phploy --submodules
bobrocke commented 9 years ago

Thanks. I need to do a bit more testing to be sure, but it looks like you have it fixed. Thanks again!

banago commented 9 years ago

@bobrocke I check out your blog and saw that you do quite a bit of writing. If you like PHPloy enough, it would be cool to write a post about it. Highly appreciated! :smiley_cat:

bobrocke commented 9 years ago

Let me a get a bit more experience with it on a couple of my sites and I sure will!

banago commented 9 years ago

:+1: