Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(feat) Add service block to goreleaser brew config #597

Merged
merged 1 commit into from
Jun 28, 2024

Conversation

zph
Copy link
Contributor

@zph zph commented Jun 28, 2024

This block allows for dagu to be run as a service under homebrew and it then allows the following commands:

brew services status dagu
brew services start dagu
brew services stop dagu

When the brew install happens, there is also a prompt to the user in case they want to enable the service or run directly.

The benefit here is that it enables dagu to be run as a background service automatically on startup and controlled via a centralized system.

The resulting local brew formula is:

# typed: false
# frozen_string_literal: true

# This file was generated by GoReleaser. DO NOT EDIT.
class Dagu < Formula
  desc "A No-code workflow executor that runs DAGs defined in a simple YAML format"
  homepage "https://github.com/dagu-dev/dagu"
  version "1.13.1-next"
  license "GNU General Public License v3.0"

  on_macos do
    if Hardware::CPU.intel?
      url "https://github.com/zph/dagu/releases/download/v1.13.0/dagu_1.13.1-next_darwin_amd64.tar.gz"
      sha256 "db68710731adfd0aa675804dba264bd13f3e2e639f9bc1cc7d8f33287d49222f"

      def install
        bin.install "dagu"
      end
    end
    if Hardware::CPU.arm?
      url "https://github.com/zph/dagu/releases/download/v1.13.0/dagu_1.13.1-next_darwin_arm64.tar.gz"
      sha256 "3819bab84cf213e6d4e535fe22e70ac62fdaea5c989ff9e9944112ed93f0cf13"

      def install
        bin.install "dagu"
      end
    end
  end

  on_linux do
    if Hardware::CPU.intel?
      url "https://github.com/zph/dagu/releases/download/v1.13.0/dagu_1.13.1-next_linux_amd64.tar.gz"
      sha256 "0984ba37e1e259f432f96a88b882845853d9c1ad43a6a075ab3935f83bb23eb9"

      def install
        bin.install "dagu"
      end
    end
    if Hardware::CPU.arm? && Hardware::CPU.is_64_bit?
      url "https://github.com/zph/dagu/releases/download/v1.13.0/dagu_1.13.1-next_linux_arm64.tar.gz"
      sha256 "9ace17532f040b4fd55ca7e9fb6781b953c188e91e18d37e9cdd9f9fa067657d"

      def install
        bin.install "dagu"
      end
    end
  end

  service do
    run [opt_bin/"dagu", "start-all"]
    keep_alive true
    error_log_path var/"log/dagu.log"
    log_path var/"log/dagu.log"
    working_dir var
  end
end

Related:

brew tap dagu-dev/dagu https://github.com/dagu-dev/dagu
brew install dagu-dev/dagu/dagu

Let me know if you have questions about the homebrew changes :D.

This block allows for dagu to be run as a service under homebrew
and it then allows the following commands:

```
brew services status dagu
brew services start dagu
brew services stop dagu
```

When the brew install happens, there is also a prompt to the user
in case they want to enable the service or run directly.

The benefit here is that it enables dagu to be run as a background
service automatically on startup and controlled via a centralized
system.
Copy link
Collaborator

@yohamta yohamta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the excellent contribution, @zph ! This change is a valuable improvement for the user experience. ✨✨✨LGTM✨✨✨

@yohamta yohamta merged commit 2c0971a into dagu-org:main Jun 28, 2024
3 checks passed
@zph zph deleted the zh-add-service-block-to-brew-formula branch June 28, 2024 15:49
@zph
Copy link
Contributor Author

zph commented Jun 28, 2024

@yohamta Thank you! :D Now I can remove my forked brew recipe and share that benefit with other users.

For part of my comment above: do you prefer to have a separate homebrew-tap repo for the recipe or would you like me to put up a PR to fold that too into your main repo?

brew tap dagu-dev/dagu https://github.com/dagu-dev/dagu
brew install dagu-dev/dagu/dagu

Let me know if you have questions about the homebrew changes :D.

@yohamta
Copy link
Collaborator

yohamta commented Jun 29, 2024

Thanks for the following up on this, @zph ! It sounds really great! I should have done this way earlier 😅 I've given it some thoughts and would like to make a slight modification:

brew tap dagu-dev/brew
brew install dagu

WDYT? 🙂 If it doesn't sound strange, I will make this change.

zph added a commit to zph/dagu that referenced this pull request Jul 4, 2024
Related: dagu-org#597

With this change the homebrew formula can be installed as:

brew tap dagu-dev/dagu
brew install dagu-dev/dagu/dagu
zph added a commit to zph/dagu that referenced this pull request Jul 4, 2024
Related: dagu-org#597

With this change the homebrew formula can be installed as:

brew tap dagu-dev/dagu
brew install dagu-dev/dagu/dagu
zph added a commit to zph/dagu that referenced this pull request Jul 4, 2024
Related: dagu-org#597

With this change the homebrew formula can be installed as:

brew tap dagu-dev/dagu
brew install dagu-dev/dagu/dagu
zph added a commit to zph/dagu that referenced this pull request Jul 4, 2024
Related: dagu-org#597

With this change the homebrew formula can be installed as:

brew tap dagu-dev/dagu
brew install dagu-dev/dagu/dagu
yohamta pushed a commit that referenced this pull request Jul 5, 2024
Related: #597

With this change the homebrew formula can be installed as:

brew tap dagu-dev/dagu
brew install dagu-dev/dagu/dagu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants