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 pull database #613

Closed xuanchinh1994 closed 3 years ago

xuanchinh1994 commented 3 years ago

Describe the bug I can pull content but can't pull database. I used 2 env Linux Debian and Window subsystem for Linux, Wordmove and ruby are latest version.

Wordmove command Command used: ( wordmove pull -e production --all & wordmove pull -e production --db )

movefile.yml

global:
  sql_adapter: wpcli

local:
  vhost: "http://127.0.0.1/local_sapot/"
  wordpress_path: "/home/chinhbui/work/web/local_sapot" # use an absolute path here

  database:
    name: "local_sapot"
    user: "chinh"
    password: "admin" # could be blank, so always use quotes around
    host: "127.0.0.1"

production:
  vhost: "https://sapot11.vn/"
  wordpress_path: "/httpdocs" # use an absolute path here

  database:
    name: "sapot"
    user: "admin"
    password: "xxxxxx@_"
    host: "xxxxxx.xxxx.vn"

  exclude:
    - '.git/'
    - '.gitignore'
    - '.gitmodules'
    - '.env'
    - 'node_modules/'
    - 'bin/'
    - 'tmp/*'
    - 'Gemfile*'
    - 'Movefile'
    - 'movefile'
    - 'movefile.yml'
    - 'movefile.yaml'
    - 'wp-config.php'
    - 'wp-content/*.sql.gz'
    - '*.orig'

  ftp:
    user: "xxxxxx"
    password: "xxxxxx@_"
    host: "xxxxxx.xxxxx.vn"
    passive: true

Exception/trace

wordmove pull -e production -d

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

▬▬ Pulling Database ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬

    local | mysqldump --host=[secret] --user=chinh --password=[secret] --result-file="[secret]/wp-content/local-backup-1608624958.sql" local_spot

   remote | write [secret]/wp-content/dump.php

    local | download [secret]wp-content/dump.php?shared_key=217fb2b80a9d630f1aaf9f42f2719c4d73xxxxxxxxxxxxxxxxxxxxxxe186ea44ab29bf8fa > [secret]/wp-content/dump.sql
Traceback (most recent call last):
    26: from /home/chinhbui/.rvm/gems/ruby-2.7.0/bin/ruby_executable_hooks:24:in `<main>'
    25: from /home/chinhbui/.rvm/gems/ruby-2.7.0/bin/ruby_executable_hooks:24:in `eval'
    24: from /home/chinhbui/.rvm/gems/ruby-2.7.0/bin/wordmove:23:in `<main>'
    23: from /home/chinhbui/.rvm/gems/ruby-2.7.0/bin/wordmove:23:in `load'
    22: from /home/chinhbui/.rvm/gems/ruby-2.7.0/gems/wordmove-5.2.1/exe/wordmove:6:in `<top (required)>'
    21: from /home/chinhbui/.rvm/gems/ruby-2.7.0/gems/thor-0.20.3/lib/thor/base.rb:466:in `start'
    20: from /home/chinhbui/.rvm/gems/ruby-2.7.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
    19: from /home/chinhbui/.rvm/gems/ruby-2.7.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
    18: from /home/chinhbui/.rvm/gems/ruby-2.7.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
    17: from /home/chinhbui/.rvm/gems/ruby-2.7.0/gems/wordmove-5.2.1/lib/wordmove/cli.rb:91:in `pull'
    16: from /home/chinhbui/.rvm/gems/ruby-2.7.0/gems/wordmove-5.2.1/lib/wordmove/cli.rb:39:in `handle_options'
    15: from /home/chinhbui/.rvm/gems/ruby-2.7.0/gems/wordmove-5.2.1/lib/wordmove/cli.rb:39:in `each'
    14: from /home/chinhbui/.rvm/gems/ruby-2.7.0/gems/wordmove-5.2.1/lib/wordmove/cli.rb:40:in `block in handle_options'
    13: from /home/chinhbui/.rvm/gems/ruby-2.7.0/gems/wordmove-5.2.1/lib/wordmove/cli.rb:92:in `block in pull'
    12: from /home/chinhbui/.rvm/gems/ruby-2.7.0/gems/wordmove-5.2.1/lib/wordmove/deployer/ftp.rb:44:in `pull_db'
    11: from /home/chinhbui/.rvm/gems/ruby-2.7.0/gems/wordmove-5.2.1/lib/wordmove/deployer/ftp.rb:121:in `download_remote_db'
    10: from /home/chinhbui/.rvm/gems/ruby-2.7.0/gems/wordmove-5.2.1/lib/wordmove/deployer/base.rb:103:in `download'
     9: from /home/chinhbui/.rvm/gems/ruby-2.7.0/gems/wordmove-5.2.1/lib/wordmove/deployer/base.rb:103:in `open'
     8: from /home/chinhbui/.rvm/gems/ruby-2.7.0/gems/wordmove-5.2.1/lib/wordmove/deployer/base.rb:104:in `block in download'
     7: from /home/chinhbui/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/open-uri.rb:50:in `open'
     6: from /home/chinhbui/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/open-uri.rb:744:in `open'
     5: from /home/chinhbui/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/open-uri.rb:174:in `open_uri'
     4: from /home/chinhbui/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/open-uri.rb:233:in `open_loop'
     3: from /home/chinhbui/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/open-uri.rb:233:in `catch'
     2: from /home/chinhbui/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/open-uri.rb:235:in `block in open_loop'
     1: from /home/chinhbui/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/open-uri.rb:764:in `buffer_open'
/home/chinhbui/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/open-uri.rb:387:in `open_http': 403 Forbidden (OpenURI::HTTPError)

Environment (please complete the following information):

Doctor

(If it is not, report the error you got.)

alessandro-fazzi commented 3 years ago

Hello! Thanks for the effort to report your plroblem in a new issue 🙇

First of all I'll report my answer given where you originally posted:

Hey @xuanchinh1994 ,

it would be better to open a fresh new help ticket; moreover because your problem in not releted with the one presented by @tommyyama2020 .

Just to give you a clue:

`open_http': 403 Forbidden (OpenURI::HTTPError)

means that your server is negating an HTTP connection from your local machine. Do you have HTTP basic auth or something similar blocking the site from public visits? FTP adapter needs to connect to the site through HTTP in order to get your database...if it can't connect there is not an effective workaround.

That said: don't know if you are used to HTTP errors, by the way when you receive a 403 it does mean that you've done a request to a remote server, you correctly hit it but it answers that you are trying to require a resource which is not permitted to be served. Obviously in your scenario this is a generalist motivation :)

Given your movefile.yml the request reported in the log as

[secret]wp-content/dump.php?shared_key=217fb2b80a9d630f1aaf9f42f2719c4d73xxxxxxxxxxxxxxxxxxxxxxe186ea44ab29bf8fa

should be considered

https://sapot11.vn/wp-content/dump.php?shared_key=217fb2b80a9d630f1aaf9f42f2719c4d73xxxxxxxxxxxxxxxxxxxxxxe186ea44ab29bf8fa

I've tried to reach https://sapot11.vn/ address from my browser, but it does not reply, so I suppose this is not a public URL, thus it's impossible for me to analyze this aspect.

I'd ask: if you, from within your WSL, invoke the command

wget https://sapot11.vn/

what do you get in response? I indeed got

> wget https://sapot11.vn/                                                                                                                               482ms
--2020-12-22 22:32:16--  https://sapot11.vn/
Resolving sapot11.vn (sapot11.vn)... failed: nodename nor servname provided, or not known.
wget: unable to resolve host address ‘sapot11.vn’

Could my question seems weird: that's a command similar to what Wordmove is trying to act, the only difference is that it is trying to get a specific file from your server.

That file is written through FTP

remote | write [secret]/wp-content/dump.php

and is later requested by HTTP (with a one time token in query string for security purposes). Well the HTTP request is where it is failing.

A possible cause could be that when Wordmove write the dump.php file through FTP connection, it is written on disk with insufficient permission to be later read from the "outside" with an HTTP request. Obviously Wordmove is programmed in order to write a readable file 😅 but

Honestly I can't say... I could say that a bug on such a functionality should have been discovered earlier and it sounds strange to me.

After the error appears, you should be able to manually connect to your host's FTP, check if you'll find /wp-content/dump.php file and check its permissions and report back them here. We'll see if they are somewhat significant.

I warmly hope to have thrown out some clues there :)

Looking forward to hear back from you. And good luck anyway!

xuanchinh1994 commented 3 years ago

Thanks, @pioneerskies for supporting. I found the cause of my hosting.

When I try to access on browser https://xegiangchau.com/wp-content/dump.php?shared_key=217fb2b80a9d630f1aaf9f42f2719c4d73xxxxxxxxxxxxxxxxxxxxxxe186ea44ab29bf8fa it show error : file-1569216193620_403-forbidden-error-example

After I access to hosting and turn off nginx on my hosting: image

It's work well. Thanks you and have a nice day :)

alessandro-fazzi commented 3 years ago

Unfortunately I'm not able to 100% interpret that option. But you hosting company will for sure.

I'm glad that the discussion turned useful for you :)

I'm going to close the issue and going to remove the bug label since this was an external/environmental problem.

Thanks for your contribute.

Best.