Skip to content

Commit 6f7e1a7

Browse files
committed
update README.md to enhance clarity and structure; introduce new features section, quick start guide, and detailed usage examples for installing binaries from GitHub releases
1 parent 99022e5 commit 6f7e1a7

File tree

1 file changed

+179
-118
lines changed

1 file changed

+179
-118
lines changed

README.md

Lines changed: 179 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -1,175 +1,236 @@
1+
# Installer - Quick Installation Tool for GitHub Release Binaries
12

2-
# `installer`
3-
4-
Quickly install pre-compiled binaries from Github releases.
5-
6-
Installer is an HTTP server which returns shell scripts. The returned script will detect platform OS and architecture, choose from a selection of URLs, download the appropriate file, un(zip|tar|gzip) the file, find the binary (largest file) and optionally move it into your `PATH`. Useful for installing your favourite pre-compiled programs on hosts using only `curl`.
3+
An intelligent HTTP service for quickly installing pre-compiled binaries from GitHub Releases. It automatically detects your system platform (OS and architecture), selects the appropriate asset, downloads, extracts, and optionally moves it to your system PATH.
74

85
[![GoDev](https://img.shields.io/static/v1?label=godoc&message=reference&color=00add8)](https://pkg.go.dev/github.com/jpillora/installer)
96
[![CI](https://github.com/jpillora/installer/workflows/CI/badge.svg)](https://github.com/jpillora/installer/actions?workflow=CI)
107

11-
## Cloudflare Workers
8+
## Features
129

13-
### Install
10+
- 🚀 **One-Command Installation**: Install GitHub Release binaries directly via `curl`
11+
- 🔍 **Smart Search**: Automatically searches the web for repositories when not found
12+
- 🎯 **Platform Detection**: Auto-detects OS (Linux, macOS, BSD, etc.) and architecture (amd64, arm64, 386, etc.)
13+
- 📦 **Multiple Format Support**: Supports `.zip`, `.tar.gz`, `.tar.bz2`, `.tar.xz`, `.gz`, `.bz2` and more
14+
- 🎭 **Multi-Binary Support**: Install multiple binaries from a single release
15+
- ☁️ **Cloudflare Workers**: Deploy as Cloudflare Workers for global edge acceleration
16+
- 🔒 **Private Repository Support**: Access private repos via `GITHUB_TOKEN`
1417

15-
- [Install Wrangler](https://developers.cloudflare.com/workers/wrangler/install-and-update/)
16-
- [Install Tiny Go](https://tinygo.org/getting-started/install/)
17-
- Install quicktemplate QTC
18-
```sh
19-
go install github.com/valyala/quicktemplate/qtc@latest
18+
## Quick Start
19+
20+
### Basic Usage
21+
22+
```bash
23+
# Install a repository (to current directory)
24+
curl https://your-domain.workers.dev/user/repo | bash
25+
26+
# Install to /usr/local/bin/ (use the ! suffix)
27+
curl https://your-domain.workers.dev/user/repo! | bash
28+
29+
# Install a specific version
30+
curl https://your-domain.workers.dev/user/[email protected]! | bash
31+
32+
# Use repository name only (will attempt search)
33+
curl https://your-domain.workers.dev/micro! | bash
2034
```
2135

22-
### Deploy
36+
### Install Multiple Binaries
2337

24-
```sh
25-
wrangler deploy
38+
```bash
39+
# Install both client and server from one release
40+
curl https://your-domain.workers.dev/xtaci/kcptun!?mp=client,server | bash
2641
```
2742

28-
### Call Workers
43+
## Usage
2944

30-
- Support multiple binaries, support both exact and fuzzy matching for files
45+
### URL Format
3146

32-
```sh
33-
# mp means multi program
34-
# mp fuzzy matching: client_linux_amd64, you can just input client
35-
curl https://your-workers-domain.workers.dev/xtaci/kcptun!?mp=client,server | bash
36-
mv /usr/local/bin/client /usr/local/bin/kcptun_client
37-
mv /usr/local/bin/server /usr/local/bin/kcptun_server
38-
/usr/local/bin/kcptun_client -v
39-
/usr/local/bin/kcptun_server -v
40-
# exact matching, only install sslocal and ssserver
41-
curl https://xxx-yyy.zzz.workers.dev/shadowsocks/shadowsocks-rust!?mp=sslocal,ssserver | bash
42-
mv /usr/local/bin/sslocal /usr/local/bin/ss_client
43-
mv /usr/local/bin/ssserver /usr/local/bin/ss_server
44-
/usr/local/bin/ss_client -V
45-
/usr/local/bin/ss_server -V
47+
```
48+
https://your-domain.workers.dev/<user>/<repo>@<release>!?<parameters>
4649
```
4750

51+
### Path Parameters
4852

49-
## Usage
53+
- `user` - GitHub username (optional, uses default if omitted)
54+
- `repo` - Repository name (required)
55+
- `release` - Release version (optional, defaults to `latest`)
56+
- `!` - Install to `/usr/local/bin/` (optional, without it installs to current directory)
57+
58+
### Query Parameters
59+
60+
| Parameter | Description | Example |
61+
|-----------|-------------|---------|
62+
| `mp` | Install multiple programs (comma-separated) | `?mp=client,server` |
63+
| `as` | Rename the binary | `?as=rg` |
64+
| `os` | Override OS detection | `?os=linux` |
65+
| `arch` | Override architecture detection | `?arch=arm64` |
66+
| `type` | Output format (`script`, `json`, `text`) | `?type=json` |
67+
| `select` | Select specific asset variant | `?select=musl` |
68+
| `insecure` | Skip SSL verification | `?insecure=1` |
69+
70+
## Examples
71+
72+
### Install micro Editor
5073

51-
```sh
52-
# install <user>/<repo> from github
53-
curl https://i.jpillora.com/<user>/<repo>@<release>! | bash
74+
```bash
75+
curl https://your-domain.workers.dev/zyedidia/micro! | bash
76+
micro --version
5477
```
5578

56-
```sh
57-
# search web for github repo <query>
58-
curl https://i.jpillora.com/<query>! | bash
79+
### Install Caddy Web Server
80+
81+
```bash
82+
curl https://your-domain.workers.dev/caddyserver/[email protected]! | bash
83+
caddy version
5984
```
6085

61-
*Or you can use* `wget -qO- <url> | bash`
86+
### Install and Rename ripgrep
6287

63-
**Path API**
88+
```bash
89+
curl https://your-domain.workers.dev/BurntSushi/ripgrep!?as=rg | bash
90+
rg --version
91+
```
6492

65-
* `user` Github user (defaults to @jpillora, customisable if you [host your own](#host-your-own), searches the web to pick most relevant `user` when `repo` not found)
66-
* `repo` Github repository belonging to `user` (**required**)
67-
* `release` Github release name (defaults to the **latest** release)
68-
* `!` When provided, downloads binary directly into `/usr/local/bin/` (defaults to working directory)
93+
### Install Multiple Binaries (kcptun)
6994

70-
**Query Params**
95+
```bash
96+
curl https://your-domain.workers.dev/xtaci/kcptun!?mp=client,server | bash
97+
mv /usr/local/bin/client /usr/local/bin/kcptun-client
98+
mv /usr/local/bin/server /usr/local/bin/kcptun-server
99+
```
71100

72-
* `?type=` Force the return type to be one of: `script` or `homebrew`
73-
* `type` is normally detected via `User-Agent` header
74-
* `type=homebrew` is **not** working at the moment – see [Homebrew](#homebrew)
75-
* `?insecure=1` Force `curl`/`wget` to skip certificate checks
76-
* `?as=` Force the binary to be named as this parameter value
77-
* `?os=` Explicit set OS (ignore system OS)
78-
* `?arch=` Explicit set architecture (ignore system arch)
101+
### Install shadowsocks-rust
79102

80-
## Security
103+
```bash
104+
curl https://your-domain.workers.dev/shadowsocks/shadowsocks-rust!?mp=sslocal,ssserver | bash
105+
```
81106

82-
:warning: Although I promise [my instance of `installer`](https://i.jpillora.com/) is simply a copy of this repo - you're right to be wary of piping shell scripts from unknown servers, so you can host your own server [here](#host-your-own) or just leave off `| bash` and checkout the script yourself.
107+
### Use in Docker
83108

84-
## Examples
109+
```dockerfile
110+
FROM ubuntu:22.04
111+
RUN apt-get update && apt-get install -y curl
112+
RUN curl https://your-domain.workers.dev/zyedidia/micro! | bash
113+
CMD ["/bin/bash"]
114+
```
85115

86-
* https://i.jpillora.com/serve
87-
* https://i.jpillora.com/cloud-torrent
88-
* https://i.jpillora.com/yudai/[email protected]
89-
* https://i.jpillora.com/mholt/caddy
90-
* https://i.jpillora.com/caddy
91-
* https://i.jpillora.com/rclone
92-
* https://i.jpillora.com/ripgrep?as=rg
116+
### Debug Installation
93117

94-
```sh
95-
$ curl -s i.jpillora.com/mholt/caddy! | bash
96-
Downloading mholt/caddy v0.8.2 (https://github.com/mholt/caddy/releases/download/v0.8.2/caddy_darwin_amd64.zip)
97-
######################################################################## 100.0%
98-
Downloaded to /usr/local/bin/caddy
99-
$ caddy --version
100-
Caddy 0.8.2
101-
```
118+
```bash
119+
# View script without executing
120+
curl https://your-domain.workers.dev/jpillora/serve
102121

103-
## Private repos
122+
# Run with debug output
123+
DEBUG=1 curl https://your-domain.workers.dev/jpillora/serve! | bash
104124

105-
You'll have to set `GITHUB_TOKEN` on both your server (instance of `installer`) and client (before you run `curl https://i.jpillora.com/foobar | bash`)
125+
# Get JSON asset information
126+
curl "https://your-domain.workers.dev/jpillora/serve?type=json"
127+
```
106128

107-
See https://github.com/jpillora/installer/issues/31 for how this could improved
129+
## Deployment
108130

109-
## Host your own
131+
### Cloudflare Workers (Recommended)
110132

111-
* Install installer with installer
133+
#### Prerequisites
112134

113-
```sh
114-
curl -s https://i.jpillora.com/installer | bash
115-
```
135+
```bash
136+
# Install Wrangler CLI
137+
npm install -g wrangler
116138

117-
* Install from source
139+
# Install TinyGo
140+
brew install tinygo # macOS
118141

119-
```sh
120-
go get github.com/jpillora/installer
121-
```
142+
# Install quicktemplate
143+
go install github.com/valyala/quicktemplate/qtc@latest
144+
```
122145

123-
* Install on [Fly.io](https://fly.io)
146+
#### Configure
124147

125-
* Clone this repo
126-
* Setup the `fly` CLI tool
127-
* Create a new app
128-
* Replace `app = "installer"` in `fly.toml` with your app name
129-
* Run `fly deploy`
148+
Edit `wrangler.jsonc`:
130149

131-
## Force a particular `user/repo`
150+
```jsonc
151+
{
152+
"vars": {
153+
"DEFAULT_USER": "your-github-username",
154+
"GITHUB_TOKEN": "ghp_xxxxx" // Optional
155+
}
156+
}
157+
```
132158

133-
In some cases, people want an installer server for a single tool
159+
#### Deploy
134160

135-
```sh
136-
export FORCE_USER=zyedidia
137-
export FORCE_REPO=micro
138-
./installer
161+
```bash
162+
make build
163+
wrangler deploy
139164
```
140165

141-
Then calls to `curl localhost:3000` will return the install script for `zyedidia/micro`
166+
### Fly.io
142167

143-
### Homebrew
168+
```bash
169+
fly auth login
170+
fly deploy
171+
```
172+
173+
### Run Locally
174+
175+
```bash
176+
# Install dependencies
177+
go mod download
144178

145-
Currently, installing via Homebrew does not work. Homebrew was intended to be supported with:
179+
# Run
180+
go run main.go
146181

182+
# Or with custom config
183+
PORT=8080 USER=myusername go run main.go
147184
```
148-
#does not work
149-
brew install https://i.jpillora.com/serve
185+
186+
#### Environment Variables
187+
188+
| Variable | Description | Default |
189+
|----------|-------------|---------|
190+
| `PORT` | Listen port | `3000` |
191+
| `USER` / `DEFAULT_USER` | Default GitHub user | `cxjava` |
192+
| `GITHUB_TOKEN` | GitHub API token (optional) | - |
193+
| `FORCE_USER` | Lock to specific user (optional) | - |
194+
| `FORCE_REPO` | Lock to specific repo (optional) | - |
195+
196+
## Supported Platforms
197+
198+
### Operating Systems
199+
Linux, macOS, FreeBSD, OpenBSD, NetBSD, DragonFly BSD, Android, Solaris
200+
201+
### Architectures
202+
amd64, arm64, 386, arm, loong64, ppc64, ppc64le, riscv64, mips, mips64, s390x, wasm
203+
204+
### Compression Formats
205+
`.zip`, `.tar.gz`, `.tgz`, `.tar.bz2`, `.tar.xz`, `.txz`, `.gz`, `.bz2`, `.bin`
206+
207+
## Tips
208+
209+
### GitHub API Rate Limits
210+
211+
GitHub API limits:
212+
- Unauthenticated: 60 requests/hour
213+
- Authenticated: 5000 requests/hour
214+
215+
Get a token at https://github.com/settings/tokens and set:
216+
217+
```bash
218+
export GITHUB_TOKEN=ghp_xxxxxxxxxxxx
150219
```
151220

152-
However, homebrew formulas require an SHA1 hash of each binary and currently, the only way to get is to actually download the file. It **might** be acceptable to download all assets if the resulting `.rb` file was cached for a long time.
221+
### Apple Silicon Compatibility
153222

154-
#### MIT License
223+
The script automatically detects ARM64 versions. If unavailable, falls back to amd64 (runs via Rosetta 2).
155224

156-
Copyright © 2020 Jaime Pillora &lt;[email protected]&gt;
225+
### Security Warning
157226

158-
Permission is hereby granted, free of charge, to any person obtaining
159-
a copy of this software and associated documentation files (the
160-
'Software'), to deal in the Software without restriction, including
161-
without limitation the rights to use, copy, modify, merge, publish,
162-
distribute, sublicense, and/or sell copies of the Software, and to
163-
permit persons to whom the Software is furnished to do so, subject to
164-
the following conditions:
227+
⚠️ Piping scripts from the internet to bash carries security risks. Always inspect scripts first or deploy your own instance.
228+
229+
```bash
230+
# Inspect before executing
231+
curl https://your-domain.workers.dev/user/repo
232+
```
165233

166-
The above copyright notice and this permission notice shall be
167-
included in all copies or substantial portions of the Software.
234+
## License
168235

169-
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
170-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
171-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
172-
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
173-
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
174-
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
175-
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
236+
MIT License - Copyright © 2020 Jaime Pillora &lt;[email protected]&gt;

0 commit comments

Comments
 (0)