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

Enable Alloy to run with env vars and extra args #108

Merged
merged 1 commit into from
Dec 11, 2024

Conversation

johannaojeling
Copy link
Member

To enable Alloy to run as a background service with user-defined environment variables and extra command line arguments, this PR updates the Alloy formula to:

  • Create an empty file $(brew --prefix)/etc/alloy/config.env for env vars
  • Create an empty file $(brew --prefix)/etc/alloy/extra-args.txt for extra args
  • Create an wrapper script $(brew --prefix)/Cellar/alloy/<version>/bin/alloy-wrapper which runs Alloy with the env vars and extra args, if any
  • Update the service run command to execute the wrapper script

These changes are motivated by the necessity to:

  • Pass the extra argument --stability.level=public-preview to run Alloy with remote config support
  • Set certain environment variables, i.e. GCLOUD_RW_API_KEY, GCLOUD_FM_COLLECTOR_ID and GCLOUD_FM_LOG_PATH, for the Alloy self-monitoring pipelines in Grafana Cloud Fleet Management to work

Copy link
Member

@hairyhenderson hairyhenderson left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks @johannaojeling!

Copy link
Contributor

@mattdurham mattdurham left a comment

Choose a reason for hiding this comment

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

What does this do to existing installations on an update?

@johannaojeling
Copy link
Member Author

What does this do to existing installations on an update?

If you already have installed Alloy with the formula from the master branch, brew upgrade results in no changes as long as the Alloy version is unchanged: Warning: alloy 1.5.1 already installed. Then you will have to explicitly brew reinstall to get the updates.

If you have an earlier version installed, e.g. 1.5.0, brew upgrade will install the newer version using the updated formula.

Copy link
Contributor

@mattdurham mattdurham left a comment

Choose a reason for hiding this comment

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

lgtm

@johannaojeling johannaojeling merged commit db745a9 into master Dec 11, 2024
1 check passed
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.

3 participants