这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@jsirianni
Copy link
Member

@jsirianni jsirianni commented Jul 16, 2025

Proposed Change

We support a user configured install dir. See scripts/package/postinstall.sh. This is a follow up change to support the user configured directory when using the updater.

Updated the updater's systemd service file template to include a .InstallDir variable. The value used is extracted from the installed systemd service file. This follows the pattern established when detecting the runtime group.

Testing

Working great when the install dir is not configured.

I tested an install dir override by setting BDOT_CONFIG_HOME=/opt/collector and then building this branch with two tags:

observiq-otel-collector-v1.81.0-alpha.3
observiq-otel-collector-v1.81.0-alpha.4

The builds were identical, and allowed me to test upgrading with the new logic. We cannot upgrade from the latest release because it will fail to execute the updater binary, due to the /opt/observiq-otel-collector path being hardcoded in updater/internal/path/. This is okay because we will not support linux package customization for existing installs, only new installs.

Checklist
  • Changes are tested
  • CI has passed

@jsirianni jsirianni force-pushed the joesirianni/bpop-3228-bdot-updater-configurable-install-directory branch from ff04014 to f5f9af7 Compare July 16, 2025 20:43
// We can't create the zap logger yet, because we don't know the install dir, which is needed
// to create the logger. So we pass a Nop logger here.
installDir, err := path.InstallDir(zap.NewNop())
installDir, err := path.InstallDir(zap.NewNop(), path.DefaultConfigOverrides)
Copy link
Member Author

Choose a reason for hiding this comment

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

path.InstallDir takes a list of package overrides. On Linux this will be /etc/default/observiq-otel-collector and /etc/sysconfig/observiq-otel-collector. On Windows and Darwin, this option is ignored.

if len(parts) == 2 {
value := strings.TrimSpace(parts[1])
if value != "" {
return value, nil
Copy link
Member Author

Choose a reason for hiding this comment

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

InstallDir returns the value for BDOT_CONFIG_HOME right away. We do not expect users to configure both /etc/default/observiq-otel-collector (debian) and /etc/sysconfig/observiq-otel-collector (rhel). This function will read the one that exists and return the value if it is found.

}
}

return DeafultLinuxInstallDir, nil
Copy link
Member Author

Choose a reason for hiding this comment

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

If the files do not exist, continue using /opt/observiq-otel-collector.

@jsirianni jsirianni force-pushed the joesirianni/bpop-3228-bdot-updater-configurable-install-directory branch from f5f9af7 to 9e372a0 Compare July 16, 2025 20:49
@jsirianni jsirianni marked this pull request as ready for review July 16, 2025 20:50
@jsirianni jsirianni requested review from a team and dpaasman00 as code owners July 16, 2025 20:50
@jsirianni jsirianni force-pushed the joesirianni/bpop-3228-bdot-updater-configurable-install-directory branch 2 times, most recently from 9b35715 to b6596a8 Compare July 17, 2025 16:05
@jsirianni jsirianni marked this pull request as draft July 17, 2025 16:12
@jsirianni jsirianni removed request for a team and dpaasman00 July 17, 2025 16:12
@jsirianni jsirianni force-pushed the joesirianni/bpop-3228-bdot-updater-configurable-install-directory branch from b6596a8 to 79d7d5f Compare July 17, 2025 16:47
// InstallDir returns the filepath to the install directory
func InstallDir(_ *zap.Logger) (string, error) {
return LinuxInstallDir, nil
func InstallDir(logger *zap.Logger, configOverrides []string) (string, error) {
Copy link
Member Author

@jsirianni jsirianni Jul 17, 2025

Choose a reason for hiding this comment

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

This function is used by the collector service to determine where it is installed. Returns /opt/observiq-otel-collector unless an override is detected.

This function is also used by the updater to determine which install dir to slip into the generated systemd service file.

@jsirianni jsirianni marked this pull request as ready for review July 17, 2025 19:33
@jsirianni jsirianni requested a review from dpaasman00 July 17, 2025 19:34
@jsirianni jsirianni force-pushed the joesirianni/bpop-3228-bdot-updater-configurable-install-directory branch from 9c93bc5 to d81ad0c Compare July 18, 2025 15:19
@jsirianni jsirianni merged commit 51a2733 into epic/linux-package-overhaul Jul 21, 2025
13 checks passed
@jsirianni jsirianni deleted the joesirianni/bpop-3228-bdot-updater-configurable-install-directory branch July 21, 2025 13:32
jsirianni added a commit that referenced this pull request Jul 21, 2025
…llector home (#2530)

* feat(updater): Support user configured working directory and collector home in systemd service

* Use path.InstallDir instead of parsing installed systemd  unit file.

* only generate service files when Linux
jsirianni added a commit that referenced this pull request Jul 30, 2025
…llector home (#2530)

* feat(updater): Support user configured working directory and collector home in systemd service

* Use path.InstallDir instead of parsing installed systemd  unit file.

* only generate service files when Linux
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