Git Product home page Git Product logo

Comments (38)

tj avatar tj commented on August 27, 2024

meh screw it I'll just not be lazy and use dns

from kappa.

totherik avatar totherik commented on August 27, 2024

Ha, sorry. Was just about to start digging into this. Can you give a little more detail as to your setup just for my edification? We do use the 'vhost' setting, but I noticed it's not getting set in the default config. Not sure if I'm reading the bug correctly to say if that's related or not.


From: TJ Holowaychuk [[email protected]]
Sent: Monday, December 02, 2013 1:03 PM
To: paypal/kappa
Subject: Re: [kappa] public hostname issue (#11)

meh screw it I'll just not be lazy and use dns


Reply to this email directly or view it on GitHubhttps://github.com//issues/11#issuecomment-29657224.

from kappa.

tj avatar tj commented on August 27, 2024

oh wow sorry i completely missed that option! that should do it

from kappa.

tj avatar tj commented on August 27, 2024

@totherik does kappa have https/basic auth support or anything? or what do you recommend for securing the registry?

from kappa.

lmarkus avatar lmarkus commented on August 27, 2024

You could front it with nginx and drop in it's basic auth module

Also see: http://word.bitly.com/post/47548678256/google-auth-proxy for other ideas

from kappa.

tj avatar tj commented on August 27, 2024

ill chuck a little express thing in front for now, hopefully npm supports it haha

from kappa.

totherik avatar totherik commented on August 27, 2024

It doesn't do anything out of the box right now. From an auth & auth perspective we allow anonymous read access and then use couch/npm for managing package ownership. For TLS/SSL, we got in the habit of not terminating SSL in node itself but you may be able to merely configure to enable it. Lemme investigate and get back to you.

from kappa.

tj avatar tj commented on August 27, 2024

not a huge deal to chuck something in front, but might be worth mentioning in the docs so people aren't exposing their private stuff. I'm adding --auth to serve(1) in npm so people can just npm install -g serve and launch something quickly

from kappa.

totherik avatar totherik commented on August 27, 2024

yeah, good call! Do you happen to know if/how npm deals with something like basic auth? If I run npm install --save foobar would npm know to prompt for credentials?

from kappa.

totherik avatar totherik commented on August 27, 2024

Or are you thinking the creds would just be in the registry url one configures via npm config set registry?

from kappa.

tj avatar tj commented on August 27, 2024

seems like it doesn't via the url at least, I opened an issue, and npm config set strict-ssl 0 for self-signed

from kappa.

tj avatar tj commented on August 27, 2024

now I'm getting these from hapi, whatever they're supposed to mean:

2013-12-02T23:19:33.688Z HAPI,HANDLER,ERROR {"msec":0.15241800248622894}
2013-12-02T23:19:33.689Z HAPI,RESPONSE,ERROR unspecified
2013-12-02T23:19:33.689Z INFO,REQUEST 172.17.42.1 PUT /-/user/org.couchdb.user:segment 404
2013-12-02T23:22:29.568Z HAPI,HANDLER,ERROR {"msec":0.1394440084695816}
2013-12-02T23:22:29.569Z HAPI,RESPONSE,ERROR unspecified
2013-12-02T23:22:29.569Z INFO,REQUEST 172.17.42.1 PUT /-/user/org.couchdb.user:segment 404
2013-12-02T23:22:41.398Z HAPI,HANDLER,ERROR {"msec":0.1546669900417328}
2013-12-02T23:22:41.400Z HAPI,RESPONSE,ERROR unspecified

unspecified error? I guess I probably have to add user:pass to .vhost

from kappa.

tj avatar tj commented on August 27, 2024

ugh nope

from kappa.

totherik avatar totherik commented on August 27, 2024

are you seeing that with basic auth or is kappa just broken for you right now?

from kappa.

tj avatar tj commented on August 27, 2024

trying a rebuild, seems like maybe couch is fucked now haha. private npm ftl. It worked fine until I added basic auth so something isn't playing nice. If you guys are relaying Authorization is it maybe because npm is trying to use that for an npm user? instead of authorizing with nginx? I'm not sure how npm sends creds but if that's how then they're just going to collide, hmm I'll try doing npm adduser from the instance

from kappa.

totherik avatar totherik commented on August 27, 2024

I also noticed the default docker config just points at http://${hostname}:5984 for the first registry, but if that's a couchdb app w/out vhost it'll prob need to be something like http://${hostname}:5984/registry/_design/ghost/_rewrite/ That's how I have it running locally at least.

from kappa.

tj avatar tj commented on August 27, 2024

no luck with that :(, hunting some more, nginx does still pass the authorization header field so I don't get how it works completely fine without it

from kappa.

tj avatar tj commented on August 27, 2024

@totherik is this supposed to happen? I'm in the container, I thought that 404 was from couch at first (I'm a couch newb) but seems like it's kappa:

$ curl http://bae2c8a28529:5984/
{"db_name":"registry","doc_count":5,"doc_del_count":0,"update_seq":5,"purge_seq":0,"compact_running":false,"disk_size":77928,"data_size":62808,"instance_start_time":"1386030800929572","disk_format_version":6,"committed_update_seq":5}

 $ curl http://0.0.0.0:1337/
{"code":404,"error":"Not Found" }

conf:

{
    "servers": [
        {
            "host": "0.0.0.0",
            "port": 1337
        }
    ],
    "plugins": {
        "kappa": [
            {},
            { "vhost": "registry.segment.io",
                "paths": [
                    "http://bae2c8a28529:5984/",
                    "https://registry.npmjs.org/",
                    "http://npm.nodejs.org.au:5984/registry/_design/app/_rewrite"
                ]
            }
        ]
    }
}

maybe vhost is not what i was looking for, I just wanted a way to get npm to request from registry.segment.io instead of http://bae2c8a28529:5984/, not the Host routing. Here's the issue now when I disable the vhost thing:

npm http GET https://registry.segment.io/s-db
npm http 404 https://registry.segment.io/s-db
npm http GET http://registry:5984/s-db/-/s-db-1.0.0.tgz
npm ERR! fetch failed http://registry:5984/s-db/-/s-db-1.0.0.tgz
npm http GET http://registry:5984/s-db/-/s-db-1.0.0.tgz
npm ERR! fetch failed http://registry:5984/s-db/-/s-db-1.0.0.tgz

from kappa.

totherik avatar totherik commented on August 27, 2024

I'm trying to catch up/repro... have the docker container up and running as described by the docker-npmjs and I'm able to hit it externally just fine.

After jumping into the container I ran these:

$ curl http://localhost:5984/
{"couchdb":"Welcome","uuid":"373cadaf9f377ae7f0f0c57454379793","version":"1.4.0","vendor":{"version":"1.4.0","name":"The Apache Software Foundation"}}

$ curl http://0.0.0.0:1337
{"db_name":"registry","doc_count":4,"doc_del_count":0,"update_seq":4,"purge_seq":0,"compact_running":false,"disk_size":73826,"data_size":62367,"instance_start_time":"1386033137809980","disk_format_version":6,"committed_update_seq":4}

$ curl http://0.0.0.0:1337/express
{"_id":"express","_rev":"564-94e62bb9dfbba14c68a4de03f8036967","name":"express","description":"Sinatra inspired web development framework","dist-tags":{"latest":"3.4.6"},"versions":{"0.14.0":{"name":"express","description":"Sinatra inspired web development framework","version":"0.14.0"...

Did you configure a vhost? I wonder what's different

from kappa.

tj avatar tj commented on August 27, 2024

on to something weird, it works fine on my machine but not my ubuntu vm, same npmrc, same version of npm, same node, makes no sense to me but don't worry about looking into it, must be something messed up with my vm

from kappa.

tj avatar tj commented on August 27, 2024

i wondering where npm was getting the tarball urls, but i see now that it's baked right into the couchdb documents, so I guess it just grabs hostname and shoves that in couch? haha, need to investigate that a bit, but that's definitely the issue

from kappa.

totherik avatar totherik commented on August 27, 2024

ok, whew this was supposed to be easy! lol. so yeah, I was worried you might had left the change in your config that added /registry/_design/ghost/_rewrite/ for the first registry (I later found out it was definitely unnecessary b/c docker-npmjs does it for you via vhosts). Otherwise, yes, I'm 99.999 percent sure npm just uses hostname to create the url to the tarballs.

from kappa.

tj avatar tj commented on August 27, 2024

soooo weird, I've confirmed that http://registry.segment.io/s-db/-/s-db-1.0.0.tgz is what's being sent to kappa for .tarball but it still comes back as http://79789d300843:5984/s-db/-/s-db-1.0.0.tgz

from kappa.

tj avatar tj commented on August 27, 2024

OMG https://github.com/isaacs/npmjs.org/blob/master/registry/shows.js#L77
haha k dammit, finally this is starting to make sense, I guess kappa doesn't relay Host? I've got nginx passing it on (if I use .vhost nothing works at all), could we add support for X-Forwarded-Host or something?

from kappa.

tj avatar tj commented on August 27, 2024

hahha and then that fucks with https://github.com/terinjokes/docker-npmjs/blob/master/scripts/startup.sh#L2, inceptionnnn

from kappa.

totherik avatar totherik commented on August 27, 2024

Ahh, so in our installation we have most of this commented out; everything inside // legacy kludge and // end kludge

from kappa.

tj avatar tj commented on August 27, 2024

I'm going to try removing this stuff from startup.sh, should work after that i think

from kappa.

tj avatar tj commented on August 27, 2024

not sure why he does all of that when localhost works just fine, all this host magic is mind-fucking me hahaha

from kappa.

totherik avatar totherik commented on August 27, 2024

Yeah, we removed the kludge because npm generates the tarball path on the client

from kappa.

totherik avatar totherik commented on August 27, 2024

Don't make me support the kludge!! HAH!

from kappa.

totherik avatar totherik commented on August 27, 2024

How did you manage that? I swear this software works. 😬

from kappa.

tj avatar tj commented on August 27, 2024

k segment-boneyard@1f93798 fixes that last issue haha, finally a working npm registry!

from kappa.

totherik avatar totherik commented on August 27, 2024

Killer... issue filed: #13

from kappa.

tj avatar tj commented on August 27, 2024

oh cleared my npm cache and now it's broken hahahahah, might have to republish or something, been a long day yikes

from kappa.

tj avatar tj commented on August 27, 2024

ok so i can't change that vhost thing for couch now it produces the wrong tarball shit again haha, fuck it, going to fork npm

from kappa.

tj avatar tj commented on August 27, 2024

f-yeahhh

from kappa.

tj avatar tj commented on August 27, 2024

sorry for all the noise by the way haha

from kappa.

totherik avatar totherik commented on August 27, 2024

no worries at all! npm can be a PITA so we want to make it as easy as possible. If this helps flush out pain points it's not noise at all.

from kappa.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.