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

Impossible to mirror the libsass binaries #775

Closed
npiguet opened this issue Mar 18, 2015 · 15 comments · Fixed by #901
Closed

Impossible to mirror the libsass binaries #775

npiguet opened this issue Mar 18, 2015 · 15 comments · Fixed by #901

Comments

@npiguet
Copy link

npiguet commented Mar 18, 2015

After having investigated the proxy issue, I found out an extra problem: Even when the proxy call is made to work, my corporate proxy does not allow downloading native executables (.so, .dll, etc..) from the internet. The binaries provided by node-sass are blocked by the proxy and prevent the proper installation of node-sass.

As a workaround for this kind of issues, my organisation has an internal server dedicated to hosting trusted binaries that can be accessed without going through the proxy. That sounded like a reasonable solution to my problem until I disovered how the path to the binary is resolved:

function getBinaryUrl() {
  return flags.binaryUrl ||
         package.nodeSassConfig ? package.nodeSassConfig.binaryUrl : null ||
         process.env.SASS_BINARY_URL ||
         ['https://github.com/sass/node-sass/releases/download//v',
          `package.version, '/', sass.binaryName].join('');
}

and

function getBinaryName() {
  var binaryName;

  if (flags.binaryName) {
    binaryName = flags.binaryName;
  } else if (package.nodeSassConfig && package.nodeSassConfig.binaryName) {
    binaryName = package.nodeSassConfig.binaryName;
  } else if (process.env.SASS_BINARY_NAME) {
    binaryName = process.env.SASS_BINARY_NAME;
  } else {
    binaryName = [process.platform, '-',
                  process.arch, '-',
                  process.versions.modules].join('');
  }

  return [binaryName, 'binding.node'].join('_');
}

This means that if I want to override the location of the binary, I need to point to the exact location of the particular binary that works for each machine's platform/architecture/module version/node-sass version combination. This is currently pretty hard to do given the various environments that our build scripts must run on.

node-sass should provide an option, say --sass-binary-mirror-url, that allows me to build a dumb mirror of all the binaries and that tells the node-sass installer to perform its binary resolution algorithm using this URL as base (instead of the hardcoded https://github.com/sass/node-sass/releases/download/)

As a workaround, I guess I could copy both of these methods to my gulpfile.js and compute the binary URL there. However, I'm not sure how I could make node-sass pick up that url. Is it possible?

@am11 am11 added the npm build label Mar 20, 2015
@saper
Copy link
Member

saper commented Apr 4, 2015

Maybe we could use npmconf for this?

@am11
Copy link
Contributor

am11 commented Apr 4, 2015

The OP probably need what phantomJS does: provide the ability to mirror the CDN. We are half way through. I thought it would make no sense to provide same organisation as we have in our own setup, so I didn't provided the same naming scheme as we have in node-sass. Given this use-case, I am pretty convinced and we would augment the same name as our (or probably configurable format via package.json). All the abilities are available in extensions.js but they need to be tested thoroughly.

Related: #743.

saper added a commit to saper/node-sass that referenced this issue Apr 4, 2015
Provide ability to locally mirror node-sass
binaries for various versions and platforms.

SASS_DIST_SITE needs to be an URL pointing to
a collection of files organized like the Github
repository.

If SASS_DIST_SITE is set to

 http://myhost:8080/local/node-sass-bin

then

 http://myhost:8080/local/node-sass-bin/v3.0.0-beta.4/freebsd-x64-14_binding.node

should point to the FreeBSD 64 bit binary for node 0.12.0
@saper
Copy link
Member

saper commented Apr 4, 2015

I think @npiguet needs something like this 65b0519 and set SASS_DIST_SITE accordingly.

saper added a commit to saper/node-sass that referenced this issue Apr 4, 2015
Provide ability to locally mirror node-sass
binaries for various versions and platforms.

SASS_DIST_SITE needs to be an URL pointing to
a collection of files organized like the Github
repository.

If SASS_DIST_SITE is set to

 http://myhost:8080/local/node-sass-bin/

then

 http://myhost:8080/local/node-sass-bin/v3.0.0-beta.4/freebsd-x64-14_binding.node

should point to the FreeBSD 64 bit binary for node 0.12.0
@npiguet
Copy link
Author

npiguet commented Apr 4, 2015

I can confirm that this sounds exactly like what I need.

On April 4, 2015 10:25:16 PM Marcin Cieślak notifications@github.com wrote:

I think @npiguet needs something like this 62d991c and set SASS_DIST_SITE
accordingly.


Reply to this email directly or view it on GitHub:
#775 (comment)

@chriseppstein
Copy link
Contributor

👍 This is a blocker issue for us at LinkedIn.

saper added a commit to saper/node-sass that referenced this issue Apr 9, 2015
Provide ability to locally mirror node-sass
binaries for various versions and platforms.

SASS_BINARY_SITE needs to be an URL pointing to
a collection of files organized like the Github
repository.

If SASS_BINARY_SITE is set to

 http://myhost:8080/local/node-sass-bin/

then

 http://myhost:8080/local/node-sass-bin/v3.0.0-beta.5/freebsd-x64-14_binding.node

should point to the FreeBSD 64 bit binary for node 0.12.0
saper added a commit to saper/node-sass that referenced this issue Apr 9, 2015
Provide ability to locally mirror node-sass
binaries for various versions and platforms.

SASS_BINARY_SITE needs to be an URL pointing to
a collection of files organized like the Github
repository.

If SASS_BINARY_SITE is set to

 http://myhost:8080/local/node-sass-bin/

then

 http://myhost:8080/local/node-sass-bin/v3.0.0-beta.5/freebsd-x64-14_binding.node

should point to the FreeBSD 64 bit binary for node 0.12.0
@saper
Copy link
Member

saper commented Apr 9, 2015

@chriseppstein Our premium support customers are always a top priority for us, can you try applying pull request #835 and set SASS_BINARY_SITE environment variable to the root of your mirror?

saper added a commit to saper/node-sass that referenced this issue Apr 9, 2015
Provide ability to locally mirror node-sass
binaries for various versions and platforms.

SASS_BINARY_SITE needs to be an URL pointing to
a collection of files organized like the Github
repository.

If SASS_BINARY_SITE is set to

 http://myhost:8080/local/node-sass-bin/

then

 http://myhost:8080/local/node-sass-bin/v3.0.0-beta.5/freebsd-x64-14_binding.node

should point to the FreeBSD 64 bit binary for node 0.12.0
@chriseppstein
Copy link
Contributor

@saper Thank you for the quick turn-around!

Hey, @winding-lines, does this look sufficient for our needs?

@chriseppstein
Copy link
Contributor

Actually, @dosco is going to be looking into this :)

saper added a commit to saper/node-sass that referenced this issue Apr 9, 2015
Provide ability to locally mirror node-sass
binaries for various versions and platforms.

SASS_BINARY_SITE needs to be an URL pointing to
a collection of files organized like the Github
repository.

If SASS_BINARY_SITE is set to

 http://myhost:8080/local/node-sass-bin/

then

 http://myhost:8080/local/node-sass-bin/v3.0.0-beta.5/freebsd-x64-14_binding.node

should point to the FreeBSD 64 bit binary for node 0.12.0

The URL can be also specified as the --sass-binary-site
commandline option or in the package.json:

 "nodeSassConfig": {
   "binarySite": <url>
 }

While here, fix operator precedence for --sass-binary-url.
saper added a commit to saper/node-sass that referenced this issue Apr 9, 2015
Provide ability to locally mirror node-sass
binaries for various versions and platforms.

SASS_BINARY_SITE needs to be an URL pointing to
a collection of files organized like the Github
repository.

If SASS_BINARY_SITE is set to

 http://myhost:8080/local/node-sass-bin/

then

 http://myhost:8080/local/node-sass-bin/v3.0.0-beta.5/freebsd-x64-14_binding.node

should point to the FreeBSD 64 bit binary for node 0.12.0

The URL can be also specified as the --sass-binary-site
commandline option or in the package.json:

 "nodeSassConfig": {
   "binarySite": <url>
 }

While here, fix operator precedence for --sass-binary-url.
@dosco
Copy link

dosco commented Apr 9, 2015

@saper will try and get an update to you about the patch by tomorrow.

@saper
Copy link
Member

saper commented Apr 10, 2015

Which timezone? :)

@dosco
Copy link

dosco commented Apr 10, 2015

@saper @chriseppstein I had a chance to test the patch locally against our repository and it works great.

saper added a commit to saper/node-sass that referenced this issue Apr 10, 2015
Provide ability to locally mirror node-sass
binaries for various versions and platforms.

SASS_BINARY_SITE needs to be an URL pointing to
a collection of files organized like the Github
repository.

If SASS_BINARY_SITE is set to

 http://myhost:8080/local/node-sass-bin/

then

 http://myhost:8080/local/node-sass-bin/v3.0.0-beta.5/freebsd-x64-14_binding.node

should point to the FreeBSD 64 bit binary for node 0.12.0

The URL can be also specified as the --sass-binary-site
commandline option or in the package.json:

 "nodeSassConfig": {
   "binarySite": <url>
 }

Remove --sass-binary-url and friends.
@saper
Copy link
Member

saper commented Apr 10, 2015

Thanks, I just uploaded the hopefully final version of the patch.

@xzyfer
Copy link
Contributor

xzyfer commented Apr 22, 2015

Catching up. @saper that patch looks reasonable for the time being. Please open PR. I'll aim to get it into 3.0.0.

My only suggestion would be put the default url into the package.json.

@saper
Copy link
Member

saper commented Apr 22, 2015 via email

@xzyfer
Copy link
Contributor

xzyfer commented Apr 22, 2015

Apologies I missed your PR. Let's move this discussion to #835.

saper added a commit to saper/node-sass that referenced this issue Apr 22, 2015
Provide ability to locally mirror node-sass
binaries for various versions and platforms.

SASS_BINARY_SITE needs to be an URL pointing to
a collection of files organized like the Github
repository.

If SASS_BINARY_SITE is set to

 http://myhost:8080/local/node-sass-bin/

then

 http://myhost:8080/local/node-sass-bin/v3.0.0-beta.5/freebsd-x64-14_binding.node

should point to the FreeBSD 64 bit binary for node 0.12.0

The URL can be also specified as the --sass-binary-site
commandline option or in the package.json:

 "nodeSassConfig": {
   "binarySite": <url>
 }

Remove --sass-binary-url and friends.

Also change priority and use package.json defaults
last, after command line arguments and the environment.
saper added a commit to saper/node-sass that referenced this issue Apr 27, 2015
Provide ability to locally mirror node-sass
binaries for various versions and platforms.

SASS_BINARY_SITE needs to be an URL pointing to
a collection of files organized like the Github
repository.

If SASS_BINARY_SITE is set to

 http://myhost:8080/local/node-sass-bin/

then

 http://myhost:8080/local/node-sass-bin/v3.0.0-beta.5/freebsd-x64-14_binding.node

should point to the FreeBSD 64 bit binary for node 0.12.0

The URL can be also specified as the --sass-binary-site
commandline option or in the package.json:

 "nodeSassConfig": {
   "binarySite": <url>
 }

Remove --sass-binary-url and friends.

Also change priority and use package.json defaults
last, after command line arguments and the environment.
jiongle1 pushed a commit to scantist-ossops-m2/node-sass that referenced this issue Apr 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants