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

Wordmove push/pull -p -d -u result in no changes - no errors either. #473

Closed velograph closed 6 years ago

velograph commented 6 years ago

I am having trouble connecting my Dreamhost production environment with my Vagrant WP installation. I believe my yaml file is in good shape, but my database isn't being overwritten when I pull. When I push the remote database isn't overwritten either. I have stopped the pull after the dump file is created and it's not empty, so at this point I'm a little lost. Any help would be greatly appreciated!

Here's my movefile:

global:
  sql_adapter: wpcli

local:
  vhost: http://sonofthumper.local
  wordpress_path: /srv/www/sonofthumper/htdocs # use an absolute path here

  database:
    name: sonofthumper
    user: wp
    password: ****** # could be blank, so always use quotes around
    host: localhost

production:
  vhost: http://sonofthumper.com
  wordpress_path: /home/dh_s6xuyx/sonofthumper.com # use an absolute path here

  database:
    name: sonofthumper_com
    user: sonofthumpercom
    password: **********
    host: mysql.sonofthumper.com
    # port: 3308 # Use just in case you have exotic server config
    # mysqldump_options: --max_allowed_packet=1G # Only available if using SSH
    # mysql_options: --protocol=TCP # mysql command is used to import db

  exclude:
    - '.git/'
    - '.gitignore'
    - 'node_modules/'
    - 'bin/'
    - 'tmp/*'
    - 'Gemfile*'
    - 'Movefile'
    - 'movefile'
    - 'movefile.yml'
    - 'movefile.yaml'
    - 'wp-config.php'
    - 'wp-content/*.sql.gz'
    - '*.orig'
  ssh:
    host: sonofthumper.com
    user: dh_s6xuyx
    password: ******** # password is optional, will use public keys if available.
   #   port: 22 # Port is optional
    rsync_options: --verbose --itemize-changes # Additional rsync options, optional
   #   gateway: # Gateway is optional
   #     host: host
   #     user: user
   #     password: password # password is optional, will use public keys if available.

  # ftp:
  #   user: user
  #   password: password
  #   host: host
  #   passive: true
  #   scheme: ftps # default ftp

  # hooks: # Remote hooks won't work with FTP
  #   push:
  #     before:
  #       local:
  #         - 'echo "Do something locally before push"'
  #       remote:
  #         - 'echo "Do something remotely before push"'
  #     after:
  #       local:
  #         - 'echo "Do something locally after push"'
  #       remote:
  #         - 'echo "Do something remotely after push"'
  #   pull:
  #     before:
  #       local:
  #         - 'echo "Do something locally before pull"'
  #       remote:
  #         - 'echo "Do something remotely before pull"'
  #     after:
  #       local:
  #         - 'echo "Do something locally after pull"'
  #       remote:
  #         - 'echo "Do something remotely after pull"'
  # forbid:
  #   push:
  #     db: false
  #     plugins: false
  #     themes: false
  #     languages: false
  #     uploads: false
  #     mu-plugins: false
  #   pull:
  #     db: false
  #     plugins: false
  #     themes: false
  #     languages: false
  #     uploads: false
  #     mu-plugins: false

# staging: # multiple environments can be specified
#   [...]

When I run 'wordmove pull -d' – I've been searching the issues and google, but haven't seen anything quite like this:

local | mysqldump --host=localhost --user=wp --password=****** --result-file="/srv/www/sonofthumper/htdocs/wp-content/local-backup-1525145053.sql" sonofthumper
gzip --best --force "/srv/www/sonofthumper/htdocs/wp-content/local-backup-1525145053.sql"
    local | gzip --best --force "/srv/www/sonofthumper/htdocs/wp-content/local-backup-1525145053.sql"
   remote | mysqldump --host=mysql.sonofthumper.com --user=sonofthumpercom --password=****** --result-file="/home/dh_s6xuyx/sonofthumper.com/wp-content/dump.sql" sonofthumper_com
gzip --best --force "/home/dh_s6xuyx/sonofthumper.com/wp-content/dump.sql"
   remote | gzip --best --force "/home/dh_s6xuyx/sonofthumper.com/wp-content/dump.sql"
   remote | get: /home/dh_s6xuyx/sonofthumper.com/wp-content/dump.sql.gz /srv/www/sonofthumper/htdocs/wp-content/dump.sql.gz
   remote | delete: /home/dh_s6xuyx/sonofthumper.com/wp-content/dump.sql.gz
gzip -d --force "/srv/www/sonofthumper/htdocs/wp-content/dump.sql.gz"
    local | gzip -d --force "/srv/www/sonofthumper/htdocs/wp-content/dump.sql.gz"
    local | mysql --host=localhost --user=wp --password=wp --database=sonofthumper --execute="SET autocommit=0;SOURCE /srv/www/sonofthumper/htdocs/wp-content/dump.sql;COMMIT"
    local | adapt dump for vhost
    local | wp search-replace http://sonofthumper.com http://sonofthumper.local --quiet --skip-columns=guid --all-tables --allow-root
    local | adapt dump for wordpress_path
    local | wp search-replace /home/dh_s6xuyx/sonofthumper.com /srv/www/sonofthumper/htdocs --quiet --skip-columns=guid --all-tables --allow-root
    local | delete: '/srv/www/sonofthumper/htdocs/wp-content/dump.sql'

Strangely I can run wordmove pull -t and that syncs my themes. If I run wordmove pull -u I receive a long list of the correct files (on remote) but they're not showing in my WP Media library. I see them in the directory though...

Current Dependency versions: mysql mysql Ver 15.1 Distrib 10.1.32-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2

mysqldump mysqldump Ver 10.16 Distrib 10.1.32-MariaDB, for debian-linux-gnu (x86_64)

wordmove 3.0.2

rsync rsync version 3.1.0 protocol version 31

WP CLI WP-CLI 1.5.1

Wordmove Doctor

▬▬ Using Movefile: /srv/www/sonofthumper/htdocs/Movefile.yml ▬▬▬▬▬▬▬▬▬▬▬

▬▬ Validating movefile section: global ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
    ✓ success | Formal validation passed

▬▬ Validating movefile section: local ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
    ✓ success | Formal validation passed

▬▬ Validating movefile section: production ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
    ✓ success | Formal validation passed

▬▬ Using Movefile: /srv/www/sonofthumper/htdocs/Movefile.yml ▬▬▬▬▬▬▬▬▬▬▬

▬▬ Checking local database commands and connection ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
    ✓ success | `mysql` command is in $PATH
    ✓ success | `mysqldump` command is in $PATH
    ✓ success | Successfully connected to the MySQL server
    ✓ success | Successfully connected to the database

▬▬ Checking local wp-cli installation ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
    ✓ success | wp-cli is correctly installed
    ✓ success | wp-cli is up to date

▬▬ Checking rsync ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
    ✓ success | rsync is installed at version 3.1.0

▬▬ Checking SSH client ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
    ✓ success | SSH command found

Any ideas or thoughts on how to adjust my movefile to fix this? Could this be a permissions issue in my setup?

alessandro-fazzi commented 6 years ago

Hello,

and sorry for the late reply.

Are your config in local

database:
    name: sonofthumper
    user: wp
    password: ****** # could be blank, so always use quotes around
    host: localhost

tha same config you have in wp-config.php?

Do you have multiple MySQL instances? I think not because I understand you are in an ad hoc Vagrant machine... Locally you are working from inside the Vagrant machine, correct?

velograph commented 6 years ago

@pioneerskies This is what I have in my wp-config.php file:

define( 'DB_NAME', 'sonofthumper' );                                                                  |    # port: 3308 # Use just in case you have exotic server config
                                                                                                      |    # mysqldump_options: --max_allowed_packet=1G # Only available if using SSH
/** MySQL database username */                                                                        |    # mysql_options: --protocol=TCP # mysql command is used to import db
define( 'DB_USER', 'wp' );                                                                            |
                                                                                                      |  exclude:
/** MySQL database password */                                                                        |    - '.git/'
define( 'DB_PASSWORD', 'wp' );                                                                        |    - '.gitignore'
                                                                                                      |    - 'node_modules/'
/** MySQL hostname */                                                                                 |    - 'bin/'
define( 'DB_HOST', 'localhost' );  

I should only have the single mysql instance, but perhaps that's it? I am working from my vagrant machine – ssh'd in.

alessandro-fazzi commented 6 years ago

Hmmm...took like this it makes no sense. Let's explode some questions and problems:

In my poor support experience, most of similar cases, were caused by having unexpectedly different table prefixes locally and remotely. Would you compare the two prefixes?

velograph commented 6 years ago

@pioneerskies

It looks like the issue was related to my table prefixes being different. I updated my prefixes in the local Vagrant DB to match what's on my remote.

I can now push and pull correctly. My media page is also showing all uploads.

Thanks for the tip!