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(scripts): update install.sh to use packages on macOS #1127

Merged
merged 14 commits into from
Jul 5, 2023

Conversation

amdprophet
Copy link
Contributor

@amdprophet amdprophet commented May 12, 2023

Updates scripts/install.sh to install otelcol-sumo using packages when run on macOS. I forked the packaging repository to create an example release for testing. Set PACKAGE_GITHUB_ORG="sensu" inside install.sh for testing installation from a GitHub Release, or use --binary-branch main to test installing from GitHub Action artifacts.

These changes should be broken up into separate functions and the install script should be refactored to account for platform differences but @portertech wants to tackle that separately from this initial implementation.

@amdprophet amdprophet requested a review from a team as a code owner May 12, 2023 21:08
Copy link
Contributor

@sumo-drosiek sumo-drosiek left a comment

Choose a reason for hiding this comment

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

Are psutil and launchcl available on all mac platforms?

It would be nice to have e2e tests for this PR, as it is quite significant

@amdprophet
Copy link
Contributor Author

Yes, both plutil & launchctl exist for all macOS platforms and have been there for 10+ years. E2E tests are a great idea; I'll fix up the broken test(s) and start to add coverage today.

@portertech
Copy link
Contributor

portertech commented May 26, 2023

Testing Instructions (within the S3M flows)

Replace the appropriate flow steps with the following.

NOTE: The URLs used will not match those going into the UI updates

Set Up Collector

  1. Generate and run the command to install the collector

Please be sure to replace <YOUR_TOKEN> and optionally modify the tags etc.

sudo curl -s https://raw.githubusercontent.com/SumoLogic/sumologic-otel-collector/feature/darwin-install-script/scripts/install.sh | SUMOLOGIC_INSTALLATION_TOKEN="<YOUR_TOKEN>" sudo -E bash -s -- --tag "host.group=default" --tag "deployment.environment=default"

Configure App

  1. Download YAML File and Configure the Integration

Reload the Sumo Logic Otel Collector Service.

sudo launchctl unload /Library/LaunchDaemons/com.sumologic.otelcol-sumo.plist
sudo launchctl load -w /Library/LaunchDaemons/com.sumologic.otelcol-sumo.plist

@portertech
Copy link
Contributor

Fixed an uninstallation bug SumoLogic/sumologic-otel-collector-packaging#10

@portertech
Copy link
Contributor

portertech commented Jun 20, 2023

@amdprophet @sumo-drosiek @perk-sumo We cannot merge this PR until the UI team is ready for the rollout across deploys. The UI team is putting a dynamic property in place to pin the MacOS installation script release (i.e. 0.79.0 instead of latest). Once this is done, we can then merge this PR and cut a collector release. The UI team can then flip a feature flag on the Staging deployment and QE can run through the E2E test suites (and make corrections etc). After E2E tests pass, the UI team can do a slow rollout across deploys (days).

@amdprophet in the meantime, please get builds passing and do further cleanup. We shouldn't expect a green light until late next week 😅

@amdprophet amdprophet force-pushed the feature/darwin-install-script branch from a5e3486 to c76865e Compare June 26, 2023 17:52
Comment on lines 32 to 40
if path == configPath {
// /etc/otelcol-sumo/sumologic.yaml
permissions = configPathFilePermissions
} else if path == userConfigPath {
// /etc/otelcol-sumo/conf.d/common.yaml
permissions = commonConfigPathFilePermissions
} else {
// /etc/otelcol-sumo/conf.d/*
permissions = confDPathFilePermissions
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we may use switch here

@@ -723,11 +723,11 @@ function setup_config_darwin() {
write_sumologic_extension "${COMMON_CONFIG_PATH}" "${INDENTATION}"

# fill in api base url
if [[ -n "${API_BASE_URL}" && -z "${USER_API_URL}" ]]; then
if [[ -n "${API_BASE_URL}" ]]; then
Copy link
Contributor

@sumo-drosiek sumo-drosiek Jul 5, 2023

Choose a reason for hiding this comment

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

Do we need this change? If yes, can add to linux as well?

Copy link
Contributor Author

@amdprophet amdprophet Jul 5, 2023

Choose a reason for hiding this comment

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

This is only necessary on macOS as common.yaml is replaced on upgrades. I haven't been able to find a way around this.

Copy link
Contributor

@sumo-drosiek sumo-drosiek left a comment

Choose a reason for hiding this comment

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

two minor things

@portertech portertech merged commit c7abae7 into main Jul 5, 2023
27 checks passed
@portertech portertech deleted the feature/darwin-install-script branch July 5, 2023 21:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants