asynqmon icon indicating copy to clipboard operation
asynqmon copied to clipboard

Create a formula to installation from Homebrew

Open koddr opened this issue 3 years ago • 1 comments

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 ?

koddr avatar Apr 06 '21 20:04 koddr

@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 👍

hibiken avatar Apr 06 '21 22:04 hibiken