ngrok: 1.6 #23732

Closed
wants to merge 1 commit into
from

Projects

None yet
@nebhale
Contributor
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.

@nebhale nebhale referenced this pull request in inconshreveable/ngrok Oct 29, 2013
Closed

Packaging #45

@inconshreveable

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
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
Contributor
nebhale commented Oct 29, 2013

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

@inconshreveable

@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
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
Contributor
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
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
Contributor
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

@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
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

@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
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
Contributor

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.

@adamv adamv commented on an outdated diff Nov 18, 2013
Library/Formula/ngrok.rb
@@ -0,0 +1,26 @@
+require 'formula'
+require 'requirement'
@adamv
adamv Nov 18, 2013 Contributor

Don't need to require requirement

@mistydemeo mistydemeo and 2 others commented on an outdated diff Nov 18, 2013
Library/Formula/ngrok.rb
@@ -0,0 +1,26 @@
+require 'formula'
+require 'requirement'
+
+class Ngrok < Formula
+ homepage 'https://ngrok.com'
+ url 'https://github.com/inconshreveable/ngrok/archive/1.6.tar.gz'
+ sha1 '03d076bfe078ebe52c0c81dfa1e49b497e7295fa'
+
+ depends_on 'bazaar' => :build
+ depends_on 'go' => :build
+ depends_on MercurialDependency => :build
+
+ fails_with :clang do
@mistydemeo
mistydemeo Nov 18, 2013 Contributor

I assume this doesn't build under more recent clang either? Can it be made to build under clang? We're unlikely to accept new formulae that don't.

@mistydemeo
mistydemeo Nov 18, 2013 Contributor

Ignore that, missed that this is because of the go dep.

@adamv
adamv Dec 9, 2013 Contributor

Has this been fixed with the release of go 1.2?

@nebhale
nebhale Dec 10, 2013 Contributor

It has been. I'll submit an updated PR with it removed.

@jaredmoody
Contributor

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

@adamv
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
Member

Let's bottle it.

@adamv
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
Contributor
adamv commented Dec 10, 2013

I'm OK with it being bottled.

@MikeMcQuaid MikeMcQuaid commented on an outdated diff Dec 10, 2013
Library/Formula/ngrok.rb
@@ -0,0 +1,22 @@
+require 'formula'
+
+class Ngrok < Formula
+ homepage 'https://ngrok.com'
+ url 'https://github.com/inconshreveable/ngrok/archive/1.6.tar.gz'
+ sha1 '03d076bfe078ebe52c0c81dfa1e49b497e7295fa'
+
+ head 'https://github.com/inconshreveable/ngrok.git', :branch => 'master'
+
+ depends_on 'bazaar' => :build
+ depends_on 'go' => :build
+ depends_on MercurialDependency => :build
@MikeMcQuaid
MikeMcQuaid Dec 10, 2013 Member

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

@MikeMcQuaid MikeMcQuaid commented on the diff Dec 10, 2013
Library/Formula/ngrok.rb
+ url 'https://github.com/inconshreveable/ngrok/archive/1.6.tar.gz'
+ sha1 '03d076bfe078ebe52c0c81dfa1e49b497e7295fa'
+
+ head 'https://github.com/inconshreveable/ngrok.git', :branch => 'master'
+
+ depends_on 'bazaar' => :build
+ depends_on 'go' => :build
+ depends_on MercurialDependency => :build
+
+ def install
+ system 'make', 'release-client'
+ bin.install 'bin/ngrok'
+ end
+
+ test do
+ system "#{bin}/ngrok", 'version'
@MikeMcQuaid
MikeMcQuaid Dec 10, 2013 Member

Any chance of a test that actually does something?

@inconshreveable

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.

@nebhale nebhale ngrok: 1.6
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
9143e23
@nebhale
Contributor
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
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

Any progress on this issue?

@inconshreveable

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

@egrim egrim referenced this pull request in Homebrew/homebrew-binary Jan 20, 2014
Closed

Add binary formula for 'ngrok' #58

@MikeMcQuaid
Member

Any news on this?

@taoeffect

Status?

@MikeMcQuaid
Member

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

@jacknagel
Contributor

Closing in favor of #23732

@jacknagel jacknagel closed this Apr 3, 2014
@caifara
caifara commented Apr 3, 2014

I guess @jacknagel meant in favor of #27598

@xu-cheng xu-cheng 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.