RobLoach / drush-docker

:whale: Docker Container to run Drush
http://registry.hub.docker.com/u/drush/drush
Other
19 stars 19 forks source link

archive-dump cannot run with busybox gzip #57

Open tomsaleeba opened 5 years ago

tomsaleeba commented 5 years ago

Steps:

  1. start container (tested with 8-alpine tag) and mount a drupal site so we have something to backup
  2. run drush ard

Expected: It works

Actual: It fails with a message like Failed to gzip /path/to/dump.tar.

If you run with --debug you can see the cause:

/var/www/html # drush --debug ard
Phar detected. Proceeding to drush_main().
Cache HIT cid: 8.1.16-commandfiles-0-60954001ac342546c761d962804718d9 [0.01 sec, 3.22 MB]                                                                                              [debug]
Bootstrap to phase 0. [0.08 sec, 7.47 MB]                                                                                                                                          [bootstrap]
Bootstrap to phase 2. [0.08 sec, 7.48 MB]                                                                                                                                          [bootstrap]
Drush bootstrap phase : bootstrap_drupal_root() [0.09 sec, 7.81 MB]                                                                                                                [bootstrap]
Initialized Drupal 7.43 root directory at /var/www/html [0.09 sec, 7.81 MB]                                                                                                        [bootstrap]
Find command files for phase 1 (max=2) [0.09 sec, 6.52 MB]                                                                                                                             [debug]
Cache HIT cid: 8.1.16-commandfiles-1-6c1b4cc31cf50dc6220ac0f028753e17 [0.09 sec, 6.53 MB]                                                                                              [debug]
Cache HIT cid: 8.1.16-annotationfiles-1-65c9d33001f1a290b81e22f4b0da7ee4 [0.09 sec, 6.53 MB]                                                                                           [debug]
Drush bootstrap phase : bootstrap_drupal_site() [0.11 sec, 6.54 MB]                                                                                                                [bootstrap]
Initialized Drupal site default at sites/default [0.11 sec, 6.54 MB]                                                                                                               [bootstrap]
Find command files for phase 2 (max=2) [0.11 sec, 6.54 MB]                                                                                                                             [debug]
Cache HIT cid: 8.1.16-install_profile-66ecfeb9791a023150773849f1550c5d [0.11 sec, 6.54 MB]                                                                                             [debug]
Cache HIT cid: 8.1.16-commandfiles-2-e81f8c726f49849c1ae340223574a681 [0.11 sec, 6.55 MB]                                                                                              [debug]
Cache HIT cid: 8.1.16-annotationfiles-2-0f158954fe9fb9fb36b96fb11d28771d [0.12 sec, 6.57 MB]                                                                                           [debug]
Found command: archive-dump (commandfile=archive) [0.12 sec, 6.57 MB]                                                                                                              [bootstrap]
Calling hook drush_archive_dump [0.13 sec, 8.06 MB]                                                                                                                                    [debug]
Cache MISS cid: 8.1.16-alias-path--15a6664634e88b32b6b71df70fb4d2ce [0.13 sec, 8.07 MB]                                                                                                [debug]
Backend invoke: env COLUMNS=190  /usr/local/bin/drush  --backend=2 --verbose --debug --root=/var/www/html --uri=http://default  sql-conf   --all 2>&1 [0.15 sec, 8.08 MB]            [command]
env COLUMNS=190  /usr/local/bin/drush  --backend=2 --verbose --debug --root=/var/www/html --uri=http://default  sql-conf   --all 2>&1 [0.15 sec, 8.08 MB]                             [notice]
Calling chdir(/var/www) [0.3 sec, 8.11 MB]                                                                                                                                             [debug]
Executing: tar  --exclude "html/sites" --dereference -cf /root/drush-backups/archive-dump/20181129052459/website.20181129_052459.tar html
Calling chdir(/var/www/html) [0.37 sec, 8.11 MB]                                                                                                                                       [debug]
Calling chdir(/var/www) [0.37 sec, 8.11 MB]                                                                                                                                            [debug]
Executing: tar  --dereference -rf /root/drush-backups/archive-dump/20181129052459/website.20181129_052459.tar html/sites/all
Calling chdir(/var/www/html) [0.39 sec, 8.11 MB]                                                                                                                                       [debug]
Calling chdir(/var/www) [0.39 sec, 8.11 MB]                                                                                                                                            [debug]
Executing: tar --dereference -rf /root/drush-backups/archive-dump/20181129052459/website.20181129_052459.tar html/sites/example.sites.php
Calling chdir(/var/www/html) [0.4 sec, 8.11 MB]                                                                                                                                        [debug]
sql-query: SHOW TABLES; [0.4 sec, 8.17 MB]                                                                                                                                            [notice]
Executing: mysql --defaults-extra-file=/tmp/drush_gNpIhH --database=website --host=mysql --silent  < /tmp/drush_OiDgPn
  accesslog
...snip
  webform_submitted_data
Calling system(mysqldump --defaults-extra-file=/tmp/drush_clHEkf  website --host=mysql --no-autocommit --single-transaction --opt -Q  > /tmp/drush_tmp_1543469099_5bff782bf059b/website.sql);
Database dump saved to /tmp/drush_tmp_1543469099_5bff782bf059b/website.sql [0.77 sec, 8.18 MB]                                                                                       [success]
Calling chdir(/tmp/drush_tmp_1543469099_5bff782bf059b) [0.77 sec, 8.19 MB]                                                                                                             [debug]
Executing: tar  --dereference -rf /root/drush-backups/archive-dump/20181129052459/website.20181129_052459.tar website.sql
Calling chdir(/var/www/html) [0.79 sec, 8.17 MB]                                                                                                                                       [debug]
Backend invoke: env COLUMNS=190  /usr/local/bin/drush  --backend=2 --verbose --debug --root=/var/www/html --uri=http://default  core-status 2>&1 [0.79 sec, 8.18 MB]                 [command]
env COLUMNS=190  /usr/local/bin/drush  --backend=2 --verbose --debug --root=/var/www/html --uri=http://default  core-status 2>&1 [0.79 sec, 8.18 MB]                                  [notice]
Calling chdir(/var/www) [1.24 sec, 8.25 MB]                                                                                                                                            [debug]
Executing: tar  --dereference -rf /root/drush-backups/archive-dump/20181129052459/website.20181129_052459.tar html/sites/default
Calling chdir(/var/www/html) [1.36 sec, 8.25 MB]                                                                                                                                       [debug]
Calling chdir(/tmp/drush_tmp_1543469099_5bff782bf059b) [1.36 sec, 8.26 MB]                                                                                                             [debug]
Executing: tar --dereference -rf /root/drush-backups/archive-dump/20181129052459/website.20181129_052459.tar MANIFEST.ini
Calling chdir(/var/www/html) [1.41 sec, 8.26 MB]                                                                                                                                       [debug]
Calling chdir(/var/www) [1.41 sec, 8.26 MB]                                                                                                                                            [debug]
Executing: tar -tf /root/drush-backups/archive-dump/20181129052459/website.20181129_052459.tar html/sites/default/default.settings.php
  html/sites/default/default.settings.php
Calling chdir(/var/www/html) [1.42 sec, 8.26 MB]                                                                                                                                       [debug]
Executing: gzip --no-name -f /root/drush-backups/archive-dump/20181129052459/website.20181129_052459.tar
  gzip: unrecognized option: no-name
  BusyBox v1.24.2 (2016-05-31 09:35:34 GMT) multi-call binary.

  Usage: gzip [-cfd123456789] [FILE]...

  Compress FILEs (or stdin)

        -1..9   Compression level
        -d      Decompress
        -c      Write to stdout
        -f      Force
Failed to gzip /root/drush-backups/archive-dump/20181129052459/website.20181129_052459.tar [1.43 sec, 8.26 MB]                                                                         [error]
Returned from hook drush_archive_dump [1.43 sec, 8.2 MB]                                                                                                                               [debug]
Command dispatch complete [1.43 sec, 8.15 MB]                                                                                                                                         [notice]

The bundled busybox gzip doesn't support the args that are used. You can fix it by installing the full gzip

apk add --no-cache gzip

Should this be preinstalled so the image "just works"?