Skip to content
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

Can't use Alternative S3 URLs with Staging/Production Option #654

Open
ronilan opened this issue May 17, 2022 · 0 comments · May be fixed by #656
Open

Can't use Alternative S3 URLs with Staging/Production Option #654

ronilan opened this issue May 17, 2022 · 0 comments · May be fixed by #656

Comments

@ronilan
Copy link
Contributor

ronilan commented May 17, 2022

Overview

It is not possible to use alternative s3 urls (path style) and s3-compatible backends (e.g. min.io) in conjunction with the production_host and staging_host option.

Status

  • Originally host was defined as a string property of binary. The required AWS settings were automatically detected and extracted from the string.
  • Pull request allow prod & stage s3 targets #533 defined production_host and staging_host as string properties of binary and the logic that governs which is used when. The required AWS settings were also automatically detected and extracted from the strings.
  • Pull request Allow alternative s3 urls and s3-compatible backends (e.g. minio).  #576 added bucket region and s3ForcePathStyle as string properties of the binary object. The trio of keys, along with host value, enables to explicitly set access to a bucket, bypassing automatic detection and extraction.

Problem

bucket region and s3ForcePathStyle are set as properties of binary when in fact they are (together with the endpoint) properties of the host target. Since there can be multiple host targets (staging/production) but there can only be a single explicitly set bucket name, the alternate host option doesn't work in conjunction with the production_host and staging_host option.

Proposed Solution

Moving forward host will be defined as an object with optional properties.

Example 1: (S3 Virtual Host URL)

{
  "binary": {
    "host": {
      "endpoint": "https://npg-mock-bucket.s3.us-east-1.amazonaws.com",
    }
  }
}

Example 2: (Path Style alternative host)

{
  "binary": {
    "host": {
      "endpoint": "https://play.min.io",
      "bucket": "node-pre-gyp-production",
      "region": "us-east-1",
      "s3ForcePathStyle": true
    }
  }
}

Example 3: (Utilizing Staging/Production)

{
  "binary": {
    "host": {
      "endpoint": "https://my-production-bucket.s3.us-east-1.amazonaws.com",
    },
    "staging_host": {
      "endpoint": "https://play.min.io",
      "bucket": "node-pre-gyp-staging",
      "region": "us-east-1",
      "s3ForcePathStyle": true
    }
  }
}
{
  "binary": {
    "host": {
      "endpoint": "https://play.min.io",
      "bucket": "node-pre-gyp-production",
      "region": "us-east-1",
      "s3ForcePathStyle": true
    },
    "staging_host": {
      "endpoint": "https://play.min.io",
      "bucket": "node-pre-gyp-staging",
      "region": "us-east-1",
      "s3ForcePathStyle": true
    }
  }
}

Note: the proposed object keys are the same as the ones passed to the AWS sdk.

Backwards compatibility

Existing string definitions and existing keys will be supported.

Example 1: (S3 Virtual Host URL)

{
  "binary": {
    "host": "https://npg-mock-bucket.s3.us-east-1.amazonaws.com",
  }
}

Example 2: (Alternative S3 URL)

{
  "binary": {
    "host": "https://play.min.io",
    "bucket": "node-pre-gyp-staging",
    "region": "us-east-1",
    "s3ForcePathStyle": true
  }
}

Example 3: (Utilizing Staging/Production for S3 Virtual Host URL)

{
  "binary": {
    "staging_host": "https://npg-mock-bucket-staging.s3.us-east-1.amazonaws.com",
    "production_host": "https://npg-mock-bucket-staging.s3.us-east-1.amazonaws.com"
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant