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: update mac install script to download from latest release #141

Merged
merged 2 commits into from
Dec 16, 2024

Conversation

obs-gh-mattcotter
Copy link
Collaborator

Description

Update mac install script to download from latest release. Now that we have a new release which builds the expected Mac zip, we can finally download and install from GitHub.

Checklist

  • Created tests which fail without the change (if possible)
  • Extended the README / documentation, if necessary

sudo chown -R root:wheel $observeagent_install_dir

# Initialize the agent config file if it doesn't exist
if [ -f "$observeagent_install_dir/observe-agent.yaml" ]; then
echo "Leaving existing observe-agent.yaml in place."
else
echo "Initializing observe-agent.yaml"
sudo $observeagent_install_dir/observe-agent init-config --token $TOKEN --observe_url $OBSERVE_URL --config_path $observeagent_install_dir/observe-agent.yaml
INIT_FLAGS="--config_path $observeagent_install_dir/observe-agent.yaml --token $TOKEN --observe_url $OBSERVE_URL --host_monitoring::enabled=true"
if [ -n "$LOGS_ENABLED" ]; then
Copy link
Collaborator

Choose a reason for hiding this comment

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

where are the keys for these args defined? is this just an env var? are we adding another layer/set of config key names?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, these are just env vars. I needed some way of getting the args from the connection into the config. Now that you've called attention to this though, I wonder if it's better to switch this to getopts to be more in line with the windows script. What do you think about that?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@obs-gh-alexlew for context, we invoke the Windows install script like:

.\install.ps1 -observe_token "{{token}}" -observe_collection_endpoint "{{endpoint}}"

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Updated so it now works like:
bash scripts/install_mac.sh --token=hi --observe_url example.com --logs_enabled=true

tmp_dir="/tmp/observe-agent"

# Parse args
while [ $# -gt 0 ]; do
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

getopts doesn't work on mac for long options unfortunately, so I had to write out this approximation. It doesn't have all the bells and whistles, but is robust enough for our use case of having users copy/paste commands from the connection portal.

@obs-gh-mattcotter obs-gh-mattcotter merged commit 2fd9d80 into main Dec 16, 2024
8 checks passed
@obs-gh-mattcotter obs-gh-mattcotter deleted the mc/mac-install-from-release branch December 16, 2024 17:35
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