deployphp / deployer

The PHP deployment tool with support for popular frameworks out of the box
https://deployer.org
MIT License
10.61k stars 1.48k forks source link

Using ~ in the destination of upload() results in files not being uploaded #907

Closed mrchimp closed 7 years ago

mrchimp commented 7 years ago
Q A
Issue Type Bug
Deployer Version 4.1
Local Machine OS OS X Sierra
Remote Machine OS Ubuntu 14.04

Description

When using ~ in the destination of the upload() function, no files are uploaded. No errors are given - it appears to succeed but the files aren't created on the server. Using -vvv shows that is attempting to upload the correct files.

Steps to reproduce

Content of deploy.php

<?php

namespace Deployer;

require 'recipe/common.php';

set('repository', 'git@bitbucket.org:............');
set('theme_dir', 'mytheme');
set('writable_use_sudo', false);
set('writable_mode', 'chmod');

serverList('servers.yml');
set('local_theme', __DIR__ . '/web/app/themes/{{theme_dir}}');
set('shared_dirs', ['web/app/uploads']);
set('shared_files', ['.env', 'web/.htaccess']);

task('deploy:upload_dist', function() {
  upload('{{local_theme}}/dist', '{{release_path}}/web/app/themes/{{theme_dir}}/dist/');
})->desc('Upload dist folder to server');

task('deploy:theme_composer', function() {
  cd('{{release_path}}/web/app/themes/{{theme_dir}}');
  run('composer install');
})->desc('Remote composer install');

task('setup', [
  'deploy:prepare',
])->desc('Initial deployment setup');

task('deploy', [
  'deploy:release',
  'deploy:update_code',
  'deploy:vendors',
  'deploy:theme_composer',
  'deploy:shared',
  'deploy:upload_dist',
  'deploy:symlink',
  'cleanup'
])->desc('Executing Deploy task');

Content of servers.yml

stage:
  host: example.com
  user: admin
  identity_file: ~
  stage: staging
  deploy_path: ~/web/example.com/deployer
  # deploy_path: /home/admin/web/example.com/deployer # This works
  branch: dev

Output log

I'm not at my work machine so don't have the output but I don't think it would help with debugging. The output is that same as when it does work - all green.

antonmedv commented 7 years ago

It's hard to tell what is wrong. Need to see logs. upload works for me normal.

mrchimp commented 7 years ago

I have tried with ~ and with /home/admin (with no other changes) and this is definitely what is causing the problem. Output is below:


➤ Executing task deploy:release
[stage] > cd ~/web/testsite/deployer && (if [ -h release ]; then echo 'true'; fi)

Warning: date_default_timezone_get(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in phar:///usr/local/bin/dep/vendor/monolog/monolog/src/Monolog/Logger.php on line 311
[stage] > cd ~/web/testsite/deployer && ([ -d releases ] && [ "$(ls -A releases)" ] && echo "true" || echo "false")
[stage] < true
[stage] > cd ~/web/testsite/deployer && (cd releases && ls -t -d */)
[stage] < 16/
[stage] < 15/
[stage] < 14/
[stage] < 13/
[stage] < 12/
[stage] < 1/
[stage] < 20161102153953/
[stage] < 20161102153817/
[stage] < 20161102144601/
[stage] > cd ~/web/testsite/deployer && (if [ -f .dep/releases ]; then echo "true"; fi)
[stage] < true
[stage] > cd ~/web/testsite/deployer && (tail -n 10 .dep/releases)
[stage] < 20161124155359,11
[stage] < 20161124155654,11
[stage] < 20161124160010,11
[stage] < 20161124160038,11
[stage] < 20161124160110,11
[stage] < 20161124160427,12
[stage] < 20161124160703,13
[stage] < 20161124160818,14
[stage] < 20161124160925,15
[stage] < 20161128101050,16
[stage] > cd ~/web/testsite/deployer && (if [ -d ~/web/testsite/deployer/releases/17 ]; then echo 'true'; fi)
[stage] > cd ~/web/testsite/deployer && (date +"%Y%m%d%H%M%S")
[stage] < 20161128101121
[stage] > cd ~/web/testsite/deployer && (echo '20161128101121,17' >> .dep/releases)
[stage] > cd ~/web/testsite/deployer && (mkdir ~/web/testsite/deployer/releases/17)
[stage] > cd ~/web/testsite/deployer && (if [[ "$(man ln)" =~ "--relative" ]]; then echo "true"; fi)
[stage] < true
[stage] > cd ~/web/testsite/deployer && (ln -nfs --relative ~/web/testsite/deployer/releases/17 ~/web/testsite/deployer/release)
• done on [stage]
✔ Ok [1s 75ms]
➤ Executing task deploy:update_code
[stage] > which git
[stage] < /usr/bin/git
[stage] > /usr/bin/git version
[stage] < git version 1.9.1
[stage] > if [ -h ~/web/testsite/deployer/release ]; then echo 'true'; fi
[stage] < true
[stage] > readlink ~/web/testsite/deployer/release
[stage] < releases/17
[stage] > /usr/bin/git clone -b dev --depth 1 --recursive -q git@bitbucket.org:xxxxx/xxxxxxxxxxxxx.git ~/web/testsite/deployer/releases/17 2>&1
• done on [stage]
✔ Ok [11s 424ms]
➤ Executing task deploy:vendors
[stage] > if hash composer 2>/dev/null; then echo 'true'; fi
[stage] < true
[stage] > which composer
[stage] < /usr/local/bin/composer
[stage] > cd ~/web/testsite/deployer/releases/17 &&  /usr/local/bin/composer install --verbose --prefer-dist --no-progress --no-interaction --no-dev --optimize-autoloader
[stage] < Loading composer repositories with package information
[stage] < Installing dependencies from lock file
[stage] < Dependency resolution completed in 0.001 seconds
[stage] < Analyzed 86 packages to resolve dependencies
[stage] < Analyzed 112 rules to resolve dependencies
[stage] <   - Installing composer/installers (v1.0.25)
[stage] <     Loading from cache
[stage] <     Extracting archive
[stage] <
[stage] <   - Installing johnpbloch/wordpress-core-installer (0.2.1)
[stage] <     Loading from cache
[stage] <     Extracting archive
[stage] <
[stage] <   - Installing vlucas/phpdotenv (v2.4.0)
[stage] <     Loading from cache
[stage] <     Extracting archive
[stage] <
[stage] <   - Installing philippbaschke/acf-pro-installer (v1.0.2)
[stage] <     Loading from cache
[stage] <     Extracting archive
[stage] <
[stage] <   - Installing advanced-custom-fields/advanced-custom-fields-pro (5.4.8)
[stage] <     Loading from cache
[stage] <     Extracting archive
[stage] <
[stage] <   - Installing johnpbloch/wordpress (4.6.1)
[stage] <     Loading from cache
[stage] <     Extracting archive
[stage] <
[stage] <   - Installing wp-sync-db/wp-sync-db (dev-master 8f18390)
[stage] <     Loading from cache
[stage] <     Extracting archive
[stage] <
[stage] <   - Installing wp-sync-db/wp-sync-db-cli (dev-master e25e4ca)
[stage] <     Loading from cache
[stage] <     Extracting archive
[stage] <
[stage] <   - Installing wp-sync-db/wp-sync-db-media-files (dev-master cebf64e)
[stage] <     Loading from cache
[stage] <     Extracting archive
[stage] <
[stage] <   - Installing wpackagist-plugin/contact-form-7 (4.5.1)
[stage] <     Loading from cache
[stage] <     Extracting archive
[stage] <
[stage] <   - Installing wpackagist-plugin/contact-form-7-to-database-extension (2.10.24)
[stage] <     Loading from cache
[stage] <     Extracting archive
[stage] <
[stage] <   - Installing wpackagist-plugin/duplicate-post (3.0.1)
[stage] <     Loading from cache
[stage] <     Extracting archive
[stage] <
[stage] <   - Installing wpackagist-plugin/enhanced-e-commerce-for-woocommerce-store (1.0.18)
[stage] <     Loading from cache
[stage] <     Extracting archive
[stage] <
[stage] <   - Installing wpackagist-plugin/intuitive-custom-post-order (3.0.7)
[stage] <     Loading from cache
[stage] <     Extracting archive
[stage] <
[stage] <   - Installing wpackagist-plugin/members (1.1.2)
[stage] <     Loading from cache
[stage] <     Extracting archive
[stage] <
[stage] <   - Installing wpackagist-plugin/pricing-deals-for-woocommerce (1.1.1.2)
[stage] <     Loading from cache
[stage] <     Extracting archive
[stage] <
[stage] <   - Installing wpackagist-plugin/searchwp-live-ajax-search (1.1.8)
[stage] <     Loading from cache
[stage] <     Extracting archive
[stage] <
[stage] <   - Installing wpackagist-plugin/woocommerce (2.6.4)
[stage] <     Loading from cache
[stage] <     Extracting archive
[stage] <
[stage] <   - Installing wpackagist-plugin/wordpress-seo (3.7.0)
[stage] <     Loading from cache
[stage] <     Extracting archive
[stage] <
[stage] <   - Installing wpackagist-plugin/wpmandrill (1.33)
[stage] <     Loading from cache
[stage] <     Extracting archive
[stage] <
[stage] <   - Installing wpackagist-plugin/yith-woocommerce-request-a-quote (1.2.4)
[stage] <     Loading from cache
[stage] <     Extracting archive
[stage] <
[stage] <   - Installing wpackagist-plugin/zopim-live-chat (1.4.3)
[stage] <     Loading from cache
[stage] <     Extracting archive
[stage] <
[stage] < Generating optimized autoload files
• done on [stage]
✔ Ok [2s 103ms]
➤ Executing task deploy:theme_composer
[stage] > cd ~/web/testsite/deployer/releases/17/web/app/themes/theme && (composer install)
[stage] < Loading composer repositories with package information
[stage] < Installing dependencies (including require-dev) from lock file
[stage] <   - Installing composer/installers (v1.0.24)
[stage] <     Loading from cache
[stage] <
[stage] <   - Installing google/recaptcha (1.1.2)
[stage] <     Loading from cache
[stage] <
[stage] <   - Installing phpmailer/phpmailer (v5.2.14)
[stage] <     Loading from cache
[stage] <
[stage] <   - Installing tgmpa/tgm-plugin-activation (2.5.2)
[stage] <     Loading from cache
[stage] <
[stage] <   - Installing valendesigns/option-tree (v2.5.5)
[stage] <     Loading from cache
[stage] <
[stage] <   - Installing squizlabs/php_codesniffer (2.6.0)
[stage] <     Loading from cache
[stage] <
[stage] < phpmailer/phpmailer suggests installing league/oauth2-client (Needed for XOAUTH2 authentication)
[stage] < phpmailer/phpmailer suggests installing league/oauth2-google (Needed for Gmail XOAUTH2)
[stage] < Generating autoload files
• done on [stage]
✔ Ok [872ms]
➤ Executing task deploy:shared
[stage] > mkdir -p ~/web/testsite/deployer/shared/web/app/uploads
[stage] > if [ -d $(echo ~/web/testsite/deployer/releases/17/web/app/uploads) ]; then cp -rn ~/web/testsite/deployer/releases/17/web/app/uploads ~/web/testsite/deployer/shared; fi
[stage] > if [ -d $(echo ~/web/testsite/deployer/releases/17/web/app/uploads) ]; then rm -rf ~/web/testsite/deployer/releases/17/web/app/uploads; fi
[stage] > mkdir -p `dirname ~/web/testsite/deployer/releases/17/web/app/uploads`
[stage] > ln -nfs --relative ~/web/testsite/deployer/shared/web/app/uploads ~/web/testsite/deployer/releases/17/web/app/uploads
[stage] > if [ -f $(echo ~/web/testsite/deployer/releases/17/.env) ]; then rm -rf ~/web/testsite/deployer/releases/17/.env; fi
[stage] > if [ ! -d $(echo ~/web/testsite/deployer/releases/17/.) ]; then mkdir -p ~/web/testsite/deployer/releases/17/.;fi
[stage] > mkdir -p ~/web/testsite/deployer/shared/.
[stage] > touch ~/web/testsite/deployer/shared/.env
[stage] > ln -nfs --relative ~/web/testsite/deployer/shared/.env ~/web/testsite/deployer/releases/17/.env
[stage] > if [ -f $(echo ~/web/testsite/deployer/releases/17/web/.htaccess) ]; then rm -rf ~/web/testsite/deployer/releases/17/web/.htaccess; fi
[stage] > if [ ! -d $(echo ~/web/testsite/deployer/releases/17/web) ]; then mkdir -p ~/web/testsite/deployer/releases/17/web;fi
[stage] > mkdir -p ~/web/testsite/deployer/shared/web
[stage] > touch ~/web/testsite/deployer/shared/web/.htaccess
[stage] > ln -nfs --relative ~/web/testsite/deployer/shared/web/.htaccess ~/web/testsite/deployer/releases/17/web/.htaccess
• done on [stage]
✔ Ok [890ms]
➤ Executing task deploy:upload_dist
Upload from /Users/jake/vm/testsite/web/app/themes/theme/dist to ~/web/testsite/deployer/releases/17/web/app/themes/theme/dist/
Uploading /Users/jake/vm/testsite/web/app/themes/theme/dist/css/ie8.css
Uploading /Users/jake/vm/testsite/web/app/themes/theme/dist/css/ie8.css.map
Uploading /Users/jake/vm/testsite/web/app/themes/theme/dist/css/ie9.css
Uploading /Users/jake/vm/testsite/web/app/themes/theme/dist/css/ie9.css.map
Uploading /Users/jake/vm/testsite/web/app/themes/theme/dist/css/main.css
Uploading /Users/jake/vm/testsite/web/app/themes/theme/dist/css/main.css.map
Uploading /Users/jake/vm/testsite/web/app/themes/theme/dist/css/wp-admin.css
Uploading /Users/jake/vm/testsite/web/app/themes/theme/dist/css/wp-admin.css.map
Uploading /Users/jake/vm/testsite/web/app/themes/theme/dist/fonts/WooCommerce.eot
Uploading /Users/jake/vm/testsite/web/app/themes/theme/dist/fonts/WooCommerce.svg
Uploading /Users/jake/vm/testsite/web/app/themes/theme/dist/fonts/WooCommerce.ttf
Uploading /Users/jake/vm/testsite/web/app/themes/theme/dist/fonts/WooCommerce.woff
Uploading /Users/jake/vm/testsite/web/app/themes/theme/dist/img/bulletpoint.png
Uploading /Users/jake/vm/testsite/web/app/themes/theme/dist/img/calendar.png
Uploading /Users/jake/vm/testsite/web/app/themes/theme/dist/img/chosen-sprite.png
Uploading /Users/jake/vm/testsite/web/app/themes/theme/dist/img/chosen-sprite@2x.png
Uploading /Users/jake/vm/testsite/web/app/themes/theme/dist/img/help.png
Uploading /Users/jake/vm/testsite/web/app/themes/theme/dist/img/icon-share.png
Uploading /Users/jake/vm/testsite/web/app/themes/theme/dist/img/icons/credit-cards/amex.png
Uploading /Users/jake/vm/testsite/web/app/themes/theme/dist/img/icons/credit-cards/diners.png
Uploading /Users/jake/vm/testsite/web/app/themes/theme/dist/img/icons/credit-cards/discover.png
Uploading /Users/jake/vm/testsite/web/app/themes/theme/dist/img/icons/credit-cards/jcb.png
Uploading /Users/jake/vm/testsite/web/app/themes/theme/dist/img/icons/credit-cards/laser.png
Uploading /Users/jake/vm/testsite/web/app/themes/theme/dist/img/icons/credit-cards/maestro.png
Uploading /Users/jake/vm/testsite/web/app/themes/theme/dist/img/icons/credit-cards/mastercard.png
Uploading /Users/jake/vm/testsite/web/app/themes/theme/dist/img/icons/credit-cards/visa.png
Uploading /Users/jake/vm/testsite/web/app/themes/theme/dist/img/icons/edit.png
Uploading /Users/jake/vm/testsite/web/app/themes/theme/dist/img/icons/loader.svg
Uploading /Users/jake/vm/testsite/web/app/themes/theme/dist/img/loading.png
Uploading /Users/jake/vm/testsite/web/app/themes/theme/dist/img/placeholder.png
Uploading /Users/jake/vm/testsite/web/app/themes/theme/dist/img/product_placeholder_image.png
Uploading /Users/jake/vm/testsite/web/app/themes/theme/dist/img/search-tick.png
Uploading /Users/jake/vm/testsite/web/app/themes/theme/dist/img/search-untick.png
Uploading /Users/jake/vm/testsite/web/app/themes/theme/dist/img/select2-spinner.gif
Uploading /Users/jake/vm/testsite/web/app/themes/theme/dist/img/select2.png
Uploading /Users/jake/vm/testsite/web/app/themes/theme/dist/img/select2x2.png
Uploading /Users/jake/vm/testsite/web/app/themes/theme/dist/img/sprites/alavo-dryer.png
Uploading /Users/jake/vm/testsite/web/app/themes/theme/dist/img/sprites/alavo-soap.png
Uploading /Users/jake/vm/testsite/web/app/themes/theme/dist/img/sprites/alavo-water.png
Uploading /Users/jake/vm/testsite/web/app/themes/theme/dist/img/sprites/arrow-down.png
Uploading /Users/jake/vm/testsite/web/app/themes/theme/dist/img/sprites/arrow-left.png
Uploading /Users/jake/vm/testsite/web/app/themes/theme/dist/img/sprites/arrow-right.png
Uploading /Users/jake/vm/testsite/web/app/themes/theme/dist/img/sprites/carousel-dot.png
Uploading /Users/jake/vm/testsite/web/app/themes/theme/dist/img/sprites/carousel-ring.png
Uploading /Users/jake/vm/testsite/web/app/themes/theme/dist/img/sprites/cart-icon.png
Uploading /Users/jake/vm/testsite/web/app/themes/theme/dist/img/sprites/cross.png
Uploading /Users/jake/vm/testsite/web/app/themes/theme/dist/img/sprites/download-all.png
Uploading /Users/jake/vm/testsite/web/app/themes/theme/dist/img/sprites/download.png
Uploading /Users/jake/vm/testsite/web/app/themes/theme/dist/img/sprites/envelope-simple.png
Uploading /Users/jake/vm/testsite/web/app/themes/theme/dist/img/sprites/envelope.png
Uploading /Users/jake/vm/testsite/web/app/themes/theme/dist/img/sprites/icon-close.png
Uploading /Users/jake/vm/testsite/web/app/themes/theme/dist/img/sprites/linked-in.png
Uploading /Users/jake/vm/testsite/web/app/themes/theme/dist/img/sprites/logo.png
Uploading /Users/jake/vm/testsite/web/app/themes/theme/dist/img/sprites/pinterest.png
Uploading /Users/jake/vm/testsite/web/app/themes/theme/dist/img/sprites/range-header.png
Uploading /Users/jake/vm/testsite/web/app/themes/theme/dist/img/sprites/search-icon.png
Uploading /Users/jake/vm/testsite/web/app/themes/theme/dist/img/sprites/twitter.png
Uploading /Users/jake/vm/testsite/web/app/themes/theme/dist/img/sprites/view.png
Uploading /Users/jake/vm/testsite/web/app/themes/theme/dist/img/storefront-bg.jpg
Uploading /Users/jake/vm/testsite/web/app/themes/theme/dist/img/storefront.jpg
Uploading /Users/jake/vm/testsite/web/app/themes/theme/dist/img/team_placeholder_image.png
Uploading /Users/jake/vm/testsite/web/app/themes/theme/dist/img/woocommerce_logo.png
Uploading /Users/jake/vm/testsite/web/app/themes/theme/dist/img/woocommerce_logo.svg
Uploading /Users/jake/vm/testsite/web/app/themes/theme/dist/js/head.js
Uploading /Users/jake/vm/testsite/web/app/themes/theme/dist/js/head.js.map
Uploading /Users/jake/vm/testsite/web/app/themes/theme/dist/js/main.js
Uploading /Users/jake/vm/testsite/web/app/themes/theme/dist/js/main.js.map
Uploading /Users/jake/vm/testsite/web/app/themes/theme/dist/js/wp-admin.js
Uploading /Users/jake/vm/testsite/web/app/themes/theme/dist/js/wp-admin.js.map
Uploading /Users/jake/vm/testsite/web/app/themes/theme/dist/svg/arrow-down.svg
Uploading /Users/jake/vm/testsite/web/app/themes/theme/dist/svg/arrow-left.svg
Uploading /Users/jake/vm/testsite/web/app/themes/theme/dist/svg/arrow-right-light.svg
Uploading /Users/jake/vm/testsite/web/app/themes/theme/dist/svg/arrow-right-medium.svg
Uploading /Users/jake/vm/testsite/web/app/themes/theme/dist/svg/arrow-right.svg
Uploading /Users/jake/vm/testsite/web/app/themes/theme/dist/svg/search-icon.svg
Uploading /Users/jake/vm/testsite/web/app/themes/theme/dist/svg/sprite.symbol.svg
• done on [stage]
✔ Ok [2s 707ms]
➤ Executing task deploy:symlink
[stage] > if [[ "$(man mv)" =~ "--no-target-directory" ]]; then echo "true"; fi
[stage] < true
[stage] > mv -T ~/web/testsite/deployer/release ~/web/testsite/deployer/current
• done on [stage]
✔ Ok [113ms]
➤ Executing task cleanup
[stage] > rm -rf ~/web/testsite/deployer/releases/12
[stage] > cd ~/web/testsite/deployer && if [ -e release ]; then rm release; fi
[stage] > cd ~/web/testsite/deployer && if [ -h release ]; then rm release; fi
• done on [stage]
✔ Ok [433ms]```
antonmedv commented 7 years ago

Nothing uploaded?

mrchimp commented 7 years ago

Yes, nothing uploaded.

antonmedv commented 7 years ago

Try to upload only one file. Also try to debug it with xdebug. Can't reproduce it on my machine. As alternative solution you can use rsync.

mrchimp commented 7 years ago

Thanks for looking into it. I am busy today but will investigate further.

antonmedv commented 7 years ago

if there are other questions - please, fill free to ask.