Gohazel

A versions update server writen in Golang. Supports updating an Electron application.
- Private repo - Response your proxy server download url. Cache release information and assets by Github api.
- Public repo - Response Github public download url directly. Alse support proxy.
Difference from Hazel
The project is inspired by Hazel. Hazel is very complicated to deploy, because it is coded in NodeJS.
Gohazel not only translated hazel to Golang, but also made some ajustments and optimizations.
- Cache assets into your server disk for private repo.
- Separate user requests and cache logic, for fast response.
- Cache latest release data, in case there is no any information for serving while fetching failed from Github at startup.
URL Pathes
/
Overview repo and cached release information.
/download
Responses download url ("Location") for detected platform which parsed from user agent.
$ curl http://localhost:8080/download
{"Location":"https://github.com/atom/atom/releases/download/v1.52.0/AtomSetup.exe"}
{"Location":"http://localhost:8080/assets/atom/atom/v1.52.0/AtomSetup.exe"}
Responses download url for specified platform in uri.
$ curl http://localhost:8080/download/darwin
{"Location":"https://github.com/atom/atom/releases/download/v1.52.0/atom-mac.zip"}
{"Location":"http://localhost:8080/assets/atom/atom/v1.52.0/atom-mac.zip"}
Check update info
$ curl http://localhost:8080/update/win/v0.0.1
{"name":"v1.52.0","notes":"## Notable Changes...","pub_data":"2020-10-13T14:11:00Z","url":"http://localhost:8080/download/exe?update=true"}
/update/win32/:version/RELEASES
For Squirrel Windows
Assets Filename
Supporting patterns: *.exe,*.dmg, *.rpm, *.deb, *.AppImage, *mac*.zip, *darwin*.zip
References release of atom: https://github.com/atom/atom/releases
Config File
config.yml
bind: ":8080"
debug: false
debugGin: false
baseURL: http://localhost:8080
cacheDir: /assets
proxyDownload: false
github:
owner: atom
repo: atom
token:
pre: false
baseURL - Public base URL of the server.
cacheDIr - The directory for store cache release info and asset files.
proxyDownload - Whether to let the server proxy assets download.
github.owner - Account username.
github.repo - Repository name.
github.token - The Github API Token for fetching release info and download assets from private repo.
github.pre - Whether to fetch the pre-release versions.
Run with Container
Docker Repository: panjiang/gohazel
- Write your config file
/data/gohazel/config.yml
- Store cache files in
/data/gohazel/assets
Docker
docker run -d --name gohazel \
-v /data/gohazel/config.yml:/app/config.yml \
-v /data/gohazel/assets:/assets \
-p 8080:8080 \
panjiang/gohazel:latest
Docker Compose
docker-compose.yml
version: "3.7"
services:
gohazel:
container_name: gohazel
image: panjiang/gohazel:latest
ports:
- "8080:8080"
volumes:
- /data/gohazel/config.yml:/app/config.yml
- /data/gohazel/assets:/assets
$ docker-compose up -d