Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

ngrok: 1.6 #23732

Closed
wants to merge 1 commit into from

11 participants

Ben Hale Alan Shreve Adam Vandenberg Mike McQuaid Xiyue Deng Misty De Meo Jared Moody Rich Jones Greg Slepak Jack Nagel Ivo Dancet
Ben Hale

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.

Ben Hale nebhale referenced this pull request in inconshreveable/ngrok
Closed

Packaging #45

Alan Shreve

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.

Adam Vandenberg
Owner

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

Ben Hale

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

Alan Shreve

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

Mike McQuaid
Owner

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

Ben Hale

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

Mike McQuaid
Owner

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.

Ben Hale

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?

Alan Shreve

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

Mike McQuaid
Owner

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

Alan Shreve

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

Xiyue Deng
Collaborator

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?

Misty De Meo
Owner

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.

Library/Formula/ngrok.rb
@@ -0,0 +1,26 @@
+require 'formula'
+require 'requirement'
Adam Vandenberg Owner
adamv added a note

Don't need to require requirement

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Misty De Meo Owner

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.

Misty De Meo Owner

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

Adam Vandenberg Owner
adamv added a note

Has this been fixed with the release of go 1.2?

Ben Hale
nebhale added a note

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Jared Moody

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

Adam Vandenberg
Owner

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.

Mike McQuaid
Owner

Let's bottle it.

Adam Vandenberg
Owner

(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.)

Adam Vandenberg
Owner

I'm OK with it being bottled.

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
Mike McQuaid Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Mike McQuaid mikemcquaid commented on the diff
Library/Formula/ngrok.rb
((5 lines not shown))
+ 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'
Mike McQuaid Owner

Any chance of a test that actually does something?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Alan Shreve

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.

Ben Hale 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
Ben Hale

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

Mike McQuaid
Owner

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.

Rich Jones

Any progress on this issue?

Alan Shreve

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

Evan Grim egrim referenced this pull request in Homebrew/homebrew-binary
Closed

Add binary formula for 'ngrok' #58

Mike McQuaid
Owner

Any news on this?

Greg Slepak

Status?

Mike McQuaid
Owner

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

Jack Nagel
Owner

Closing in favor of #23732

Jack Nagel jacknagel closed this
Ivo Dancet

I guess @jacknagel meant in favor of #27598

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 11, 2013
  1. Ben Hale

    ngrok: 1.6

    nebhale authored
    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
This page is out of date. Refresh to see the latest.
Showing with 22 additions and 0 deletions.
  1. +22 −0 Library/Formula/ngrok.rb
22 Library/Formula/ngrok.rb
View
@@ -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 :hg => :build
+
+ def install
+ system 'make', 'release-client'
+ bin.install 'bin/ngrok'
+ end
+
+ test do
+ system "#{bin}/ngrok", 'version'
Mike McQuaid Owner

Any chance of a test that actually does something?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ end
+end
Something went wrong with that request. Please try again.