welaika / wordmove

Multi-stage command line deploy/mirroring and task runner for Wordpress
https://wptools.it/wordmove
MIT License
1.87k stars 165 forks source link

wordmove push fails with: #395

Closed imbdev closed 7 years ago

imbdev commented 7 years ago

I have no clue why this is failing and I've spent hours looking for an answer on the Interweb. This is the last effort to get some help ... This is what I keep getting:

▬▬ ✓ Pushing Database ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
   remote | mysqldump --host=localhost --user=devhtmlf_wpadmin --password=******* --result-file="/home2/devhtmlf/public_html/mommyboss/wp-content/dump.sql" devhtmlf_mommy_db
gzip --best --force "/home2/devhtmlf/public_html/mommyboss/wp-content/dump.sql"
   remote | gzip --best --force "/home2/devhtmlf/public_html/mommyboss/wp-content/dump.sql"
   remote | get: /home2/devhtmlf/public_html/mommyboss/wp-content/dump.sql.gz /Users/shourav/Documents/2017/5.MAY/MOMMY-BOSS/wp-content/production-backup-1496067298.sql.gz
   remote | delete: /home2/devhtmlf/public_html/mommyboss/wp-content/dump.sql.gz
    local | mysqldump --host=localhost --user=root --password=***** --result-file="/Users/shourav/Documents/2017/5.MAY/MOMMY-BOSS/wp-content/dump.sql" omen_mommy_db
    local | adapt dump
gzip --best --force "/Users/shourav/Documents/2017/5.MAY/MOMMY-BOSS/wp-content/dump.sql"
    local | gzip --best --force "/Users/shourav/Documents/2017/5.MAY/MOMMY-BOSS/wp-content/dump.sql"
   remote | put: /Users/shourav/Documents/2017/5.MAY/MOMMY-BOSS/wp-content/dump.sql.gz /home2/devhtmlf/public_html/mommyboss/wp-content/dump.sql.gz
gzip -d --force "/home2/devhtmlf/public_html/mommyboss/wp-content/dump.sql.gz"
   remote | gzip -d --force "/home2/devhtmlf/public_html/mommyboss/wp-content/dump.sql.gz"
   remote | mysql --host=localhost --user=devhtmlf_wpadmin --password=******* --database=devhtmlf_mommy_db --execute="SET autocommit=0;SOURCE /home2/devhtmlf/public_html/mommyboss/wp-content/dump.sql;COMMIT"
   remote | delete: /home2/devhtmlf/public_html/mommyboss/wp-content/dump.sql
    local | delete: '/Users/shourav/Documents/2017/5.MAY/MOMMY-BOSS/wp-content/dump.sql.gz'
/Users/shourav/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/wordmove-2.0.2/lib/wordmove/deployer/base.rb:227:in `delete': No such file or directory @ unlink_internal - /Users/shourav/Documents/2017/5.MAY/MOMMY-BOSS/wp-content/dump.sql.gz (Errno::ENOENT)
    from /Users/shourav/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/wordmove-2.0.2/lib/wordmove/deployer/base.rb:227:in `local_delete'
    from /Users/shourav/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/wordmove-2.0.2/lib/wordmove/deployer/ssh.rb:24:in `push_db'
    from /Users/shourav/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/wordmove-2.0.2/lib/wordmove/cli.rb:86:in `block in push'
    from /Users/shourav/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/wordmove-2.0.2/lib/wordmove/cli.rb:37:in `block in handle_options'
    from /Users/shourav/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/wordmove-2.0.2/lib/wordmove/cli.rb:36:in `each'
    from /Users/shourav/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/wordmove-2.0.2/lib/wordmove/cli.rb:36:in `handle_options'
    from /Users/shourav/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/wordmove-2.0.2/lib/wordmove/cli.rb:85:in `push'
    from /Users/shourav/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/thor-0.19.4/lib/thor/command.rb:27:in `run'
    from /Users/shourav/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/thor-0.19.4/lib/thor/invocation.rb:126:in `invoke_command'
    from /Users/shourav/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/thor-0.19.4/lib/thor.rb:369:in `dispatch'
    from /Users/shourav/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/thor-0.19.4/lib/thor/base.rb:444:in `start'
    from /Users/shourav/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/wordmove-2.0.2/exe/wordmove:6:in `'
    from /Users/shourav/.rbenv/versions/2.4.0/bin/wordmove:22:in `load'
    from /Users/shourav/.rbenv/versions/2.4.0/bin/wordmove:22:in `
'

And here is my simple Movefile:

local:
  vhost: "http://imb.local"
  wordpress_path: "/Users/shourav/Documents/2017/5.MAY/MOMMY-BOSS" # use an absolute path here

  database:
    name: "omen_mommy_db"
    user: "root"
    password: "****"
    host: "localhost"

production:
  vhost: "http://mommyboss.devhtmlfive.com"
  wordpress_path: "/home2/devhtmlf/public_html/mommyboss" # use an absolute path here

  database:
    name: "devhtmlf_mommy_db"
    user: "devhtmlf_wpadmin"
    password: "*******"
    host: "localhost"

  exclude:
    - ".git/"
    - ".gitignore"
    - ".sass-cache/"
    - "node_modules/"
    - "bin/"
    - "tmp/*"
    - "Gemfile*"
    - "Movefile"
    - "wp-config.php"
    - "wp-content/*.sql"

  ssh:
      host: "devhtmlfive.com"
      user: "devhtmlf"

I have successfully used this same file from this same dir for another remote target without issue. But no luck this time. I only replaced urls and dbnames and passes. Everything else moves fine but the DB. Please help. Thanx in advance.

alessandro-fazzi commented 7 years ago

Hi there,

sorry for your frustration :(

Does file /Users/shourav/Documents/2017/5.MAY/MOMMY-BOSS/wp-content/dump.sql.gz still exists after the error? If yes what is the output of

ls -l /Users/shourav/Documents/2017/5.MAY/MOMMY-BOSS/wp-content/dump.sql.gz
id

We have recently upgraded a lot of things, so it's possible we're going to meet few bugs.

Aside I'd ask you to update to the latest version released today and give a new try.

imbdev commented 7 years ago

First of all THANKYOU for this AWESOME tool and for your quick response. Unfortunately, I didn't find that sql.gz file. Here is the output anyway:

Ahmeds-Capitan-2:wp-content shourav$ pwd
/Users/shourav/Documents/2017/5.MAY/MOMMY-BOSS/wp-content
Ahmeds-Capitan-2:wp-content shourav$ ls -l
total 8
-rw-r--r--   1 shourav  staff   28 Apr 22 16:24 index.php
drwxr-xr-x  27 shourav  staff  918 May 29 00:20 plugins
drwxr-xr-x   5 shourav  staff  170 May 27 21:44 themes
drwxr-xr-x   2 shourav  staff   68 May 26 13:54 upgrade
drwxr-xr-x   6 shourav  staff  204 May 30 10:51 uploads
Ahmeds-Capitan-2:wp-content shourav$ id
uid=501(shourav) gid=20(staff) groups=20(staff),701(com.apple.sharepoint.group.1),12(everyone),61(localaccounts),79(_appserverusr),80(admin),81(_appserveradm),98(_lpadmin),702(com.apple.sharepoint.group.2),33(_appstore),100(_lpoperator),204(_developer),395(com.apple.access_ftp),398(com.apple.access_screensharing),399(com.apple.access_ssh)

I'm gonna try to upgrade wordmove and try again. I'll drop the results here. Just wondering, is this happening due to something on the local box? Thanx again.

imbdev commented 7 years ago

Ok, I took your advice and updated my 'wordmove' to the latest version. Here is a before and after:

Ahmeds-Capitan-2:~ shourav$ wordmove -v
2.0.2
Ahmeds-Capitan-2:~ shourav$ wordmove -v
2.1.1

Well, with the new version, the old error went away, but I got a new one:

Ahmeds-Capitan-2:MOMMY-BOSS shourav$ wordmove push -s -tpd

▬▬ ✓ Using Movefile: ./Movefile ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
/Users/shourav/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/wordmove-2.1.1/lib/wordmove/deployer/base.rb:24:in `deployer_for': undefined method `[]' for nil:NilClass (NoMethodError)
    from /Users/shourav/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/wordmove-2.1.1/lib/wordmove/cli.rb:80:in `push'
    from /Users/shourav/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/thor-0.19.4/lib/thor/command.rb:27:in `run'
    from /Users/shourav/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/thor-0.19.4/lib/thor/invocation.rb:126:in `invoke_command'
    from /Users/shourav/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/thor-0.19.4/lib/thor.rb:369:in `dispatch'
    from /Users/shourav/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/thor-0.19.4/lib/thor/base.rb:444:in `start'
    from /Users/shourav/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/wordmove-2.1.1/exe/wordmove:6:in `'
    from /Users/shourav/.rbenv/versions/2.4.0/bin/wordmove:22:in `load'
    from /Users/shourav/.rbenv/versions/2.4.0/bin/wordmove:22:in `
'

Before only the DB was failing but everything else was working. But now all's failing ... plz help ... Thanx in advance. NB: The Movefile and all other configs are untouched. Just a 'gem update wordmove' happened.

imbdev commented 7 years ago

Here is some info about my system: screen shot 2017-05-30 at 12 06 58 pm

alessandro-fazzi commented 7 years ago

@imbdev when you installed the latest version, you received this message on screen:

Starting from 2.1.0 you'll need to add the global section in your Movefile:
        global:
            sql_adapter: "default"
    Or you can spawn a new one with `wordmove init` (backup the old one!)

Pls, add that section to your Movefile. All the documentation on the repo should be already updated to reflect the news.

That said - and mandatory - the should be the fix in 2.1.2; the problem was - afaik - only using simulation and we have not test coverage on simulated tasks.

Tell us if it works now.

imbdev commented 7 years ago

Boooyaaa! IT WORKED!! Funny thing is it is still failing in simulation. But when I removed the -s, it was magic. But there is only one issue bothering me with this new build. When it came to db transfer it actually stopped to ask me for the ssh passphrase! The last version didn't do that. Here is how I log on to the remote box:

Ahmeds-Capitan-2:wp-content shourav$ hostname
Ahmeds-Capitan-2.local
Ahmeds-Capitan-2:wp-content shourav$ ssh devhtmlf@devhtmlfive.com
Last login: Tue May 30 02:56:19 2017 from 124.13.223.60
devhtmlf@devhtmlfive.com [~]# echo $HOSTNAME
box1172.bluehost.com
devhtmlf@devhtmlfive.com [~]# 

See there is no hold up for any password or passphrase. Last 'wordmove' version didn't stop me for those at all. But this one just did ... See, this kinda messes up all my automation plans. I'm researching this to make this tool part of our WP workflow company-wide. On that note, do you have any plans to make it PRO version with support?

Here is my ssh config under .ssh folder:

Ahmeds-Capitan-2:.ssh shourav$ cat config
Host *
        ServerAliveInterval 10
        ControlMaster auto
        ControlPersist yes
        UseRoaming no
        UseKeychain yes

Any ideas? I'd really really appreciate it if you steer me to the right direction. Thanx in advance.

alessandro-fazzi commented 7 years ago

@imbdev I've rly just re-tested wordmove push -s -d on SSH connection and, with version 2.1.2 I can't reproduce the bug anymore. Are you really sure about having 2.1.2 installed and used?

That said: wordmove is all about automation, so I'm quite sure it will works in your scenario :) But I'm confused about your actual situation.

What I see:

Since you have a Movefile with

ssh:
  host: "host"
  user: "user"

avoiding to use the old and deprecated "password" key you should obtain the exact behaviour you have on the command line. When you use an rsa key to connect to a host, it could have a passphrase. Managing that passphrase is not a Wordmove task.

We have chenged anything about how wordmove connects to the remote host; we have just upgraded a dependency (the net-ssh gem).

Github has a neat article about passphrases in their docs, if it could help https://help.github.com/articles/working-with-ssh-key-passphrases/ and moreover https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/#adding-your-ssh-key-to-the-ssh-agent.

Close the issue if you think the original problem is solved :)

Cheers!

imbdev commented 7 years ago

Thanx. I'm closing the issue. But since you wanted to be sure about my version, I'm putting the whole thing from the screen once again which will show the version and everything:

Ahmeds-Capitan-2:MOMMY-BOSS shourav$ wordmove -v
2.1.1
Ahmeds-Capitan-2:MOMMY-BOSS shourav$ pwd
/Users/shourav/Documents/2017/5.MAY/MOMMY-BOSS
Ahmeds-Capitan-2:MOMMY-BOSS shourav$ wordmove push -s -d

▬▬ ✓ Using Movefile: ./Movefile ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬

▬▬ ✓ Pushing Database ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
   remote | mysqldump --host=localhost --user=devhtmlf_wpadmin --password=***** --result-file="/home2/devhtmlf/public_html/mommyboss/wp-content/dump.sql" devhtmlf_mommy_db
gzip --best --force "/home2/devhtmlf/public_html/mommyboss/wp-content/dump.sql"
   remote | gzip --best --force "/home2/devhtmlf/public_html/mommyboss/wp-content/dump.sql"
   remote | get: /home2/devhtmlf/public_html/mommyboss/wp-content/dump.sql.gz /Users/shourav/Documents/2017/5.MAY/MOMMY-BOSS/wp-content/production-backup-1496146803.sql.gz
   remote | delete: /home2/devhtmlf/public_html/mommyboss/wp-content/dump.sql.gz
    local | mysqldump --host=localhost --user=root --password=root --result-file="/Users/shourav/Documents/2017/5.MAY/MOMMY-BOSS/wp-content/dump.sql" omen_mommy_db
    local | Adapt dump
gzip --best --force "/Users/shourav/Documents/2017/5.MAY/MOMMY-BOSS/wp-content/dump.sql"
    local | gzip --best --force "/Users/shourav/Documents/2017/5.MAY/MOMMY-BOSS/wp-content/dump.sql"
   remote | put: /Users/shourav/Documents/2017/5.MAY/MOMMY-BOSS/wp-content/dump.sql.gz /home2/devhtmlf/public_html/mommyboss/wp-content/dump.sql.gz
gzip -d --force "/home2/devhtmlf/public_html/mommyboss/wp-content/dump.sql.gz"
   remote | gzip -d --force "/home2/devhtmlf/public_html/mommyboss/wp-content/dump.sql.gz"
   remote | mysql --host=localhost --user=devhtmlf_wpadmin --password=****** --database=devhtmlf_mommy_db --execute="SET autocommit=0;SOURCE /home2/devhtmlf/public_html/mommyboss/wp-content/dump.sql;COMMIT"
   remote | delete: /home2/devhtmlf/public_html/mommyboss/wp-content/dump.sql
    local | delete: '/Users/shourav/Documents/2017/5.MAY/MOMMY-BOSS/wp-content/dump.sql.gz'
/Users/shourav/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/wordmove-2.1.1/lib/wordmove/deployer/base.rb:229:in `delete': No such file or directory @ unlink_internal - /Users/shourav/Documents/2017/5.MAY/MOMMY-BOSS/wp-content/dump.sql.gz (Errno::ENOENT)
    from /Users/shourav/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/wordmove-2.1.1/lib/wordmove/deployer/base.rb:229:in `local_delete'
    from /Users/shourav/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/wordmove-2.1.1/lib/wordmove/deployer/ssh/default_sql_adapter.rb:19:in `after_push_cleanup!'
    from /Users/shourav/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/wordmove-2.1.1/lib/wordmove/deployer/ssh.rb:28:in `push_db'
    from /Users/shourav/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/wordmove-2.1.1/lib/wordmove/cli.rb:86:in `block in push'
    from /Users/shourav/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/wordmove-2.1.1/lib/wordmove/cli.rb:37:in `block in handle_options'
    from /Users/shourav/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/wordmove-2.1.1/lib/wordmove/cli.rb:36:in `each'
    from /Users/shourav/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/wordmove-2.1.1/lib/wordmove/cli.rb:36:in `handle_options'
    from /Users/shourav/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/wordmove-2.1.1/lib/wordmove/cli.rb:85:in `push'
    from /Users/shourav/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/thor-0.19.4/lib/thor/command.rb:27:in `run'
    from /Users/shourav/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/thor-0.19.4/lib/thor/invocation.rb:126:in `invoke_command'
    from /Users/shourav/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/thor-0.19.4/lib/thor.rb:369:in `dispatch'
    from /Users/shourav/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/thor-0.19.4/lib/thor/base.rb:444:in `start'
    from /Users/shourav/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/wordmove-2.1.1/exe/wordmove:6:in `'
    from /Users/shourav/.rbenv/versions/2.4.0/bin/wordmove:22:in `load'
    from /Users/shourav/.rbenv/versions/2.4.0/bin/wordmove:22:in `
'

And here is the new Movefile:

global:
  sql_adapter: "default"

local:
  vhost: "http://imb.local"
  wordpress_path: "/Users/shourav/Documents/2017/5.MAY/MOMMY-BOSS" # use an absolute path here

  database:
    name: "omen_mommy_db"
    user: "root"
    password: "root"
    host: "localhost"

production:
  vhost: "http://mommyboss.devhtmlfive.com"
  wordpress_path: "/home2/devhtmlf/public_html/mommyboss" # use an absolute path here

  database:
    name: "devhtmlf_mommy_db"
    user: "devhtmlf_wpadmin"
    password: "*****"
    host: "localhost"

  exclude:
    - ".git/"
    - ".gitignore"
    - ".sass-cache/"
    - "node_modules/"
    - "bin/"
    - "tmp/*"
    - "Gemfile*"
    - "Movefile"
    - "wp-config.php"
    - "wp-content/*.sql.gz"

  ssh:
    host: "devhtmlfive.com"
    user: "devhtmlf"

alessandro-fazzi commented 7 years ago

Thank you @imbdev .

Saw this

Ahmeds-Capitan-2:MOMMY-BOSS shourav$ wordmove -v
2.1.1

I suggest to update the gem: latest version in 2.1.2 :) You should see -s flag working again.

I forgot to reply to one of your question: the plan, atm, is to keep Wordmove completely and only open source: no pro assistance at the horizon.

Cheers