-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix #1910. Add support for site aliases that point into a Docker container #3835
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
Conversation
d8722e2 to
7ecb598
Compare
|
Could we perhaps provide this functionality in the Site Process library, and not have to add special checking in Drush? |
|
Could we go through the exercise of defining what we would have to do to make sql:sync work with a docker-based Drupal site? What command would we use to dump the mysql database? Would we be able to do this in such a way that the target dump is written to a shared path that is readable by the local process (i.e. rsync step not needed)? What options would we need to pass to e.g. What would we do with this part of SqlSyncCommands::rsync? |
|
sql:sync is a good question. Assuming that rsync is out of the question, then we need to rely on Docker's array of persistence options. In general, I think folks will want to setup a Named Volume and write/read the dump file from there. sql:sync already has a I may enhance our docker-compose.yml with a There was some discussion in #1906 about this but no-one said how sql:sync is supposed to work across docker powered environments. |
|
The good news is that I got sql:sync to work between 2 containers who both mount a named docker volume. See last commit which contains a temporary second service and a named volume which both I had to specify both source and target and no-sync because of the exact lines you link to SqlSyncCommands::rsync. These paths are local but aliasRecord is considered remote (required by redispatchHook). So now we have aliases that should be "remote" for redispatchHook but local for the purposes of sql dump file paths. I'd be OK with expecting folks to use these options, or we can refactor so that SqlSyncCommands::rsync recognizes that these are local paths. I'm not sure how to do that. |
|
Yeah, getting really close. We just need to figure out what the correct "remote" vs "not remote" determinations should be. Currently the notion of "remote" is overloaded. We need to split it up so that the key options that command line you made can be injected into the docker site alias. |
|
What does issue #1906 have to do with this PR? I'm assuming it should be #1910. I don't think we could assume a sync always is between two docker containers when one of the aliases uses docker for transport. And even if so, they won't share a volume just for syncing files. E.g. We're currently syncing files using rsync for one of our clients using the following command using kubernetes for the remote-shell command in rsync (-e or --rsh parameter)
The same could be used for rsyncing files to or from a docker container: |
|
We're not going to solve the sql:sync problem in this PR, but comments on the different permutations on how to handle this are appreciated. Drupal-on-Kube is another interesting use-case for sure. |
sut/drush/sites/sut.site.yml
Outdated
| uri: prod | ||
|
|
||
| # An example of a Docker Compose environment. Used for ad hoc testing, and not by Unish. | ||
| # An example of a Docker Compose environment. See exa,ple.site.yml for a bit more info. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: exa,ple.site.yml
|
@sjerdo thanks for those rsync examples. I had not seen that form before. Perhaps you could openb a PR with new Examples for the drush rsync command. Thats the best place I can think of to document this. |
|
🎉 |
|
dev:
host: my.remote.host.example.com
user: myuser
docker:
service: my-container-name |
|
Sorry, last comment was probably based on a false conclusion. We had a Drush on that host itself as well as on that host in a container. I'm not sure if it's supposed to be working like that at all (as in SSH into host and execute command in a container on that host). |
|
@weitzman – Do I understand this right, the Docker support is not meant to be used to connect to a remote host that's running Docker containers, and to exec Drush then inside this remote's host containers? It's meant to be used to execute Drush commands in a respectively local Docker container? |
|
@leymannx - my understanding is that your scenario works fine. This is an abstraction provided by Docker itself. Just set DOCKER_HOST env variable to point to the remote docker. |
|
Soo.... here's what I'm deriving from this for mysitename.site.yml: Does this imply we should make sure we have drush installed inside the docker instance itself? Does anyone have time to jot down some notes of "what is required so that drush pm-list command from my local box returns output from target drupal-in-container"? |
|
Nice! Any idea how to combine ssh to a machine that runs drupal/drush in a container? |
|
As I understand, th use case ssh to remote + entering docker container on remote server is not supported. I created the following bash script - it assumes you use drupal with drush and lando:
If there is a more elegant solution using drush site alias, I'm curious. fyi @Trogie-Vynckier |
No description provided.