Skip to content

[self-hosted] Download of workspace failed with self-hosted / minio (at least with gitpod-k3s) #2593

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

Closed
corneliusludmann opened this issue Dec 17, 2020 · 1 comment · Fixed by #2602
Labels
self-hosted type: bug Something isn't working

Comments

@corneliusludmann
Copy link
Contributor

Downloading of workspace content from the workspace history list does not work. You simply get a /sorry page with “Error”. That's what the proxy logs:

2020/12/17 08:31:24 [error] 125#125: *1512 lua entry thread aborted: runtime error: access_by_lua(lib.locations.conf:107):3: http2 requests not supported yet
stack traceback:
coroutine 0:
	[C]: in function 'capture'
	access_by_lua(lib.locations.conf:107):3: in function <access_by_lua(lib.locations.conf:107):1>, client: 10.42.0.1, server: gitpod.dev.ludmann.org, request: "GET /workspace-download/get/a45cdd20-931d-4604-86bb-ac7e56071596 HTTP/2.0", host: "gitpod.dev.ludmann.org", referrer: "https://gitpod.dev.ludmann.org/workspaces/"

After removing http2 from vhost.server.conf this error disappears. However, workspace downloads still not work. Instead, you get a /sorry page that says 404. The var ngx.var.targetUrl in lib.locations.conf looks good and points to the minio pod. At least form the proxy pod, the targetUrl is reachable via curl (but gives 403 - unauthorized).

@corneliusludmann corneliusludmann added type: bug Something isn't working self-hosted labels Dec 17, 2020
@corneliusludmann
Copy link
Contributor Author

I finally found the actual problem (besides the http2 thing):

The proxy tries to connect to:
http://minio.default.svc.cluster.local:9000/gitpod-prod-user-025937da-b2e5-487e-b59e-c5d3eec5d179//workspaces/eb79b0fd-22c2-41f5-93fb-8605e2b3f831/full.tar

But the user bucket is gitpod-user-025937da-b2e5-487e-b59e-c5d3eec5d179 (without prod).

The problem is here:

// we must harmonize this with https://github.com/TypeFox/gitpod/blob/8fc0c82a55da1ca4b5f6ab61deb9c9cd49eff644/components/ws-daemon/pkg/storage/storage.go
// Beware: do NOT use env.kube_stage which has some "legacy" translation mechanism which doesn't fit the ws-daemon mapping.
const stage: string = ({
"production": "prod",
"staging": "prodcopy",
} as any)[process.env.KUBE_STAGE || ""] || "dev";
const bucketName = `gitpod-${stage}-user-${wsi.ownerId}`;
const path = `/workspaces/${workspaceId}/full.tar`;
const signedUrl = await this.storageClient.createSignedUrl(bucketName, path, "read", {
promptSaveAs: `${workspaceId}.tar`
});

But also here, I guess:

export function getBucketName(userId: string, stage: KubeStage): string {
const bucketPrefix = getBucketNamePrefix(stage);
return `gitpod-${bucketPrefix}-user-${userId}`;
}

Or even here:

func minioBucketName(ownerID string) string {
return fmt.Sprintf("gitpod-user-%s", ownerID)
}

func gcpBucketName(stage Stage, ownerID string) string {
return fmt.Sprintf("gitpod-%s-user-%s", stage, ownerID)
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
self-hosted type: bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant