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

fix: set up observe-agent service user in install_linux script #147

Merged
merged 1 commit into from
Dec 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion scripts/install_linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ sudo mkdir -p $observeagent_config_dir /var/lib/observe-agent/filestorage
sudo chmod +rw /var/lib/observe-agent/filestorage

# Move the binary to the proper path.
cp -f $tmp_dir/observe-agent $agent_binary_path
sudo cp -f $tmp_dir/observe-agent $agent_binary_path

# Copy all config files to the proper dir.
sudo cp -f $tmp_dir/otel-collector.yaml $observeagent_config_dir/otel-collector.yaml
Expand Down Expand Up @@ -109,6 +109,14 @@ if [[ -d /run/systemd/system ]]; then
# Set up the systemd service if it doesn't exist already.
if ! systemctl list-unit-files observe-agent.service | grep observe-agent >/dev/null; then
echo "Installing observe-agent.service as a systemd service. This may ask for your password..."

# Set up user and permissions (copied from preinstall.sh)
sudo getent passwd observe-agent >/dev/null || sudo useradd --system --user-group --no-create-home --shell /sbin/nologin observe-agent
sudo usermod -a -G systemd-journal observe-agent
sudo mkdir -p /var/lib/observe-agent/filestorage
sudo chown -R observe-agent:observe-agent /var/lib/observe-agent/filestorage

# Copy the service file and start the service.
sudo cp -f $tmp_dir/observe-agent.service /etc/systemd/system/observe-agent.service
sudo chown root:root /etc/systemd/system/observe-agent.service
sudo systemctl daemon-reload
Expand Down
Loading