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): add linux deb & rpm package support to install script #1219

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

amdprophet
Copy link
Contributor

@amdprophet amdprophet commented Aug 10, 2023

WIP: This is still a WIP but is nearly complete. There are a few test failures for deb packages that should be fixed shortly.

Adds support for Linux deb & rpm packages to the install script. A new --use-native-packaging flag has been added to use package installation instead of the current binary installation method.

SumoLogic/sumologic-otel-collector-packaging#28 contains fixes for packages that are required for the package installation via install.sh to function. A new package release is required after that PR is merged.

@amdprophet amdprophet requested a review from a team as a code owner August 10, 2023 21:49
@github-actions github-actions bot added the go label Aug 10, 2023
Copy link

@swiatekm swiatekm left a comment

Choose a reason for hiding this comment

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

What are these Python scripts and docker-compose config for? Since they're so big, I'd prefer to add them in a separate PR, with some minimal documentation on how to use them, maybe some additional tooling.

checkSystemdConfigNotCreated,
checkDeprecatedSystemdConfigNotCreated,
}

for _, spec := range []testSpec{

Choose a reason for hiding this comment

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

Is there a simple way to avoid all this duplication? For example, take the testspec slice, run all the tests as they are before this change, and then run them again manually enabling native packaging?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The main issue is that the PreActions, PreChecks, PostChecks, etc. differ between binary & package installs in most if not all of the specs. Reducing duplication may not be worth the time investment as we're planning on removing binary installation support from the install script.

Choose a reason for hiding this comment

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

Intuitively, the install script should give the same results whether using native packaging or not, at least with systemd enabled. What is the source of the differences?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The majority of the difference is in the pre-actions & pre-checks.

I avoided using much of the config mocking used in the tests to prevent package installation conflicts around existing config files. This isn't a problem when installing under an interactive tty as the installer can prompt how to handle conflicts. To work around this issue I wrote a helper to install a previous version of the package (defined by the const previousVersion) in some of the preActions of specs. This should work with binary installations but versions differ between binaries and packages to allow for out-of-band changes to packaging code.

The binary install uses the wrong path for the systemd unit file which has been fixed in the packages. I had assumed, perhaps incorrectly, that we wouldn't want to change paths of any files for binary installations. We can change the path to match the packages. We'll need logic to handle the removal or migration of the unit file at the old path.

Choose a reason for hiding this comment

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

Allright, I'm fine with that. Can we then move the native test cases to a separate test? There's a lot of them and I'd like to introduce some basic organization here, to make changes easier in the future.

Comment on lines 62 to 63
ownerUser = rootUser
ownerGroup = rootGroup

Choose a reason for hiding this comment

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

Why is this different? Do the native packages not set the same owner as the install script?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When SYSTEMD_DISABLED=true, the install script doesn't add the otelcol-sumo user and thus the files are owned by root. The packages only support systemd and thus will always make use of the otelcol-sumo user.

@amdprophet
Copy link
Contributor Author

What are these Python scripts and docker-compose config for? Since they're so big, I'd prefer to add them in a separate PR, with some minimal documentation on how to use them, maybe some additional tooling.

The docker-compose config is a way to run both the tests against both deb & rpm packages on platforms that don't support it (e.g. macOS). It was quite helpful developing against it. I plan to add a job to test RPMs in CI as well.

Systemd requires PID 1 which doesn't easily work with containers. The Python scripts are a hack to simulate systemd & journalctl for the purpose of testing.

I agree that the Dockerfiles, config & Python scripts don't belong in this PR. I'll open a separate PR for that work and add some documentation.

@amdprophet amdprophet force-pushed the feature/linux-pkg-install-script branch from ac0a916 to 763f1e2 Compare August 14, 2023 19:35
@github-actions github-actions bot added the github_actions Pull requests that update Github_actions code label Aug 14, 2023
@amdprophet amdprophet force-pushed the feature/linux-pkg-install-script branch 2 times, most recently from 6be0421 to a829a6a Compare August 15, 2023 21:37
@amdprophet
Copy link
Contributor Author

amdprophet commented Aug 16, 2023

I'm currently refactoring the specs & checks to remove a lot of the duplication. In doing so I discovered that I broke FIPS installation, hostmetrics installation with Linux packages only, and a few other install paths.

The ownership of config files differs between, not only binary and package installs but, non-systemd binary and systemd binary installs. This is why some of the specs check for rootUser as an owner and others check for systemUser. I'd like to drop non-systemd support in the install script to further simplify it. Is this something that we can do? @swiatekm-sumo @portertech

@portertech
Copy link
Contributor

@amdprophet once we're "all-in" with native packages, we can look to deprecate/remove non-service managed installations.

@amdprophet amdprophet force-pushed the feature/linux-pkg-install-script branch 14 times, most recently from 214564f to b958b0c Compare August 30, 2023 20:52
Signed-off-by: Justin Kolberg <[email protected]>
@amdprophet amdprophet force-pushed the feature/linux-pkg-install-script branch from b958b0c to 6ad8440 Compare August 30, 2023 22:50
@github-actions github-actions bot added the documentation Improvements or additions to documentation label Aug 30, 2023
@sumo-drosiek
Copy link
Contributor

@amdprophet What is the status of this change?

@echlebek
Copy link
Contributor

@amdprophet can this be closed, since we are moving to the packaging repo?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation github_actions Pull requests that update Github_actions code go
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants