Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Make binary available via OS distribution repositories #3

Closed
UmanShahzad opened this issue Jan 28, 2021 · 39 comments
Closed

Make binary available via OS distribution repositories #3

UmanShahzad opened this issue Jan 28, 2021 · 39 comments

Comments

@UmanShahzad
Copy link
Contributor

We can distribute the binary for each platform via Github initially so it can be installed with curl/wget/etc, but it'd be even better if developers (the most likely users here) could grab it via their OS distributor's package repo. This could give us auto-completion automatically as well without a separate install step for that.

We can start with making it available via Ubuntu's package repos first, and/or make our own PPA.

I don't use macOS so not sure of the distribution model there (I think most people use Homebrew?), but we can look into that afterwards.

@coderholic
Copy link
Member

Yeah homebrew is super common on osx - it'd be great to be able to do brew install ipinfo - not sure how to create packages, but the homepage is at https://brew.sh/

@UmanShahzad
Copy link
Contributor Author

Thanks for the link.

I did a quick look and it looks like we need to:

  1. Write a "Formula" (a ruby file that builds & installs the binary after downloading the codebase), similar to this random formula I found which is also for a Golang binary.
  2. Make a PR for it against https://github.com/Homebrew/homebrew-core.

So it looks quite doable!

@UmanShahzad
Copy link
Contributor Author

UmanShahzad commented Mar 18, 2021

Since we will likely be releasing 1.0.0 soon, I'll look into this next.

(Even if we don't get to this in 1.0.0 though, the prebuilt binaries are available from github releases as documented in https://github.com/ipinfo/cli#using-curlwget (note that this won't work until the repo is made public, of course)).

@UmanShahzad
Copy link
Contributor Author

UmanShahzad commented Mar 26, 2021

So for the Homebrew upload, we need to make the repo public first, because things get built on-the-fly AFAICT, and we need the source code from a public URL for that.

For Ubuntu, I've supported including a .deb file in all releases, but getting it in the official repos seems much more involved so I'm punting that for a bit since there are already 2-3 easy installation methods for Ubuntu users.

@UmanShahzad
Copy link
Contributor Author

Now that the repo is public I'll try to make this available in Homebrew.

Making it available in official Linux distributions is gonna be a much harder task, and likely not worth it when you can just curl or wget the binary, so we probably shouldn't bother.

@UmanShahzad
Copy link
Contributor Author

UmanShahzad commented Apr 21, 2021

Well this is annoying: someone already took the name "ipinfo" in the official Homebrew repo: https://github.com/Homebrew/homebrew-core/blob/master/Formula/ipinfo.rb

Not sure what else we could name it. I think we'll need to use a custom "Tap" and put our own formula there.

https://github.com/Homebrew/brew/blob/master/docs/How-to-Create-and-Maintain-a-Tap.md
https://github.com/Homebrew/brew/blob/master/docs/Formula-Cookbook.md

@st-polina
Copy link
Contributor

@UmanShahzad we use ipinfoio on Twitter as an alternative to ipinfo if it helps :)

@UmanShahzad
Copy link
Contributor Author

UmanShahzad commented Apr 22, 2021

@st-polina We can try that yeah, but the binary's name is actually ipinfo so it will conflict with the existing formula which outputs it as ipinfo too. There's no requirement that the binary name be ipinfo though so we could still output as ipinfoio.

At this point I'm just thinking it might be 10x better to just create a single script that the user downloads and it gets automatically run, and then it downloads the appropriate binary on its own regardless of platform (Windows would still be different though).

@mbierman
Copy link

mbierman commented May 4, 2021

@UmanShahzad i disagree that a script would be better. Homebrew isn’t just the standard for macOS installation. It keeps things up to date complete with dependencies. I run a script regularly to update all my homebrew packages and apps. I personally don’t care if the name is ideal. Having a homebrew install would be extremely nice.

@UmanShahzad
Copy link
Contributor Author

@mbierman that's a good point, thanks for the feedback. That mostly settles it then for me, I'd say: let's try to get this on Homebrew even if under a different name.

@mbierman
Copy link

mbierman commented May 4, 2021

Thanks, @UmanShahzad!

@yermulnik
Copy link

Also please consider adding an option for installation via go get …

@UmanShahzad
Copy link
Contributor Author

@yermulnik It should work already: https://github.com/ipinfo/cli#using-go-get

@karlhorky
Copy link

karlhorky commented May 5, 2021

If this works on Windows as well, I would recommend making available on Chocolatey and winget.

@UmanShahzad
Copy link
Contributor Author

It definitely works, and will look into that, thanks!

@yermulnik
Copy link

@yermulnik It should work already: https://github.com/ipinfo/cli#using-go-get

oops, apologies, somehow I missed that bit 🤦 thanks a lot for the pointer 🙇

@UmanShahzad
Copy link
Contributor Author

@yermulnik Oh no you didn't miss it, I just added it because you mentioned it :) Thanks to you!

@hellopablo
Copy link

My suggestion for the homebrew formula name: ipinfo-cli; I don't think that has to translate into the binary name. You can define conflicting formulae, too.

@mbierman
Copy link

mbierman commented May 5, 2021

@UmanShahzad please post here when Homebrew is ready and I'll give it a try.

@hellopablo I prefer ipinfo.io but I don't care that much.

@yermulnik
Copy link

yermulnik commented May 5, 2021

@UmanShahzad please post here when Homebrew is ready and I'll give it a try.

+1. I'd like it via Homebrew for both Mac and Linux and can test on both.

@UmanShahzad
Copy link
Contributor Author

Thanks guys, I'll ping you when we have something. I'll try working on getting it on Homebrew one way or another over the weekend.

@UmanShahzad
Copy link
Contributor Author

UmanShahzad commented May 10, 2021

For anyone with homebrew, please try this and let me know if it works (it works for me on macos & linux):

brew install ipinfo/tap/ipinfo-cli

# optionally:
brew install ipinfo/tap/grepip

ref: https://github.com/ipinfo/cli#macos

FYI this is not from the homebrew/core tap, for several reasons: 1. it is "frowned upon" according to their docs for the "vendor" (i.e. us) to be maintaining the formula in their official repo 🤷‍♂️ 2. they may take a while to get back to us and slow to keep things updated. So, we're using our own tap at https://github.com/ipinfo/homebrew-tap.

@hellopablo
Copy link

Works perfectly on macOS 11.3 👏

@mbierman
Copy link

Seems good on macOS 10.15.7.

@yermulnik
Copy link

yermulnik commented May 10, 2021

For anyone with homebrew, please try this and let me know if it works (it works for me on macos & linux):

Works great on Linux Mint 18.3 Sylvia x86_64 and macOS Catalina 10.15.7 19H1030 x86_64. Thanks a LOT!

I'd also suggest to compliment these packages with bash (maybe also zsh/fish) completion. https://github.com/posener/complete seems to be the most popular Go package to add an option to go-based tool to bash-complete itself.

UPD: it's already being tracked in #5

@UmanShahzad
Copy link
Contributor Author

Thanks a lot for checking guys, going to close this issue and track windows/linux package managers specifically in #30 and #31 respectively.

@coderholic
Copy link
Member

Not a smooth install for me...

$ brew install ipinfo/tap/ipinfo-cli
==> Installing ipinfo-cli from ipinfo/tap
==> Downloading https://ghcr.io/v2/homebrew/core/go/manifests/1.16.3
Already downloaded: /Users/bendowling/Library/Caches/Homebrew/downloads/a0c7d5540c8c88f612cedc7d9af128deb15aa152ce0b0f2e1bcd3d8f235020f5--go-1.16.3.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/go/blobs/sha256:69c28f5e60612801c66e51e93d32068f822b245ab83246cb6cb374572eb59e15
Already downloaded: /Users/bendowling/Library/Caches/Homebrew/downloads/d74822e0d6c473f04ff2856cab284c0f3a55bc4edbd09f63f4c542a528d0495e--go--1.16.3.catalina.bottle.tar.gz
==> Downloading https://github.com/ipinfo/cli/archive/ipinfo-1.1.1.tar.gz
Already downloaded: /Users/bendowling/Library/Caches/Homebrew/downloads/2e7919969ed33530ce59bd398c2d5012d7595682b0647299d98ee8ee9cce00a0--cli-ipinfo-1.1.1.tar.gz
Error: The following formula cannot be installed from bottle and must be
built from source.
  ipinfo-cli
Install the Command Line Tools:
  xcode-select --install

After doing the xcode-select install it worked...

$ brew install ipinfo/tap/ipinfo-cli
==> Installing ipinfo-cli from ipinfo/tap
==> Downloading https://ghcr.io/v2/homebrew/core/go/manifests/1.16.3
Already downloaded: /Users/bendowling/Library/Caches/Homebrew/downloads/a0c7d5540c8c88f612cedc7d9af128deb15aa152ce0b0f2e1bcd3d8f235020f5--go-1.16.3.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/go/blobs/sha256:69c28f5e60612801c66e51e93d32068f822b245ab83246cb6cb374572eb59e15
Already downloaded: /Users/bendowling/Library/Caches/Homebrew/downloads/d74822e0d6c473f04ff2856cab284c0f3a55bc4edbd09f63f4c542a528d0495e--go--1.16.3.catalina.bottle.tar.gz
==> Downloading https://github.com/ipinfo/cli/archive/ipinfo-1.1.1.tar.gz
Already downloaded: /Users/bendowling/Library/Caches/Homebrew/downloads/2e7919969ed33530ce59bd398c2d5012d7595682b0647299d98ee8ee9cce00a0--cli-ipinfo-1.1.1.tar.gz
==> Installing dependencies for ipinfo/tap/ipinfo-cli: go
==> Installing ipinfo/tap/ipinfo-cli dependency: go
==> Pouring go--1.16.3.catalina.bottle.tar.gz
🍺  /usr/local/Cellar/go/1.16.3: 9,955 files, 503.5MB
==> Installing ipinfo/tap/ipinfo-cli
==> ./ipinfo/build.sh
🍺  /usr/local/Cellar/ipinfo-cli/1.1.1: 5 files, 7.3MB, built in 5 seconds

How can we have it "installed from bottle"? And ideally it should be possible to brew install ipinfo-cli instead of needking to know about our tap. How can we get that setup @UmanShahzad ?

@coderholic coderholic reopened this May 12, 2021
@UmanShahzad
Copy link
Contributor Author

UmanShahzad commented May 12, 2021

@coderholic Installing from a "bottle" means installing the binary directly without a build step, but that means doing a ton of CI for lots of different macos versions (and linux for linuxbrew users) to auto-build and auto-update the SHA-256 checksums of each binary for each platform, and upload them to github (this has some other complications - it's not a github "release" like we do in this repo). It's possible to do, will just take quite some more time.

This can be simplified if we were on the official Homebrew tap because they already have all this CI set up, but it may take a while to get accepted by them.

In the interest of getting this available to our users right now I've made our own tap. But if we really want installations to be possible via "bottles", then we'd best try to get this on the official tap. Homebrew has a "tap migration" feature so that once it's available on the official tap, all users on our current tap can automatically get migrated over there.

Edit: what do you think is the best way forward?

@yermulnik
Copy link

JFYI: have just successfully upgraded ipinfo-cli from 1.1.1 to 1.1.2 on both MacOS and Linux 🥳

@UmanShahzad
Copy link
Contributor Author

@yermulnik Good to know that upgrades are working as intended, thank you!

@UmanShahzad
Copy link
Contributor Author

Made Homebrew/homebrew-core#77280 to try and get this into the official tap now.

@UmanShahzad
Copy link
Contributor Author

Now available on the official homebrew tap:

brew install ipinfo-cli

Will get the remaining formulas up there as well e.g. for grepip.

@yermulnik
Copy link

Now available on the official homebrew tap:

👍 Anything we should do to adhere to this change? Like re-installing?

@UmanShahzad
Copy link
Contributor Author

@yermulnik You'll automatically get migrated to the official version, nothing special to do! Just use ipinfo-cli instead of ipinfo/tap/ipinfo-cli whenever you upgrade.

You can remove the old tap if you don't want it: brew untap ipinfo/tap

@yermulnik
Copy link

Got that! Thanks @UmanShahzad
Will keep the old tap unless you've got grepip moved to the official brew formulaes repo. Or even for any new tool you may add to it in future =)

@UmanShahzad
Copy link
Contributor Author

Yes sure, will notify when grepip is on Homebrew, then will close this issue.

Homebrew/homebrew-core#77397 is the PR for grepip.

@mbierman
Copy link

Thank you @UmanShahzad !

@UmanShahzad
Copy link
Contributor Author

If you are using grepip then this should work going forward:

brew install grepip

@yermulnik
Copy link

Thank you @UmanShahzad !

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants