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 pull -d error #611

Closed tommyyama2020 closed 2 years ago

tommyyama2020 commented 3 years ago

Hi,

Got error below with wordmove pull -d. OS is mac. wordmove, ruby are latest. localbyflywheel is used to set up wordpress. wp command is working fine. yml's setting is ok.

"this does not seem to be a wordpress installation wordmove"

IsseinoiMac:public isseifukata$ wordmove pull -d

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

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

    local | mysqldump --host=[secret] --port=4022 --user=[secret] --password=[secret] --result-file="[secret]wp-content/local-backup-1607750327.sql" --skip-column-statistics local
mysqldump: [Warning] Using a password on the command line interface can be insecure.

    local | gzip -9 -f "[secret]wp-content/local-backup-1607750327.sql"

   remote | mysqldump --host=[secret] --user=ktmedassoc --password=[secret] --result-file="[secret]wp-content/dump.sql" ktmedassoc_wp2
ktmedassoc@ktmedassoc.sakura.ne.jp's password:

   remote | gzip -9 -f "[secret]wp-content/dump.sql"

   remote | get: [secret]wp-content/dump.sql.gz [secret]wp-content/dump.sql.gz

   remote | delete: [secret]wp-content/dump.sql.gz

    local | gzip -d -f "[secret]wp-content/dump.sql.gz"

    local | mysql --host=[secret] --port=4022 --user=[secret] --password=[secret] --database=local --execute="SET autocommit=0;SOURCE [secret]wp-content/dump.sql;COMMIT"
mysql: [Warning] Using a password on the command line interface can be insecure.

    local | adapt dump for vhost

    local | wp search-replace --path=[secret] [secret] [secret] --quiet --skip-columns=guid --all-tables --allow-[secret]
Error: This does not seem to be a WordPress installation.
Pass --path=`path/to/wordpress` or run `wp core download`.
Traceback (most recent call last):
        14: from /usr/local/bin/wordmove:23:in `<main>'
        13: from /usr/local/bin/wordmove:23:in `load'
        12: from /Library/Ruby/Gems/2.6.0/gems/wordmove-5.1.0/exe/wordmove:6:in `<top (required)>'
        11: from /Library/Ruby/Gems/2.6.0/gems/thor-0.20.3/lib/thor/base.rb:466:in `start'
        10: from /Library/Ruby/Gems/2.6.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
         9: from /Library/Ruby/Gems/2.6.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
         8: from /Library/Ruby/Gems/2.6.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
         7: from /Library/Ruby/Gems/2.6.0/gems/wordmove-5.1.0/lib/wordmove/cli.rb:91:in `pull'
         6: from /Library/Ruby/Gems/2.6.0/gems/wordmove-5.1.0/lib/wordmove/cli.rb:39:in `handle_options'
         5: from /Library/Ruby/Gems/2.6.0/gems/wordmove-5.1.0/lib/wordmove/cli.rb:39:in `each'
         4: from /Library/Ruby/Gems/2.6.0/gems/wordmove-5.1.0/lib/wordmove/cli.rb:40:in `block in handle_options'
         3: from /Library/Ruby/Gems/2.6.0/gems/wordmove-5.1.0/lib/wordmove/cli.rb:92:in `block in pull'
         2: from /Library/Ruby/Gems/2.6.0/gems/wordmove-5.1.0/lib/wordmove/deployer/ssh.rb:48:in `pull_db'
         1: from /Library/Ruby/Gems/2.6.0/gems/wordmove-5.1.0/lib/wordmove/deployer/ssh/wpcli_sql_adapter.rb:37:in `adapt_remote_db!'
/Library/Ruby/Gems/2.6.0/gems/wordmove-5.1.0/lib/wordmove/deployer/base.rb:95:in `run': Return code reports an error (Wordmove::ShellCommandError)
alessandro-fazzi commented 3 years ago

Hi,

I "simply" think that your wordpress_path is not where your wordpress installation actually is. Thus this wp command

wp search-replace --path=[secret]

is complaining about it's not finding a proper WP there

tommyyama2020 commented 3 years ago

Hi thanks. i thought same exactly like you and tried with --path="path/to/wordpress" . wp config and wordmove yml files are in there it is still same error ..

is there any way to see this [secret] part ? i could not find where this --path=[secret][secret] part was set. Plus, wp command could not work if i tried a command in different folder.

alessandro-fazzi commented 3 years ago

For sure: given a movefile.yml

# [...]
local:
  vhost: http://127.0.0.1:8080
  wordpress_path: /home/john/sites/your_site # use an absolute path here
# [...]

the wordpress_path is passed as an argument to wp-cli's --path flag. So, following the example, you'll have

wp search-replace --path=/home/john/sites/your_site [...]

WP-CLI works by inovking wp command inside a wordpress installation (root or deeper level). When wordmove wraps WP-CLI's command, it uses the --path (ref: https://make.wordpress.org/cli/handbook/references/config/#global-parameters) flag in order to be sure to force the right execution location, even if your flow requires to work outside of the wordpress installation (docker? bedrock? maybe Local too?)

A complete search-replace command produced by wordmove will looks like, e.g.:

wp search-replace --path=/home/john/sites/your_site http://127.0.0.1 https://example.com --quiet --skip-columns=guid --all-tables --allow-root

But in order to test WP-CLI execution you don't need to manually run such command (it will modify you database, so I do not recommend to do so if you're not aware of it), but you could use an unobstrusive command such as wp core version.

The error you're getting is thrown by WP-CLI whichever the command you'll invoke.

Moreover, and concluding, it seems that Local has some specific implication about WP-CLI's configuration: https://localwp.com/community/t/wp-cli-error-pass-path-path-to-wordpress/2333/3 (but the post is a bit old, so please double check it yourself).

alessandro-fazzi commented 3 years ago

@tommyyama2020 this is a more complete and thus correct explanation about how --path is populated: https://github.com/welaika/wordmove/wiki/movefile.yml-configurations-explained#note-about-the---path-flag

Please be sure to understand this if Local is actually internally using a wp-cli.yml file.

tommyyama2020 commented 3 years ago

thanks. The same came up.i am asking for double-checking it.

xuanchinh1994 commented 3 years ago

Hi @pioneerskies I have an error can't pull the database on Linux and subsystem for Linux

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)

and movefile config is:

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

can you help me resolve it ? Thanks ..

alessandro-fazzi commented 3 years ago

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.

xuanchinh1994 commented 3 years ago

Thanks @pioneerskies

I'll open new ticket. https://github.com/welaika/wordmove/issues/613

And I tried to check it but couldn't find the cause