ddev / ddev

Docker-based local PHP+Node.js web development environments
https://ddev.com
Apache License 2.0
2.75k stars 602 forks source link

Allow ddev config pantheon to specify an explicit site hash to override what the API may find (or fail to find) #1232

Closed ucbklu closed 4 years ago

ucbklu commented 6 years ago

Is your feature request related to a problem? Please describe.

I'm an admin for UC Berkeley -- we have something like 1500 campus sites in our Pantheon org. When I run ddev config pantheon sometimes it can't find the site (I get a "could not find a pantheon site named sitename" message.). Passing a projectname doesn't appear to help find the site either.

I tried running ddev config instead. Then I changed the following in config.yaml: provider: pantheon. Then I copied an import.yaml file from a different site that Pantheon could find, and changed site to the correct Pantheon machine name.

Unfortunately when I try running ddev pull (or ddev start) it still doesn't find the site -- it appears to still be searching Pantheon as opposed to using my local yaml changes.

Describe the solution you'd like It appears that ddev's projectname is searching for and trying to match the sitename string, not the hash.

It would be helpful if we could specify the site via ddev config pantheon --projectname string or something like ddev config pantheon --projectID hashnum since we can find the Pantheon site ID via terminus site:info sitename. I'm hoping that would avoid having ddev try to look up the site by name each time and failing if it exceeds the Pantheon API limit.

Describe alternatives you've considered We're able to use ddev config and then manually import db/files, but we're looking to use a solution that provides better Pantheon integration.

rfay commented 6 years ago

So if I understand correctly, what you think will actually satisfy your situation is if ddev (probably in import.yaml) is able to override the Pantheon site hash (projectID in your example.

rfay commented 6 years ago

An additional note on this one: @ucbklu already shared with me a pantheon site that gets the problem described (and it doesn't demonstrate it for me, probably because I only have a few sites on my token). The site shared with me is called "ddevtester"

ucbklu commented 6 years ago

@rfay : I'm hoping that will solve the issue. Basically, I just want to be able to pass some Pantheon known site information that will allow ddev config pantheon and then ddev start and ddev pull to work. Thanks again.

frazras commented 5 years ago

I'm having the same issue as outlined here https://wikihub.berkeley.edu/display/drupal/Comparing+Lando%2C+DDEV%2C+Docksal

rfay commented 5 years ago

@frazras do you have the same situation, with thousands of Pantheon-hosted sites that you want to pull from?

rfay commented 5 years ago

Is there any possibility that either of you could get me a pantheon key that would demonstrate this? I'd love to prioritize it, but really have no way to demonstrate or test.

ucbklu commented 5 years ago

@rfay : Sorry that isn't something we're able to help with, and we aren't actively using ddev. Perhaps it makes sense for the ddev team to reach out to Pantheon directly if it's affecting other Pantheon users.

rfay commented 5 years ago

You two are the only two who have ever reported this problem, and we're happy to chase it, but can't do it without a context to chase it in, and your context seems to be an unusual one.

Thanks for the response.

gchaix commented 4 years ago

@rfay I think I'm seeing the same problem here at Tag1. My creds on Pantheon have access to a likely larger-than-usual number of sites. I am seeing similar behavior when trying to do a ddev config pantheon where it can't find the site.

[LOCAL] gchaix@Spaceball:sitename (master *)$ ddev config pantheon 
You are reconfiguring the project at /Users/gchaix/repos/sitename.  
The existing configuration will be updated and replaced. 
Project name (sitename):
could not find a pantheon site named sitename
rfay commented 4 years ago

Thanks @gchaix - I do have a PR underway (but neglected) to completely rewrite Pantheon support in terms of terminus execution, which ought to solve this. https://github.com/drud/ddev/pull/1827. I certainly do hope to get it done in the next month or two, I hope you'll be willing to review/try it out. Because it's great to have a guinea pig with an unreproducible problem.

rfay commented 4 years ago

@ucbklu @gchaix @frazras I sure would appreciate if you could test #1827, it uses terminus, pantheon's own interface (inside a container) to interact with Pantheon, so I'm hoping that that could fix the problem in this issue. But since there seems to be no way to recreate it without privileged access to one or your accounts, I'll have to ask you to see what you can figure out. Artifacts are provided over there in #1827

gchaix commented 4 years ago

@rfay success! I built #1827 from source on Ubuntu was able to get ./.gotmp/bin/ddev config pantheon to successfully pull a list of environments on a machine token that has access to 20 Pantheon sites.

Project Type [drupal6, drupal7, drupal8, wordpress, typo3, backdrop, php] (php): drupal7 

Configure Pantheon environment:

        - live
        - abs-url
        - 638-p4
        - t1-236731
        - t1-238959-r
        - dev
        - test
        - tag1-239153

Type the name to select an environment to pull from (dev):

Only one thing that might be nice is to have it catch/highlight the situation where the project name fed to ddev doesn't exactly match the Pantheon site name. The error message unable to get Pantheon environments for project xxxx ('terminus env:list --field=id ' failed) doesn't make it clear that it didn't find a project with a matching name (rather than just failing to list envs).

rfay commented 4 years ago

Yay, thanks, I added a commit suggesting the name-match problem when that happens.

unable to get Pantheon environments for project %s - does the ddev project name match the pantheon project name? ('%v' failed)

blakehall commented 4 years ago

It's not worth reopening this issue, but I figured it's worth mentioning in case someone else stumbles on this issue in a similar manner...

I don't have a large number of pantheon sites (3), but I was seeing the same error message.

It turned out that although I was authenticated with terminus, for whatever reason ddev wasn't able to use those credentials. I had to re-run ddev auth pantheon in order to get things working again.

rfay commented 4 years ago

@blakehall yes, in v1.13+ you have to authenticate once with ddev auth pantheon, as mentioned in the docs and the release notes. The authentication has nothing to do with your host-side terminus authentication.

Thanks! Glad it's working!