Git Product home page Git Product logo

gobinaries's Introduction

Go Binaries

Go Binaries is an on-demand binary server, allowing non-Go users to quickly install tools written in Go without installing go itself, and removing the burden of cross-compiling and uploading dozens of binaries for every command-line you write.

On-demand Go binary example

Usage

Install PKG with optional semver VERSION.

curl -sf https://gobinaries.com/<PKG>[@VERSION] | sh

Install PKG with optional semver VERSION to the given directory PREFIX. By default /usr/local/bin is used.

curl -sf https://gobinaries.com/<PKG>[@VERSION] | PREFIX=/tmp sh

The github.com path prefix is optional.

Examples

Install the hey HTTP benchmarking tool:

curl -sf https://gobinaries.com/rakyll/hey | sh

Install the wuzz HTTP client:

curl -sf https://gobinaries.com/asciimoo/wuzz | sh

Install the latest version of staticgen:

curl -sf https://gobinaries.com/tj/staticgen/cmd/staticgen | sh

Install the latest 1.x major version of staticgen:

curl -sf https://gobinaries.com/tj/staticgen/cmd/[email protected] | sh

Install the v1.0.0 version of triage:

curl -sf https://gobinaries.com/tj/triage/cmd/[email protected] | sh

Semver support

The following semver patterns are supported:

  • Exact version: v1.2.3, 1.2.3
  • Wildcards: v1.x, v1.2.x, 1.x, 1.2.x
  • Wildcards (implicit): v1, v1.2, 1.2
  • Leading v is optional, regardless of the Git tag

How does it work?

Take for example you want to install @rakyll's fantastic HTTP benchmarking tool hey, to install the latest release you would run:

curl -sf https://gobinaries.com/rakyll/hey | sh

This request fetches the latest tag from GitHub and responds with a shell script which performs a second request, populated with the resolved version and architecture as shown here:

https://gobinaries.com/binary/github.com/rakyll/hey?os=darwin&arch=amd64&version=v0.1.3

The response of this request is a Golang binary compiled for the requested os, architecture, and package version. The result is cached in a CDN for subsequent requests.

Limitations

  • The Go package must compile in under 100 seconds (CDN limitation)
  • The Go package must have at least one Git tag

FAQ

What's wrong with go-get? Using go-get for installation is fine if you're a Go user, however, if you're creating programs which are designed to be used by a wider audience it's unlikely they will have Go installed.
Which version of Go is used? Currently Go 1.13.x via the official golang:1.13 Docker image.

GoDoc

Sponsors

Sponsors

This project is sponsored by CTO.ai, making it easy for development teams to create and share workflow automations without leaving the command line.

And my GitHub sponsors:

gobinaries's People

Contributors

ahmgeek avatar italypaleale avatar tj avatar wallyqs avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gobinaries's Issues

keep a local list of installed stuff

Prerequisites

  • I searched to see if the issue already exists.

Description

I have my computer "as code", so I use brew to dump all things I have installed and can easily reinstall them later.

Would be nice to have a ~/.gobinaries file with something like:

rakyll/hey
tj/staticgen/cmd/[email protected]
# etc ...

so we could easily reinstall all with something like

while read -r line; do
  curl -sf "https://gobinaries.com/$line" | sh
done <~/.gobinaries

Steps to Reproduce

Slack

Join us on Slack https://chat.apex.sh/

Chain of trust

Feel free to ignore this issue, but I would like to understand what is the chain of trust of this installation method.

Why should I trust this in ANY way? What you are building here is a rootkit as a service, piped through sudo sh.

I know the immediate answer would be "If you don't trust this, do not use it", but there may be users without the expertise to understand the risks of using your product.

Would you mind to add a disclaimer to the README explaining that using your product means the user is fully trusting you not being a malicious entity?

Cache binaries

Looks like Cloudflare only propagates the cached objects with some paid service, so you get quite a few misses. To speed things up for the user we should cache the binaries Google Cloud Storage.

  • get
  • store if it doesn't exist
  • get link / redirect
  • TTL

Execute install without sudo

Prerequisites

  • I searched to see if the issue already exists.

Description

I would like users to be able to install binaries with sudo, I just want to throw the binary in the current working directory.

Fantastic work on this @tj this is going to make a HUGE difference for my project. I want users to get up and running quickly, convincing them to install Go before trying out Pion is sometimes a hurdle :)

Steps to Reproduce

curl -sf https://gobinaries.com/github.com/pion/example-webrtc-applications/twitch | PREFIX='pwd' sh wants root access when it doesn't need it.

Maybe you can make this conditional? sudo being the default still works for me!

Slack

Join us on Slack https://chat.apex.sh/

Ability to build binaries not in root directory

Prerequisites

  • I searched to see if the issue already exists.

Description

Not all projects have their main.go in the root; I would love to see some way to allow projects to specify where the entrypoint is using a .gobinaries file or something!

Steps to Reproduce

> curl -sf https://gobinaries.com/suborbital/hivew | sh

  ==> Downloading github.com/suborbital/hivew@master
  ==> Resolved version master to v0.0.1
  ==> Downloading binary for darwin amd64

  Error downloading, got 500 response from server

Slack

Join us on Slack https://chat.apex.sh/

Error downloading, got 500 response from server

Prerequisites

  • I searched to see if the issue already exists.

Description/Steps to Reproduce

curl -sf https://gobinaries.com/tj/robo | sh

  ==> Downloading github.com/tj/robo@master
  ==> Resolved version master to v0.7.0
  ==> Downloading binary for darwin arm64

  Error downloading, got 500 response from server

Post data output of uname instead of sudo sh

Prerequisites

  • I searched to see if the issue already exists.

Description

Would it be possible the change the installation procedure, and remove the need for sudo sh, by posting the result of uname to the server?

I’m thinking something like this:

uname -s | curl --data-binary @- URL

Would that work and be worthwhile?

Expose some errors

Right now v2+ fail just due to how Go modules work, but in any case it might be nice to expose some errors, otherwise it's just a silent 500 and people are probably wondering what's going on.

For example:

building: exit status 1: go: finding github.com/nats-io/nats-server v2.1.6
go: finding github.com/nats-io/nats-server v2.1.6
go: errors parsing go.mod: /home/go.mod:5: require github.com/nats-io/nats-server: version "v2.1.6" invalid: module contains a go.mod file,
so major version must be compatible: should be v0 or v1, not v2

I'm not sure what would be best here, typically not a great idea to expose internal issues.

Resolve using proxy.golang.org

As suggested on Twitter by @zachgersh, use the Go module proxy to resolve versions instead of GitHub.

  • leave the gobinaries.com/<owner>/<repo> as a shorthand for gobinaries.com/github.com/<user>/<repo>
  • Remove GitHub stuff and replace with the Go proxy
  • Add optional PROXY_URL (or similar) for your own Go proxy

Usage doesn't require sudo

Prerequisites

  • I searched to see if the issue already exists.

Description

I tried the usage examples from the README, it always failed if I used it like so:

λ ahmgeek [~] → curl -sf https://gobinaries.com/rakyll/hey | sudo sh
Password:
[3]  + 63329 done                   curl -sf https://gobinaries.com/rakyll/hey |
       63330 suspended (tty input)  sudo sh

The prompt for the password exited immediately

Fix

It worked without sudo

λ ahmgeek [~] → curl -sf https://gobinaries.com/rakyll/hey | sh

  ==> Downloading github.com/rakyll/hey@master
  ==> Resolved version master to v0.1.3
  ==> Downloading binary for darwin amd64
  ==> Installing hey to /usr/local/bin
Password:
  ==> Installation complete

Maybe remove it from the README ?

Version tags with fewer than 3 digits fail

Prerequisites

  • I searched to see if the issue already exists.

Description

Docs say it is possible to use implicit semver wildcards:

Semver support

The following semver patterns are supported:

  • Exact version: v1.2.3, 1.2.3
  • Wildcards: v1.x, v1.2.x, 1.x, 1.2.x
  • Wildcards (implicit): v1, v1.2, 1.2
  • Leading v is optional, regardless of the Git tag

That was true until the internal semver package got swapped with go-semver: 1d14a73 which has stricter semver support and does not support wildcards.

Steps to Reproduce

curl -sf https://gobinaries.com/prdpx7/notes-cli | sh

This results with error: Error: Repository has no tags while prdpx7/notes-cli definitely has v0.1 tag.

What is the correct way to go forward with this one?
Fixing docs or refactoring go-semver so it supports implicit wildcards again? 🤔

Support for v2+ of a package

Go Modules is a bit of a mess, requiring /v2 or similar in the package path, so we'll have to account for that.

escape sequence with arrow prompt in zsh shell during downloading event

Prerequisites

  • I searched to see if the issue already exists.
    Yes

Description

Escape sequence with arrow in zsh shell during downloading event
╭─sachin@legion ~
╰─➤ curl -sf https://gobinaries.com/asciimoo/wuzz | sh

\x1b[38;5;61m ==>\x1b[0;00m Downloading github.com/asciimoo/wuzz@master
\x1b[38;5;61m ==>\x1b[0;00m Resolved version master to v0.4.0
\x1b[38;5;61m ==>\x1b[0;00m Downloading binary for linux amd64
\x1b[38;5;61m ==>\x1b[0;00m Installing wuzz to /usr/local/bin
\x1b[38;5;61m ==>\x1b[0;00m Installation complete

Attached a screenshot.

Steps to Reproduce

Tested with zsh shell. Still not sure if any fancy package missing from my side.
gobinaries

Slack

Ok
Join us on Slack https://chat.apex.sh/

Go module path mismatches cause errors

Someone tried to install k8s, but it leads to this error:

exit status 1: go: github.com/kubernetes/[email protected]: parsing go.mod:
module declares its path as: k8s.io/kubectl but was required as:
github.com/kubernetes/kubectl

We can't really support vanity urls until the Go proxy is used for resolving, as suggested on Twitter.

K8s is large enough that it would probably time-out the server anyway, but this may come up again.

community server ?

are community allowed to create another server (bigger server) and run with gobinaries sub domain ?

CDN is caching errors

Prerequisites

  • I searched to see if the issue already exists.

Description

When an install fails, the CDN caches the error. Not sure if this is desirable behaviour, but it might not make sense for errors that are temporary (i.e. timeouts, network issues, etc.).

Steps to Reproduce

  1. Try to install a package that fails.
  2. Retry, the request will hit the cache (cf-cache-status: HIT, expecting a miss here).

Screen Shot 2021-04-02 at 12 01 02 AM

Slack

Join us on Slack https://chat.apex.sh/

Windows support

I don't think it works right now, probably need to chuck an .exe on there at least.

General refactor

Clean things up a bit.

  • apply a timeout to builds
  • return ReadCloser from builds instead of writing

How to uninstall software installed by gobinaries /missing docs

Hi,
I just installed a piece of software and it magically works. However I did not find any documentation on how to change (update, uninstall) software installed by gobinaires.
Of course I can just remove the binary from my filesystem, but are there any leftovers then?
Also it would be nice if there was a piece of documentation on this (what happens on my system when I install an app? How do I remove/update it?).

Missing detailed error message on 500 response

Prerequisites

  • I searched to see if the issue already exists.

Description

Got Error downloading, got 500 response from server but don't know what went wrong exactly.

Steps to Reproduce

curl -sf https://gobinaries.com/juicedata/juicesync | sh

  ==> Downloading github.com/juicedata/juicesync@master
  ==> Resolved version master to v0.1.0
  ==> Downloading binary for darwin amd64

  Error downloading, got 500 response from server

Slack

Join us on Slack https://chat.apex.sh/

Add support for using ldflags when building binary

Prerequisites

  • I searched to see if the issue already exists.

Description

It would be quite useful to be able to add some 'ldflags` when building the binary. For example I usually add a version and commit hash variable to my programs which is updated when building rather than in the code. This is extremely useful for debugging.

An example of using ldflags to set the commit global variable:

go build -ldflags "-X github.com/a/b/main.commit=$(git rev-parse --short HEAD)" .

Other tools like goreleaser also set some flags by default and allow you to customize them as I do with my notify-cli tool. This makes it so when I run notify --version from a binary generated with goreleaser I get the following:

$ notify --version
Version: v0.0.8
Commit: a8982ead528a717a05415f5cef7d7448f5adc968

But with a binary from gobinaries:

$ notify --version
Version: unknown
Commit: unknown

I wonder if adding a config file like .gobinaries.yml with the flags you want to set would be something you would welcome, if so I could help with a PR.

Commit SHA support

Currently only tags are supported, so you must have at least one release. It might be nice to resolve/support commits as well.

Faster module cache clearing

Right not it can take an easy 15s, seems like a long time, we can just remove the directory and its contents.

Needs fixes for Mac/ARM

Prerequisites

  • I searched to see if the issue already exists.

Description

When running on macOS with Apple Silicon (ARM), the script correctly identifies the environment as GOOS=darwin and GOARCH=arm64

However, that combination will not be supported until Go 1.16

  1. For now (Go 1.15), gobinaries should ignore arm64 when using darwin, and instead return the amd64 binary
  2. When Go 1.16 is out, gobinaries could be updated to support arm64

Gitlab?

Firstly, fantastic service!! It just works (as long as you have a proper version tag..!)

Description

Specify gitlab.com instead of github.com in the URL to use repo's hosted at gitlab.com.

Steps to Reproduce

wget -qO- gobinaries.com/gitlab.com/pepa65/enc |PREFIX=. sh gives:
Error: Failed to resolve requested version

Error downloading, got 500 response from server

Prerequisites

  • I searched to see if the issue already exists.

Description

When I try to install my cli tool I get this error:

$ curl -sf https://gobinaries.com/montanaflynn/gocr/cmd/gocr | sh
  ==> Downloading github.com/montanaflynn/gocr/cmd/gocr@master
  ==> Resolved version master to v0.1.0
  ==> Downloading binary for darwin amd64

  Error downloading, got 500 response from server

Building locally works: go build ./cmd/gocr

Steps to Reproduce

curl -sf https://gobinaries.com/montanaflynn/gocr/cmd/gocr | sh

is there a way to set CGO_ENABLED dynamically?

Prerequisites

  • I searched to see if the issue already exists.

Description

I am receiving the error Binary was compiled with 'CGO_ENABLED=0', go-sqlite3 requires cgo to work.

Steps to Reproduce

$ curl -sf https://gobinaries.com/hyperyuri/wallet-cli | sh

$ wallet-cli

Slack

Join us on Slack https://chat.apex.sh/

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.