[GH-ISSUE #70] Create a formula to installation from Homebrew #367

Open
opened 2026-03-07 22:14:31 +03:00 by kerem · 1 comment
Owner

Originally created by @koddr on GitHub (Apr 6, 2021).
Original GitHub issue: https://github.com/hibiken/asynqmon/issues/70

Hi,

I think, better way to delivery Asynqmon to macOS/Linux users is a regular Homebrew formula. You can place it to the "tap repository" called, for example, hibiken/homebrew-asynqmon (this name of repository is required for Homebrew tap formulas).

OK, our formula in ./Formula/tap.rb is a simple Ruby file with this code:

# ./github.com/hibiken/homebrew-asynqmon/Formula/tap.rb

class Asynqmon < Formula
  desc "Asynqmon is a web based tool for monitoring and administrating Asynq queues and tasks."
  homepage "https://github.com/hibiken/asynqmon"
  version "v0.2.0"
  license "MIT"

  if OS.mac? && Hardware::CPU.intel?
    url "https://github.com/hibiken/asynqmon/releases/download/v0.2.0/asynqmon_v0.2.0_macOS_x86_64.tar.gz"
    sha256 "<HASH>" # <-- checksum hash for this file here
  end

  if OS.mac? && Hardware::CPU.arm?
    url "https://github.com/hibiken/asynqmon/releases/download/v0.2.0/asynqmon_v0.2.0_macOS_arm64.tar.gz"
    sha256 "<HASH>" # <-- checksum hash for this file here
  end

  if OS.linux? && Hardware::CPU.intel?
    url "https://github.com/hibiken/asynqmon/releases/download/v0.2.0/asynqmon_v0.2.0_Linux_x86_64.tar.gz"
    sha256 "<HASH>" # <-- checksum hash for this file here
  end

  def install
    bin.install "asynqmon"
  end

  test do
    system "#{bin}/asynqmon", "--help"
  end

  def caveats; <<~EOS
    Asynqmon server needs to connect to Redis server to serve data.

    To start a default server, run `asynqmon` and open http://localhost:8080
    To see all available flags, run `asynqmon --help` command.
  EOS
  end
end

☝️ Please note, this example for v0.2.0 version and without checksum hashes for each tar.gz file.

Next steps:

  • Push this file to the ./Formula folder in the github.com/hibiken/homebrew-asynqmon repository.
  • Make a new release in Asynqmon's core repository (github.com/hibiken/asynqmon).
  • Upload Asynqmon binary in tar.gz archives to the release.
  • Create checksum.txt file and upload it to the release.

And we're ready! Just tap a new formula:

brew tap hibiken/asynqmon

And install Asynqmon as regular Homebrew bottle:

brew install hibiken/asynqmon/tap

That's it! 🎉

Then you just need to update this formula file with new checksum hashes and versions after a new Asynqmon release.

Yes, you can simplify this process by using the solution from GoReleaser, but I think that it would be faster.

What do you think about all of this @hibiken ?

Originally created by @koddr on GitHub (Apr 6, 2021). Original GitHub issue: https://github.com/hibiken/asynqmon/issues/70 Hi, I think, better way to delivery Asynqmon to macOS/Linux users is a regular Homebrew formula. You can place it to the "tap repository" called, for example, `hibiken/homebrew-asynqmon` (this name of repository is [required](https://docs.brew.sh/Taps.html) for Homebrew tap formulas). OK, our formula in `./Formula/tap.rb` is a simple Ruby file with this code: ```ruby # ./github.com/hibiken/homebrew-asynqmon/Formula/tap.rb class Asynqmon < Formula desc "Asynqmon is a web based tool for monitoring and administrating Asynq queues and tasks." homepage "https://github.com/hibiken/asynqmon" version "v0.2.0" license "MIT" if OS.mac? && Hardware::CPU.intel? url "https://github.com/hibiken/asynqmon/releases/download/v0.2.0/asynqmon_v0.2.0_macOS_x86_64.tar.gz" sha256 "<HASH>" # <-- checksum hash for this file here end if OS.mac? && Hardware::CPU.arm? url "https://github.com/hibiken/asynqmon/releases/download/v0.2.0/asynqmon_v0.2.0_macOS_arm64.tar.gz" sha256 "<HASH>" # <-- checksum hash for this file here end if OS.linux? && Hardware::CPU.intel? url "https://github.com/hibiken/asynqmon/releases/download/v0.2.0/asynqmon_v0.2.0_Linux_x86_64.tar.gz" sha256 "<HASH>" # <-- checksum hash for this file here end def install bin.install "asynqmon" end test do system "#{bin}/asynqmon", "--help" end def caveats; <<~EOS Asynqmon server needs to connect to Redis server to serve data. To start a default server, run `asynqmon` and open http://localhost:8080 To see all available flags, run `asynqmon --help` command. EOS end end ``` > ☝️ Please note, this example for `v0.2.0` version and without checksum hashes for each `tar.gz` file. Next steps: - Push this file to the `./Formula` folder in the `github.com/hibiken/homebrew-asynqmon` repository. - Make a new release in Asynqmon's core repository (`github.com/hibiken/asynqmon`). - Upload Asynqmon binary in `tar.gz` archives to the release. - Create `checksum.txt` file and upload it to the release. And we're ready! Just tap a new formula: ```bash brew tap hibiken/asynqmon ``` And install Asynqmon as regular Homebrew bottle: ```bash brew install hibiken/asynqmon/tap ``` That's it! 🎉 Then you just need to update this formula file with new checksum hashes and versions after a new Asynqmon release. > Yes, you can simplify this process by using the solution from [GoReleaser](https://goreleaser.com/customization/homebrew/), but I think that it would be faster. What do you think about all of this @hibiken ?
Author
Owner

@hibiken commented on GitHub (Apr 6, 2021):

@koddr Thanks for the suggestion!
Anything that makes this tool more accessible to more developers is welcome. I think we should definitely support installing the tool via homebrew. I'll look into it 👍

<!-- gh-comment-id:814478768 --> @hibiken commented on GitHub (Apr 6, 2021): @koddr Thanks for the suggestion! Anything that makes this tool more accessible to more developers is welcome. I think we should definitely support installing the tool via homebrew. I'll look into it 👍
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/asynqmon#367
No description provided.