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

Database push failing #110

Closed CraftyDevon closed 9 years ago

CraftyDevon commented 10 years ago

Hey there, I'm currently encountering the following issue when I try and push my database. I know the paramaters in my movefile are correct, as they match wp-config and the site installer ran fine with them. Any thoughts? Thanks! I'm running this with wordmove push -d -e staging

remote | mysqldump --host=localhost --user=USERNAME '--password=PASSWORD' NAME > /var/www/html/wp-content/dump.sql
   remote | get: /var/www/html/wp-content/dump.sql /Users/DevonHicks/Desktop/myBox/VVV/www/SITENAME/htdocs/wp-content/staging-backup-1416253878.sql
   remote | delete: /var/www/html/wp-content/dump.sql
    local | mysqldump --host=localhost --user=wp --password=wp SITENAME > /Users/DevonHicks/Desktop/myBox/VVV/www/SITENAME/htdocs/wp-content/dump.sql
sh: mysqldump: command not found
/Library/Ruby/Gems/2.0.0/gems/wordmove-1.2.0/lib/wordmove/deployer/base.rb:147:in `run': Return code reports an error (RuntimeError)
    from /Library/Ruby/Gems/2.0.0/gems/wordmove-1.2.0/lib/wordmove/deployer/base.rb:210:in `save_local_db'
    from /Library/Ruby/Gems/2.0.0/gems/wordmove-1.2.0/lib/wordmove/deployer/ssh.rb:20:in `push_db'
    from /Library/Ruby/Gems/2.0.0/gems/wordmove-1.2.0/lib/wordmove/cli.rb:58:in `block in push'
    from /Library/Ruby/Gems/2.0.0/gems/wordmove-1.2.0/lib/wordmove/cli.rb:34:in `block in handle_options'
    from /Library/Ruby/Gems/2.0.0/gems/wordmove-1.2.0/lib/wordmove/cli.rb:32:in `each'
    from /Library/Ruby/Gems/2.0.0/gems/wordmove-1.2.0/lib/wordmove/cli.rb:32:in `handle_options'
    from /Library/Ruby/Gems/2.0.0/gems/wordmove-1.2.0/lib/wordmove/cli.rb:57:in `push'
    from /Library/Ruby/Gems/2.0.0/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
    from /Library/Ruby/Gems/2.0.0/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
    from /Library/Ruby/Gems/2.0.0/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'
    from /Library/Ruby/Gems/2.0.0/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
    from /Library/Ruby/Gems/2.0.0/gems/wordmove-1.2.0/bin/wordmove:6:in `<top (required)>'
    from /usr/bin/wordmove:23:in `load'
    from /usr/bin/wordmove:23:in `<main>'
alessandro-fazzi commented 10 years ago

Hi @CraftyDevon :)

It seems you lacks mysqldump on your local environment

mysqldump: command not found

What is the output of which mysqldump in your terminal? Usually mysqldump is shipped with mysql, so sounds a bit weird the lack of it...

alessandro-fazzi commented 10 years ago

Mh...is it possible you're using Vagrant, w/ mysqldump in it, but invoking wordmove within your bare machine? Wordmove expects to be invoked from inside the Vagrant box. If it's not your case ignore this comment, please.

Cheers

CraftyDevon commented 10 years ago

I'm using Vagrant in combo with the VVV site wizard script by aliso. So my vagrant box sits in a folder on my desktop, and each site I have is in a subfolder within that. Currently my movefile is inside the htdocs file.

I'm currently not sshing into the box.

alessandro-fazzi commented 10 years ago

Please, could you answer to my previous questions, please?

Morevoer: «my movefile is inside the htdocs file» I can't understand where or what is your "htdocs file", I'm sorry. Could you explain a bit deeper?

Cheers

CraftyDevon commented 10 years ago

Currently which mysql returns mysqldump not found.

I am running wordmove inside of vagrant. File wise, Desktop/mybox/vvv/www/sitename/htdocs.

Thanks!

alessandro-fazzi commented 10 years ago

Mmmhhh...if I understand you're doing something like:

You actually said «I'm running wordmove inside of vagrant», but what's your procedure? Your problem isn't really wordmove-releated, so we need as much info as possible about your environment, or we can't help as much as we'd like.

Thank you

CraftyDevon commented 10 years ago

You guys are always great with lending a hand.

Your assumptions are correct. So once I cd into that htdocs folder, I run my Wordmove command. It works for everything other than the database.

I wonder if the upgrade to yosemite caused an issue, I did successfully push a database in the past.

When I attempt to ssh into that htdocs folder and run wordmove, it tells me the command isn't found. Should I install worldmove inside vagrant?

alessandro-fazzi commented 10 years ago

Imho, yes! In most of the cases, when using Vagrant, the way to go is to use wordmove inside the Vagrant box, because it has all the tools you need. Moreover there are plenty of different setups and the troubleshooting is always a bit painful. E.g.: where your mysql DB is? Inside the box? Outside the box?

We in weLaika do not use Vagrant, so, in the end, we have not all the know how at our fingertips ^^''

I'd anyway try to install wordmove inside the box. Than you can call from the outside, using for example vagrant ssh -- wordmove --config=/path/to/your/Movefile or something similar.

Please drop here some good news when you'll have someone :+1:

CraftyDevon commented 10 years ago

Attempting to install wordmove inside vagrant leaves me with this..

agrant@vvv:~$ sudo gem install wordmove Building native extensions. This could take a while... ERROR: Error installing wordmove: ERROR: Failed to build gem native extension.

    /usr/bin/ruby1.9.1 extconf.rb

/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in require': cannot load such file -- mkmf (LoadError) from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:inrequire' from extconf.rb:1:in `

'

Gem files will remain installed in /var/lib/gems/1.9.1/gems/json-1.8.1 for inspection. Results logged to /var/lib/gems/1.9.1/gems/json-1.8.1/ext/json/ext/generator/gem_make.out

alessandro-fazzi commented 10 years ago

Ouch. We're going too far from our territory... here we are into the wild...I don't know even what's the OS of your box :( I think installing a gem should be resolved somewhere else...

Just one question: how do you manage and how do you connect to your database? What's the configuration inside wp-config.php? Have you got sequelPro / phpMyAdmin / hellSQLsomethingElse installed? How does it connect to your db?

joeguilmette commented 9 years ago

https://github.com/joeguilmette/auto-site-setup/blob/master/provision/provision-pre.sh

Dump that into your provision folder and run vagrant reload ---provision. It has done other stuff you might want to comment out.

Or you can manually run

apt-get install -y ruby-dev
gem install rubygems-update
update_rubygems
gem install wordmove

Have fun! On Tue, Nov 18, 2014 at 11:07 PM Alessandro Fazzi notifications@github.com wrote:

Ouch. We're going too far from our territory... here we are into the wild...I don't know even what's the OS of your box :( I think installing a gem should be resolved somewhere else...

Just one question: how do you manage and how do you connect to your database? What's the configuration inside wp-config.php? Have you got sequelPro / phpMyAdmin / hellSQLsomethingElse installed? How does it connect to your db?

— Reply to this email directly or view it on GitHub https://github.com/welaika/wordmove/issues/110#issuecomment-63494885.

alessandro-fazzi commented 9 years ago

Hey @joeguilmette I was secretly hoping that you were reading this issue :p

Guys...probably could be a good idea to write something on the wiki about wordmove and vagrant and VVV and all the stuff used by a lot of us :)

@CraftyDevon drop here some feedback if you can.

Bye

CraftyDevon commented 9 years ago

Thanks again guys, sadly i'm still struggling with that. Attempting to install anything inside my vvv box yields in failure. @joeguilmette Is there a specific directory I should run that command in, or should the box root be fine?

CraftyDevon commented 9 years ago

I've made some progress in general, mainly through blind luck sadly. If I can get past this error I do believe I'll be golden. I've insured my db password doesn't have any special characters.

/Library/Ruby/Gems/2.0.0/gems/net-ssh-2.8.0/lib/net/ssh/buffer.rb:284:in `block in write': incompatible character encodings: ASCII-8BIT and UTF-8 (Encoding::CompatibilityError)
    from /Library/Ruby/Gems/2.0.0/gems/net-ssh-2.8.0/lib/net/ssh/buffer.rb:284:in `each'
    from /Library/Ruby/Gems/2.0.0/gems/net-ssh-2.8.0/lib/net/ssh/buffer.rb:284:in `write'
    from /Library/Ruby/Gems/2.0.0/gems/net-ssh-2.8.0/lib/net/ssh/buffer.rb:322:in `block in write_string'
    from /Library/Ruby/Gems/2.0.0/gems/net-ssh-2.8.0/lib/net/ssh/buffer.rb:319:in `each'
joeguilmette commented 9 years ago

Hah! Well, @pioneerskies, I watch a couple repos, and as it's my most favorite in the whole world, I pay special attention to Wordmove.

In any case- @CraftyDevon I'm not sure what the problem is, but the good news is Vagrant is Vagrant so you can just vagrant destroy and start over.

So let's do this:

  1. Start with a clean slate and run vagrant destroy
  2. Find the provision folder in your VVV root folder. Create a file called provision-pre.sh and fill it with:
# Rubygems update

if [ $(gem -v|grep '^2.') ]; then
    echo "gem installed"
else
    apt-get install -y ruby-dev
    echo "ruby-dev installed"
    echo "gem not installed"
    gem install rubygems-update
    update_rubygems
fi

# wordmove install
wordmove_install="$(gem list wordmove -i)"
if [ "$wordmove_install" = true ]; then
  echo "wordmove installed"
else
  echo "wordmove not installed"
  gem install wordmove

  wordmove_path="$(gem which wordmove | sed -s 's/.rb/\/deployer\/base.rb/')"
  if [  "$(grep yaml $wordmove_path)" ]; then

    echo "can require yaml"
  else
    echo "can't require yaml"
    echo "set require yaml"

    sed -i "7i require\ \'yaml\'" $wordmove_path

    echo "can require yaml"

  fi
fi

Since this is a VVV issue rather than a Wordmove issue, you can contact me directly in the future if you run in to any more problems!

alessandro-fazzi commented 9 years ago

Ohoho!

@joeguilmette I'll dream of a wiki section copy-pasted from you last comment <3

@CraftyDevon speaking about encoding problems, please take a look at the pull requests. We're trying our best to review and accept/implement those in order to ship another tagged release of Wordmove; in the meantime lurk inside pull requests and older issues.

Please, give us feedback in order to let us follow the troubleshooting.

Arkham commented 9 years ago

@joeguilmette you're a star! Ping me whenever you're in London so I can buy you a pint :beers:

joeguilmette commented 9 years ago

Aww shucks, thanks guys...

delphaber commented 9 years ago

@joeguilmette could you please write down a wiki page about this? Thank you very much for your work!

joeguilmette commented 9 years ago

Done! And funny enough, I saw your request here after I just went ahead and did it.

twilightzone

delphaber commented 9 years ago

Hi! Thank you very much!

delphaber commented 9 years ago

Link to wiki page

dezinerdudes commented 8 years ago

I found this method does not work anymore. The easiest way to install wordmove in a VVV machine now is to: 1) SSH into the machine: vagrant ssh 2) Change to root account: sudo su - 3) Run: gem install wordmove

Now your database and files should push & pull / sync seamlessly.