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

Conversation

@jsirianni
Copy link
Member

@jsirianni jsirianni commented Sep 12, 2025

Proposed Change

  • Updated unix install script to use bdot user and group
  • Updated Linux package post install script to migrate Linux user bindplane-otel-collector to bdot

You can reference merged the V1 PR here #2436

Testing

  1. Installed the latest v2 beta agent
  2. Confirmed files and dirs in /opt/bindplane-otel-collector are owned by bindplane-otel-collector
ls -la /opt/bindplane-otel-collector 
total 361936
drwxr-xr-x   5 bindplane-otel-collector bindplane-otel-collector      4096 Sep 15 13:39 .
drwxr-xr-x. 13 root                     root                          4096 Sep 15 13:39 ..
-rwxr-xr-x   1 bindplane-otel-collector bindplane-otel-collector 339480760 Aug  4 11:51 bindplane-otel-collector
-rw-r--r--   1 bindplane-otel-collector bindplane-otel-collector     11339 Aug  4 11:44 LICENSE
-rwxr-xr-x   1 bindplane-otel-collector bindplane-otel-collector  31086146 Aug  4 11:47 opampsupervisor
drwxr-x---   2 bindplane-otel-collector bindplane-otel-collector      4096 Sep 15 13:39 plugins
drwxr-x---   2 bindplane-otel-collector bindplane-otel-collector      4096 Aug  4 12:04 storage
-rw-r--r--   1 root                     bindplane-otel-collector       610 Sep 15 13:39 supervisor.log
drwxr-x---   2 bindplane-otel-collector bindplane-otel-collector      4096 Sep 15 13:39 supervisor_storage
-rw-------   1 bindplane-otel-collector bindplane-otel-collector       825 Sep 15 13:39 supervisor.yaml
-rw-r--r--   1 bindplane-otel-collector bindplane-otel-collector        14 Aug  4 11:46 VERSION.txt
  1. Upgraded to a build from this branch
  2. Confirmed files and dirs are now owned by bdot
ls -la /opt/bindplane-otel-collector
total 365112
drwxr-xr-x   5 bdot bdot      4096 Sep 15 13:40 .
drwxr-xr-x. 13 root root      4096 Sep 15 13:40 ..
-rwxr-xr-x   1 bdot bdot 339484856 Sep 15 13:35 bindplane-otel-collector
-rw-r--r--   1 bdot bdot     11339 Mar  3  2025 LICENSE
-rwxr-xr-x   1 bdot bdot  34329661 Sep 15 13:35 opampsupervisor
drwxr-x---   2 bdot bdot      4096 Sep 15 13:40 plugins
drwxr-x---   2 bdot bdot      4096 Sep 15 13:36 storage
-rw-r--r--   1 root bdot       610 Sep 15 13:39 supervisor.log
drwxr-x---   2 bdot bdot      4096 Sep 15 13:36 supervisor_storage
-rw-------   1 bdot bdot       825 Sep 15 13:39 supervisor.yaml
-rw-r--r--   1 bdot bdot        15 Sep 15 13:34 VERSION.txt
  1. Confirmed service is still running and connected to Bindplane (supervisor config was not wiped out)
Checklist
  • Changes are tested
  • CI has passed

fi

# Script Constants
COLLECTOR_USER="bdot"
Copy link
Member Author

Choose a reason for hiding this comment

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

This var is used by the chown command below, after package install / upgrade. The migrated user will already be in place.

Comment on lines +40 to +44
# Remove supervisor.yaml from staging if it already exists in target
# to avoid overwriting the existing file.
if [ -f "${BDOT_CONFIG_HOME}/supervisor.yaml" ]; then
rm -f "${stage_dir}/supervisor.yaml" || true
fi
Copy link
Member Author

Choose a reason for hiding this comment

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

This fixes a bug previously introduced by the "stage dir" implementation. We need to avoid clobbering the supervisor.yaml config as it contains the opamp config. Upgrades caused the collector to lose its connection to the OpAMP server.

mkdir -p "${BDOT_CONFIG_HOME}"
chmod 0755 "${BDOT_CONFIG_HOME}"
chown bindplane-otel-collector:bindplane-otel-collector "${BDOT_CONFIG_HOME}"
rm -f "${BDOT_CONFIG_HOME}/bindplane-otel-collector" || true
Copy link
Member Author

Choose a reason for hiding this comment

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

Two things

  1. Deleting and re-creating the binary is required if its executed by a process (or an atomic move, see below)
  2. We were missing the supervisor binary here. This is a bug resolved by this PR.

See the new implementation below starting at line 46.

Comment on lines +55 to +57
# Perform atomic moves for binary files to replace running binaries
mv "${BDOT_CONFIG_HOME}/opampsupervisor.new" "${BDOT_CONFIG_HOME}/opampsupervisor"
mv "${BDOT_CONFIG_HOME}/bindplane-otel-collector.new" "${BDOT_CONFIG_HOME}/bindplane-otel-collector"
Copy link
Member Author

Choose a reason for hiding this comment

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

mv is atomic and will preserve the previous binary until the move operation is finished. Its also much faster to move the binary vs copying it.

This will prevent a situation where the binary does not exist on disk (because it was deleted) and the service crashes and restarts, failing again because the binary is missing.

@jsirianni jsirianni requested a review from Copilot September 15, 2025 18:34
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR renames the user and group from observiq-otel-collector/bindplane-otel-collector to bdot across installation scripts to standardize the naming convention for the v2 collector.

  • Introduces user migration logic to handle the transition from legacy username to new username during package upgrades
  • Updates all script references to use the new bdot username and group
  • Improves binary replacement logic during installation to handle file locking issues

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
scripts/package/preinstall.sh Adds migration functions to rename legacy user/group to bdot before package operations
scripts/package/postinstall.sh Updates username references and improves binary file handling during installation
scripts/install/install_unix.sh Changes hardcoded username reference to use COLLECTOR_USER variable set to "bdot"

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@jsirianni jsirianni marked this pull request as ready for review September 15, 2025 18:39
@jsirianni jsirianni requested review from a team and dpaasman00 as code owners September 15, 2025 18:39
@jsirianni jsirianni merged commit bda3bd0 into release/v2.0.0 Sep 16, 2025
14 checks passed
@jsirianni jsirianni deleted the joesirianni/plat-348-bdot-v2-migrate-bindplane-otel-collector-user-to-bdot branch September 16, 2025 17:57
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