welaika / wordmove

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

Can't push/pull DB, when wp-content has been moved #514

Closed alexanderkladov closed 5 years ago

alexanderkladov commented 5 years ago

Hi,

I am having issues pushing/pulling DBs. My site is using custom directory structure like this:

-wp
-content
--themes
--uploads
--etc

I've configured movefile paths using these variables :

# Paths
<% wp_content = "content" %>
<% wp_config  = "wp-config.php" %>
<% uploads    = wp_content + "/uploads" %>
<% plugins    = wp_content + "/plugins" %>
<% mu_plugins = wp_content + "/mu-plugins" %>
<% themes     = wp_content + "/themes" %>
<% languages  = wp_content + "/languages" %>

And then I insert them later like this:

####################
# Repeatable anchors
####################
default: &defaults
  paths: &paths
    wp_content: <%= wp_content %>
    wp_config: <%= wp_config %>
    uploads: <%= uploads %>
    plugins: <%= plugins %>
    mu_plugins: <%= mu_plugins %>
    themes: <%= themes %>
    languages: <%= languages %>
  ...

Uploading files over SSH works just fine. But when it comes to DB, I get the following error:

temp$ wordmove push -e live -d

▬▬ Using Movefile: ./movefile.yml ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬

▬▬ Pushing Database ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
   remote | mysqldump --host=localhost --user=****** --password=\******\+ --result-file="public_html/content/dump.sql" ******
   remote | gzip --best --force "public_html/content/dump.sql"
   remote | get: public_html/content/dump.sql.gz /Applications/MAMP/htdocs/dev/******/wp-content/live-backup-1549652516.sql.gz
Traceback (most recent call last):
    37: from /Users/temp/.rvm/gems/ruby-head/bin/ruby_executable_hooks:15:in `<main>'
    36: from /Users/temp/.rvm/gems/ruby-head/bin/ruby_executable_hooks:15:in `eval'
    35: from /Users/temp/.rvm/gems/ruby-head/bin/wordmove:23:in `<main>'
    34: from /Users/temp/.rvm/gems/ruby-head/bin/wordmove:23:in `load'
    33: from /Users/temp/.rvm/gems/ruby-head/gems/wordmove-3.2.2/exe/wordmove:6:in `<top (required)>'
    32: from /Users/temp/.rvm/gems/ruby-head/gems/thor-0.19.4/lib/thor/base.rb:444:in `start'
    31: from /Users/temp/.rvm/gems/ruby-head/gems/thor-0.19.4/lib/thor.rb:369:in `dispatch'
    30: from /Users/temp/.rvm/gems/ruby-head/gems/thor-0.19.4/lib/thor/invocation.rb:126:in `invoke_command'
    29: from /Users/temp/.rvm/gems/ruby-head/gems/thor-0.19.4/lib/thor/command.rb:27:in `run'
    28: from /Users/temp/.rvm/gems/ruby-head/gems/wordmove-3.2.2/lib/wordmove/cli.rb:102:in `push'
    27: from /Users/temp/.rvm/gems/ruby-head/gems/wordmove-3.2.2/lib/wordmove/cli.rb:41:in `handle_options'
    26: from /Users/temp/.rvm/gems/ruby-head/gems/wordmove-3.2.2/lib/wordmove/cli.rb:41:in `each'
    25: from /Users/temp/.rvm/gems/ruby-head/gems/wordmove-3.2.2/lib/wordmove/cli.rb:42:in `block in handle_options'
    24: from /Users/temp/.rvm/gems/ruby-head/gems/wordmove-3.2.2/lib/wordmove/cli.rb:103:in `block in push'
    23: from /Users/temp/.rvm/gems/ruby-head/gems/wordmove-3.2.2/lib/wordmove/deployer/ssh.rb:37:in `push_db'
    22: from /Users/temp/.rvm/gems/ruby-head/gems/wordmove-3.2.2/lib/wordmove/deployer/ssh/default_sql_adapter.rb:8:in `backup_remote_db!'
    21: from /Users/temp/.rvm/gems/ruby-head/gems/wordmove-3.2.2/lib/wordmove/deployer/ssh.rb:83:in `download_remote_db'
    20: from /Users/temp/.rvm/gems/ruby-head/gems/wordmove-3.2.2/lib/wordmove/deployer/ssh.rb:58:in `block (2 levels) in <class:SSH>'
    19: from /Users/temp/.rvm/gems/ruby-head/gems/photocopier-1.3.2/lib/photocopier/ssh.rb:16:in `get'
    18: from /Users/temp/.rvm/gems/ruby-head/gems/net-scp-1.2.1/lib/net/scp.rb:321:in `download!'
    17: from /Users/temp/.rvm/gems/ruby-head/gems/net-ssh-4.2.0/lib/net/ssh/connection/channel.rb:269:in `wait'
    16: from /Users/temp/.rvm/gems/ruby-head/gems/net-ssh-4.2.0/lib/net/ssh/connection/session.rb:178:in `loop'
    15: from /Users/temp/.rvm/gems/ruby-head/gems/net-ssh-4.2.0/lib/net/ssh/connection/session.rb:178:in `loop'
    14: from /Users/temp/.rvm/gems/ruby-head/gems/net-ssh-4.2.0/lib/net/ssh/connection/session.rb:178:in `block in loop'
    13: from /Users/temp/.rvm/gems/ruby-head/gems/net-ssh-4.2.0/lib/net/ssh/connection/session.rb:225:in `process'
    12: from /Users/temp/.rvm/gems/ruby-head/gems/net-ssh-4.2.0/lib/net/ssh/connection/event_loop.rb:27:in `process'
    11: from /Users/temp/.rvm/gems/ruby-head/gems/net-ssh-4.2.0/lib/net/ssh/connection/event_loop.rb:99:in `ev_preprocess'
    10: from /Users/temp/.rvm/gems/ruby-head/gems/net-ssh-4.2.0/lib/net/ssh/connection/event_loop.rb:99:in `each'
     9: from /Users/temp/.rvm/gems/ruby-head/gems/net-ssh-4.2.0/lib/net/ssh/connection/session.rb:247:in `ev_preprocess'
     8: from /Users/temp/.rvm/gems/ruby-head/gems/net-ssh-4.2.0/lib/net/ssh/connection/session.rb:538:in `each_channel'
     7: from /Users/temp/.rvm/gems/ruby-head/gems/net-ssh-4.2.0/lib/net/ssh/connection/session.rb:538:in `each'
     6: from /Users/temp/.rvm/gems/ruby-head/gems/net-ssh-4.2.0/lib/net/ssh/connection/session.rb:247:in `block in ev_preprocess'
     5: from /Users/temp/.rvm/gems/ruby-head/gems/net-ssh-4.2.0/lib/net/ssh/connection/channel.rb:320:in `process'
     4: from /Users/temp/.rvm/gems/ruby-head/gems/net-scp-1.2.1/lib/net/scp.rb:369:in `block (3 levels) in start_command'
     3: from /Users/temp/.rvm/gems/ruby-head/gems/net-scp-1.2.1/lib/net/scp/download.rb:51:in `read_directive_state'
     2: from /Users/temp/.rvm/gems/ruby-head/gems/net-scp-1.2.1/lib/net/scp/download.rb:156:in `read_file'
     1: from /Users/temp/.rvm/gems/ruby-head/gems/net-scp-1.2.1/lib/net/scp/download.rb:156:in `new'
/Users/temp/.rvm/gems/ruby-head/gems/net-scp-1.2.1/lib/net/scp/download.rb:156:in `initialize': No such file or directory @ rb_sysopen - /Applications/MAMP/htdocs/dev/******/wp-content/live-backup-1549652516.sql.gz (Errno::ENOENT)

Any idea why it's doing that? The problem is clearly in this line:

   remote | get: public_html/content/dump.sql.gz /Applications/MAMP/htdocs/dev/******/wp-content/live-backup-1549652516.sql.gz

For some reason it uses the correct custom folder for dumping the database, but then tries to pull it into a default wp-content, which obviously doesn't exist.

So far as a workaround, I create temporary local wp-content folder, which helps bypass this error..

Regards, Alex

alessandro-fazzi commented 5 years ago

I am a bit embarassed replying to you just today; but...please, accept a simple "sorry".

I've read a couple of time the logic behind the paths configuration and I cannot get a clue. Before I'll try to setup an environment with custom paths trying to reproduce, I'd like to ask you a question: are you 100% sure that you had something like

local:
  <<: *defaults

or

local:
  paths:
    <<: *paths

in your movefile.yml?

alexanderkladov commented 5 years ago

Hi @pioneerskies,

Thank you for getting back to me! I just checked and no, I didn't have that for "local" environment. I added it's all working now! Thanks!

alessandro-fazzi commented 5 years ago