Skip to content
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

Add remote docker-compose support with docker host (-H) for sql:sync and rsync #6213

Open
wants to merge 2 commits into
base: 13.x
Choose a base branch
from

Conversation

christianwiedemann
Copy link

No description provided.

@weitzman
Copy link
Member

For some background on this topic see #5912 and its linked issue.

Unfortunately, too much of the docker details in this PR are bleeding into Drush. The goal is for all of that to be attracted into transports in the consolidation/site-process project. I'm aware that this implies that sql:sync and rsync: may never work as that abstraction isn't enough. This is unfortunate, but necessary for manageable maintenance of Drush project.

@christianwiedemann
Copy link
Author

Hi @weitzman,
I think it would be great to have rsync and sql:sync support for docker compose and kubernetes. There are a lot of docker compose environments out there and installing an SSH container is not always possible and even yes it is a pain.
The same for kubernetes.

So try it with a new idea. :)

  1. we can make extend the TransportInterface to handle transport specific adjustments of command and make it easy to implement own transports. (I found ProcessManager::addTransports which adds transports hard coded. Is there a way right now to register own transports? )

Something like:

SshTransport"InDrushPackage"  implements RsyncCommandsAlter, SqlSyncCommandsAlter { 
... 
public function rsyncTransportArgs(DrushCommands $command) {
            $ssh_options = $command->getConfig()->get('ssh.options', '');
            $parameters[] = Escape::shellArg($command->sourceEvaluatedPath->fullyQualifiedPathPreservingTrailingSlash());
            $parameters[] = Escape::shellArg($command->targetEvaluatedPath->fullyQualifiedPath());
           return 'ssh $ssh_options'" . ' ' . implode(' ', array_filter($parameters)';
  }
... 

Inside rsync:

public function rsync($source, $target, array $extra, $options = ['exclude-paths' => self::REQ, 'include-paths' => self::REQ, 'mode' => 'akz']): void
   {
 $transport = $this->getConfig()->getTransport()
 if (transport instanceof RsyncCommandsAlter) {
    $rsync_args = $transport->rsyncTransportArgs($this);
 }
 } 

Or we use some kind of events?

@weitzman
Copy link
Member

It still looks messy to me, but I'll accept it if @greg-1-anderson agrees with the direction. I pinged him in #drush

Adding own transports is not possible yet. Requested at consolidation/site-process#52

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants