-
-
Notifications
You must be signed in to change notification settings - Fork 579
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
Codespaces: Drupal redirects at unusual places #6102
Comments
additional scenarios where the redirect to :8080 is triggered:
|
Please say whether those redirects to :8080 are triggered if you're using the 8443 URL, thanks. |
I'm not entirely sure that codespaces support is working properly in general. I don't see DDEV getting installed by adding the devcontainer.json specifying it. |
Performed extensive tests on the 8443 port and drupal runs smoothly, no issue at all in any of the reported scenarios and more. Looks like a perfectly viable solution. |
Codespaces seems to change things around quite a lot, and we don't know how to do automated tests on either codespaces or gitpod unfortunately. However, gitpod may be a more robust approach for your team, lots of people use DDEV there. |
Hi! Tested a bit today again with a simple craftcms site https://github.com/mandrasch/craftcms-sprig-green-coding-jobs-demo. Docker integration by Codespaces still seems to be a bit wonky, it just fails sometimes (although I wait for it in postCreateCommand.sh 🤯 ) But the bigger problem is really that - if docker runs successfully - the Codespaces URL detection does not seem work anymore?
Codespace determination is done here: func IsCodespaces() bool {
if os.Getenv("DDEV_PRETEND_CODESPACES") == "true" {
return true
}
return runtime.GOOS == "linux" && os.Getenv("CODESPACES") == "true"
} Line 81 in ea922e2
URL parsing is done here in
Line 2624 in ea922e2
I checked
Is there a quick way to step-debug this and check if ddev detects Codespaces in general? |
Lines 2657 to 2670 in ea922e2
And Lines 506 to 513 in ea922e2
And finally, the code below (for HTTPS) will never be executed, because Lines 2615 to 2631 in ea922e2
|
I think the code should be such that it fits the other parts (even if it generates HTTPS links): --- a/pkg/ddevapp/ddevapp.go
+++ b/pkg/ddevapp/ddevapp.go
@@ -2618,7 +2618,7 @@ func (app *DdevApp) GetAllURLs() (httpURLs []string, httpsURLs []string, allURLs
url, err := exec.RunHostCommand("gp", "url", app.HostWebserverPort)
if err == nil {
url = strings.Trim(url, "\n")
- httpsURLs = append(httpsURLs, url)
+ httpURLs = append(httpURLs, url)
}
}
if nodeps.IsCodespaces() {
@@ -2626,7 +2626,7 @@ func (app *DdevApp) GetAllURLs() (httpURLs []string, httpsURLs []string, allURLs
previewDomain := os.Getenv("GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN")
if codespaceName != "" && previewDomain != "" {
url := fmt.Sprintf("https://%s-%s.%s", codespaceName, app.HostWebserverPort, previewDomain)
- httpsURLs = append(httpsURLs, url)
+ httpURLs = append(httpURLs, url)
}
} And in if !ddevapp.IsRouterDisabled(app) {
...
// All URLs stanza
_, _, urls := app.GetAllURLs()
s := strings.Join(urls, ", ")
urlString := text.WrapSoft(s, int(urlPortWidth))
t.AppendRow(table.Row{"All URLs", "", urlString})
} And |
@mandrasch, yes, most likely a change in logic led to unexpected result. I will investigate this better, because all I did was try your demo repo and look at the code. |
I reopened #5943, it should fix the port redirection in this issue because
|
Thanks very much for taking care of this, Stasa! I briefly tested https://github.com/mandrasch/craftcms-sprig-green-coding-jobs-demo with new ddev v1.23.1, url in Codespaces creation is still a bit buggy, needed two attemps / new codespaces to succeed with postcreatecommand script execution. This bug creeps in sometimes between commands in my demo:
I wonder if we should add a disclaimer to the docs (https://ddev.readthedocs.io/en/stable/#__tabbed_1_5), because the experience in the past months with Codespaces isn't really reliable. Btw: Personally I use Codespaces only for demo/hobby stuff, so not at all urgent for me / no high priority for me. And not really what this ticket is about as well. 🤓 |
I'm glad to hear that! The only thing to note is that I used three words in my nickname, so "a" is the article and I'm Stas 🙂.
If you know what to change there, please open a PR. I also had some problems with Codespaces, but only locally in VSCode. |
Ops, my bad. 🤓 Apologies! Thanks again, Stas!
👍Yeah, I had the discussion with someone else in DDEV discord that Codespaces behaves a bit differently in VSCode as well sometimes. So testing would be needed for both usages of Codespaces. Maybe automated testing will be possible in future. I'll think about a docs PR or I might open up another ticket at Codespaces after I replicate it some more. |
jfyi: Submitted issue devcontainers/features#977 |
Is there an existing issue for this?
Output of
ddev debug test
Expand `ddev debug test` diagnostic information
Expected Behavior
Codespaces should work fine with a Drupal10 instance
Actual Behavior
From Discord
https://fictional-space-fortnight-97rqv976p3ppjv-8080.app.github.dev/
, which works fine (and you can visit many other URLs)https://fictional-space-fortnight-97rqv976p3ppjv-8080.app.github.dev:8080/en/user/1
(note the appended port 8080).http://127.0.0.1:8080
If you visit the URL provided by the ports tab for 8443,
https://fictional-space-fortnight-97rqv976p3ppjv-8443.app.github.dev/
then everything seems to work, including logging in or visiting /user when logged in.It seems that codespaces wants us to use the 8443 port and a full URL for forwarding (for example,
https://fictional-space-fortnight-97rqv976p3ppjv-8443.app.github.dev
) notlocalhost
With DDEV v1.23.0-rc2, you can
ddev launch :8443
and everything seems to work right.Steps To Reproduce
Open a codespace using https://github.com/ddev/d10simple
Install using the web installer or
ddev drush si -y demo_umami --account-pass=admin
ddev launch
Try logging in using user=admin pass=admin
Anything else?
No response
The text was updated successfully, but these errors were encountered: