geerlingguy / drupal-vm

A VM for Drupal development
https://www.drupalvm.com/
MIT License
1.37k stars 646 forks source link

Acquia Drush Aliases sql-sync to VirtualBox #406

Closed justinlevi closed 8 years ago

justinlevi commented 8 years ago

So one thing I've been struggling with is figuring out a workflow for getting the Drupal-VM database setup using sql-sync to an Acquia Cloud site. I'd like to get the Drupal-VM synchronized with an existing Drupal project checked out from Acquia (via DevDesktop although it could just as well be a git clone via command line).

Here's how I'm thinking it should work:

  1. Create a Drupal-VM, w/ vagrant up
  2. pull down the dev database using the provided Acquia drush aliases,
  3. update the VM Database. --- Ideally this could all be done after vagrant up completes, but I'd be happy if I could just get the workflow sorted out manually to start...

So, here's where I'm at:

My VM is setup and working great. I can vagrant ssh in and verify that ssh-agent is forwarding correctly to the host by running ssh -T git@github.com as I get the expected message: Hi xxx! You've successfully authenticated, but GitHub does not provide shell access.

I can create a new drush alias to the Drupal-VM no problem by adding the following into <SITE ROOT>/../drush/virtualbox.aliases.drushrc.php:

$aliases['local'] = array(
  'remote-host' => '192.168.88.88',
  'remote-user' => 'vagrant',
  'root' => '/var/www/drupalvm/drupal',
  'ssh-options' => '-o PasswordAuthentication=yes',
);

I can then run drush @virtualbox.local status, enter vagrant for my pw and everything works as expected.

haha - In doing the above and running drush sa I realized aliases were already being created to all of the virtual hosts defined in the config. oops.

Regardless though, this is where I get stuck. If I then try to sync with the Acquia DB running

drush sql-sync @<ACQUIA-DRUSH-ALIAS>.dev @drupalvm.drupalvm.dev

I consistently get a rsync error. I think this might have something to do with trying to rsync between two remote hosts. I feel like I've read somewhere that rsync doesn't like that.

Here's the full error I'm seeing:

Host key verification failed.
rsync: connection unexpectedly closed (0 bytes received so far) [Receiver]
rsync error: error in rsync protocol data stream (code 12) at io.c(226) [Receiver=3.1.0]
Could not rsync from @<ACQUIA-DRUSH-ALIAS>.dev:/home/xxxx/drush-backups/xxxx/20160130012449/xxxx_20160130_012450.sql.gz to          [error]
/tmp/xxxx_20160130_012450.sql.gz
Copying dump file from Source to Destination.                                                                                                 [ok]
core-rsync failed.   

I also tried drush @<ACQUIA-DRUSH-ALIAS>.dev sql-dump | drush @drupalvm.drupalvm.dev sql-cli with no luck even though I can create the sql file no problem with

drush @<ACQUIA-DRUSH-ALIAS>.dev sql-dump > sqldump.sql

I found a project called Drush SQL Sync Pipe that looks promising but wanted to check here before I start going down that road. https://www.drupal.org/project/drush_sql_sync_pipe

@geerlingguy - Any help is greatly appreciated. Thanks!

Oh, a few more notes.

I ended up installing Drush SQL Sync Pipe and was able to get the DB from the Acquia Dev site and push it up to the Virtual Box.

drush sql-sync-pipe @<ACQUIA-DRUSH-ALIAS>.dev @drupalvm.drupalvm.dev --progress

I'm not sure if this is the correct approach though and now I'm running into some php issues that I'm not seeing on dev desktop or on Acquia Dev oddly enough.

oxyc commented 8 years ago

The PR you merged earlier has all the changes already I think https://github.com/oxyc/drupal-vm/commit/ca349e2a83ca25703ebc47bf68fe8d8de5c98486. The only issue is that it hasn't been verified on windows. I'm pretty confident our docs are correct now and if there are any issues, they are in fact drush bugs.

geerlingguy commented 8 years ago

Okay, I'm going to close this issue then. We can open up follow-ups if anything's incorrect, or push stuff off to Drush :P