Skip to content

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

Open
christianwiedemann wants to merge 2 commits intodrush-ops:13.xfrom
christianwiedemann:docker-rsync
Open

Add remote docker-compose support with docker host (-H) for sql:sync and rsync#6213
christianwiedemann wants to merge 2 commits intodrush-ops:13.xfrom
christianwiedemann:docker-rsync

Conversation

@christianwiedemann
Copy link
Copy Markdown

No description provided.

@weitzman
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants