-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Drush 9 sql-sync does not use ssh-options from target alias during database import #3046
Comments
The master branch supports both of those. A new beta should go out in next couple of days. Note that ssh-options should be nested under 'options' per example.aliases.yml |
Yes, I tested against the master branch, it's not working. The two alias options I gave work well for other commands such as drush status, but not for sql-sync. I guess this command is special because the syntax is |
Thanks for the report. Please post output with --debug, output of |
`drush sa @test ggosset@ggosset-desktop ~/workspace/insite_drupal (drush9 *=) $ drush sa @docker ggosset@ggosset-desktop ~/workspace/insite_drupal (drush9 *=) $ drush --debug -y sql-sync @test @docker You can also get the results of drush status in #3045. By the way, I added ssh to my docker container, it's not docker-philosophy-compliant but it's easier to integrate with drush aliases. And "localdocker" points to 127.0.0.1 in my /etc/hosts. |
It's on our roadmap to support direct docker exec via aliases for The |
All right. Do you mean that my command can't work currently because it's a docker container and docker is not yet supported for Drush 9? Or is it an unrelated comment? Because I think the way I use it (SSH into Docker) make drush docker-agnostic. My docker container could instead be any remote server accessed through SSH, and my command would break though. So is this issue a real bug? A known issue currently in a TODO list? A consequence of #3045? A mis-usage? |
This is unrelated to #3045. The scenario described in this issue does not work because #1910 is the issue for docker exec. |
Understood, thank you for your clear answer and your work on drush 9. |
Working on this in #3075. Command-specific options are working, but other things (drush-script, ssh-options, etc.) probably still need work. |
@gaelg and anyone else tracking this issue: Please try #3075 and see if it meets your use-case. Even more importantly:
It is our intention that |
@greg-1-anderson It does not work because the SSH connection to @test takes the SSH options from @docker (port 2200):
|
R270 change:
R272 change:
R270+R272 change:
|
OK, seems like we can't just inject base configuration from the alias files, because both aliases might have remote options which might be incompatible. After removing the base option injection, we'll need to confirm that backend invoke is still injecting options for the target alias. The |
It's better but still not working. The ssh options of the second alias are not taken. ggosset@insite-asus ~/workspace/insite_drupal $ drush --debug -y sql-sync @test @docker // Do you really want to continue?: yes. [notice] Starting to dump database on source. [1.69 sec, 8.41 MB] |
And by the way, to answer to greg-1-anderson, we don't use "alias-parameters". |
OK, so from the above it looks like ssh-options et. al. are working for sql-dump and rsync, but not for the import. |
@gaelg I added a test that caught the failing scenario above and then fixed it in the commit above, which has been merged onto the |
Thank you. Unfortunately there is still a problem:
|
That's a lot of lines of debug. I tried to reproduce your configuration in the unit tests; the tests are currently passing with the configuration I put together. Maybe you could submit a PR with a failing test. |
I looked at sqlSyncTest.php to see how you implement your test. It's not very clear to me but it looks like it misses the scenario I use: remote to remote (Docker through SSH is like remote, even if it's actually local...). I execute a local drush (because I use "drush sql-sync..." and not "drush @some-alias sql-sync..."). And this local drush knows 2 remote aliases, so that it should be able to sync databases by dumping the first one, downloading it locally, uploading it to the second remote and execute it there. It's how it works with Drush 8. |
Remote to Remote is no longer supported. You should get a validation error with a helpful message if you try it. The workaround should be straightforward - you just run the command on one of the remote servers:
|
Thank you for your answer. It's a bad news that remote to remote is not supported anymore. We use sql-sync and rsync to get content from production instance to local dev instances but also to test or staging instances. The useful thing with remote to remote is that we only need to enable SSH between local and remotes (IP whitelists, SSH keys,...). It's longer to execute because of the double transfer but it's easier to set. Is there an easy way to do remote to local then local to remote2 (or docker) through several simple drush calls? It has to be noticed that local has drush and Drupal code but no DB. |
I don't think it would be impossible to support remote-to-remote again. This was taken out to keep the rsync and sql-sync code simpler and easier to maintain. The former sql-sync algorithm supported all sorts of things (e.g. no drush on the target system), which made it very complex and difficult to maintain. The current sql-sync implementation could already do remote-to-remote if the rsync command supported remote-to-remote. To do remote-to-remote with the current implementation, you could run:
I haven't tried that and there are no tests or documentation, so it is possible that there may be bugs preventing this scenario from working. The existing code does have the aspirational goal of supporting that two-step process. The above scenario should not require a database client to be installed on the local system. |
Yes, remote to remote was very useful. It would be great to have it back. *It only works if this is fixed: #3131 NB: drush sql-sync @self @docker --no-dump --source-dump=/path/to/dump.sql did not work because the SSH options of @docker were not taken into account. |
Another option I use is to execute ssh on source to execute drush :
|
Looks like it ignores at least paths.drush-script and ssh.options (-vvv shows a wrong ssh command). We use aliases on sql-sync for getting content from prod back to dev easily. We can't use them currently with Drush 9 (recommended for Drupal 8.4).
The text was updated successfully, but these errors were encountered: