Skip to content
This repository has been archived by the owner on Jul 4, 2023. It is now read-only.

ngrok: 1.6 #23732

Closed
wants to merge 1 commit into from
Closed

ngrok: 1.6 #23732

wants to merge 1 commit into from

Conversation

nebhale
Copy link
Contributor

@nebhale nebhale commented Oct 29, 2013

This formula adds support for ngrok. ngrok is an application that allows you "to securely expose a local web server to the Internet and capture all traffic for detailed introspection and replay". The formula has dependencies on Baazar, Go, and Mercurial. The application is go based and therefore uses the go compiler to build itself.

@inconshreveable
Copy link

From the original discussion here #20839, I've been given to understand that we could "bottle" ngrok for faster installation. The wiki page at https://github.com/mxcl/homebrew/wiki/Bottles seems to imply that might be happening automatically now, I'm not sure.

Any advice from the homebrew devs on whether we should do that or if you will do that automatically now would be much appreciated.

@adamv
Copy link
Contributor

adamv commented Oct 29, 2013

Why does this require bazaar and mercurial to install? Because of how it is downloading dependencies using GoBuild?

@nebhale
Copy link
Contributor Author

nebhale commented Oct 29, 2013

That is my understanding, @inconshreveable would be the authority on it though.

@inconshreveable
Copy link

@adamv Yes, that's correct. It depends on go-yaml which is hosted with bzr and also on osext and log4go which are hosted with hg. It's possible that dependencies of ngrok's dependencies may also depend on something else that require hg or bzr, but there are none that I know of.

@MikeMcQuaid
Copy link
Member

@inconshreveable Is there any way we can download them in advance? We can bottle it for you on request when we pull this.

@nebhale
Copy link
Contributor Author

nebhale commented Oct 29, 2013

@MikeMcQuaid What exactly do you mean by download them in advance? Would the formula still maintain the dependency on go (for compilation), but simply do a wget or something of tar balls for go-yaml, osext, and log4go? Are there examples of what you're trying to accomplish here?

@MikeMcQuaid
Copy link
Member

If possible we like to have install work without an internet connection and have Homebrew download and cache the various files. If that's not workable, no worries.

@nebhale
Copy link
Contributor Author

nebhale commented Oct 30, 2013

Is there an API that a formula can call that causes Homebrew to download and cache, or would anything that is currently downloaded need to be handled as other formula and then dependent on?

@inconshreveable
Copy link

@MikeMcQuaid So, I'm not entirely sure I understand what you're asking, but if the goal is to make installation happen without downloading anything, you have a couple of options:

  1. You could "bottle" the ngrok binary. Once ngrok is compiled, it produces a binary with zero runtime dependencies that will simply run. The downside is that the binary is kinda big (~7MB, but it compresses down to 2MB with gzip)

  2. If you're intent on actually compiling it without access to the interwebs, you can ask ngrok to pre-fetch its dependencies with:

    make deps
    

This will fetch (almost) all of the dependencies need to compile ngrok without downloading anything from the internet. Note: you'll need to have golang/bzr/hg installed to run "make deps". I can fix the "almost" part of this if that's the route you want to go down.

One other thing to note is that the golang community currently hasn't picked a direction on how to do dependency management. There are a couple options that are gaining traction, but nothing widely accepted yet. This means that ngrok could conceivably start failing to compile if any of them change their API since it basically always builds against "head" of all dependencies. I have a TODO item to evaluate options around this but I haven't gotten to it yet.

@MikeMcQuaid
Copy link
Member

@inconshreveable We can bottle it, yep. If we can't make it outside the install method then don't worry. That they build against head versions every time I'm a bit nervous about though. @adamv @mistydemeo @jacknagel @manphiz, thoughts?

@inconshreveable
Copy link

@MikeMcQuaid It makes me nervous too. It hasn't burned me yet, but it's only a matter of time. I have other higher priority things to take care of right now, but let me know if this is a showstopper and I'll try to focus on it sooner.

@manphiz
Copy link
Contributor

manphiz commented Oct 30, 2013

Maybe ngrok can bundle some working snapshots of those dependencies, which seems easier. Though it should be careful to install them to private locations to avoid future conflicts if they get included. @inconshreveable how do you think?

@mistydemeo
Copy link
Member

Is there an API that a formula can call that causes Homebrew to download and cache, or would anything that is currently downloaded need to be handled as other formula and then dependent on?

Yes, formulae can define resources that Homebrew will manage downloading and caching, and which can be called within the formula itself whenever desired. For example, take a look at the smlnj formula which defines resources, then stages them within the temporary build directory.

@@ -0,0 +1,26 @@
require 'formula'
require 'requirement'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't need to require requirement

@jaredmoody
Copy link
Contributor

I'd prefer a bottle, bazaar is taking a long time to download/install as I write this.

@adamv
Copy link
Contributor

adamv commented Dec 10, 2013

I'm still not a fan of the fact that this pulls down unversioned dependencies with go get, but I'll let another maintainer accept or reject.

Otherwise it looks fine.

@MikeMcQuaid
Copy link
Member

Let's bottle it.

@adamv
Copy link
Contributor

adamv commented Dec 10, 2013

(My concern specifically is that if an unversioned dependency changes in a way that breaks a downstream project, we're the ones who will get bug reports about it not building.)

@adamv
Copy link
Contributor

adamv commented Dec 10, 2013

I'm OK with it being bottled.


depends_on 'bazaar' => :build
depends_on 'go' => :build
depends_on MercurialDependency => :build
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should just be depends_on :hg => :build.

@inconshreveable
Copy link

There's no "real" test command with ngrok mostly because ngrok's primary function involves reaching an external service. If the network is down (or the service is down), the command would fail even if the installation technically was successful.

@adamv I also don't like that's pulling unversioned dependencies. I'd like to fix this and have just been really short on time. I'll try to get that set up ASAP for you guys. It will also might eliminate the dependencies on hg/bzr when I do it, so that would be a win as well.

This formula adds support for ngrok[1].  ngrok is an application that
allows you "to securely expose a local web server to the Internet and
capture all traffic for detailed introspection and replay".  The
formula has build dependencies on Baazar, Go, and Mercurial.  The
application is go based and therefore uses the go compiler to build
itself.

[1]: https://ngrok.com
@nebhale
Copy link
Contributor Author

nebhale commented Dec 11, 2013

@MikeMcQuaid I've updated mercurial dependency as requested. I'm open to a more robust test but as @inconshreveable mentions, there's a lot of room for false negatives. Is there an example of another formula (for a product that makes a connection to a web-service) that I should use as inspiration?

@MikeMcQuaid
Copy link
Member

I'd rather a false-negative than a test that does nothing except print a string. If there's something you can do that will work assuming the service and internet connection are both up: great.

@Miserlou
Copy link

Any progress on this issue?

@inconshreveable
Copy link

Sorry, haven't gotten to this yet. Will try to hammer this out today for you guys.

@MikeMcQuaid
Copy link
Member

Any news on this?

@taoeffect
Copy link

Status?

@MikeMcQuaid
Copy link
Member

@taoeffect If you want to speed things up create your own PR with the requested changes.

@jacknagel
Copy link
Contributor

Closing in favor of #23732

@jacknagel jacknagel closed this Apr 3, 2014
@caifara
Copy link

caifara commented Apr 3, 2014

I guess @jacknagel meant in favor of #27598

@Homebrew Homebrew locked and limited conversation to collaborators Feb 17, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.