Skip to content

Commit

Permalink
add unix autoinstaller script
Browse files Browse the repository at this point in the history
  • Loading branch information
smithclay committed Feb 28, 2024
1 parent 72113fd commit 0e03a31
Show file tree
Hide file tree
Showing 4 changed files with 726 additions and 31 deletions.
1 change: 1 addition & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -148,4 +148,5 @@ release:
draft: false
prerelease: "true"
extra_files:
- glob: "./collector/scripts/install/install-unix.sh"
- glob: "./collector/scripts/install/install-macos.sh"
32 changes: 3 additions & 29 deletions collector/scripts/install/install-macos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ DOWNLOAD_BASE="https://github.com/lightstep/sn-collector/releases/download"
PREREQS="printf sed uname tr find grep"
TMP_DIR="${TMPDIR:-"/tmp/"}sn-collector" # Allow this to be overriden by cannonical TMPDIR env var
INSTALL_DIR="/opt/sn-collector"
MANAGEMENT_YML_PATH="$INSTALL_DIR/manager.yaml"
SCRIPT_NAME="$0"
INDENT_WIDTH=' '
indent=""
Expand Down Expand Up @@ -153,17 +152,11 @@ Usage:
Example: '-b http://my.domain.org/servicenow-collector/binaries' will be used as the base of the download URL.
$(fg_yellow '-e, --endpoint')
Defines the endpoint of an OpAMP compatible management server for this agent install.
This parameter may also be provided through the ENDPOINT environment variable.
Specifying this will install the agent in a managed mode, as opposed to the
normal headless mode.
Defines the Cloud Observability ingest endpoint for telemetry
$(fg_yellow '-i, --ingest-token')
Defines the secret key to be used when communicating with an OpAMP compatible server.
This parameter may also be provided through the SECRET_KEY environment variable.
The '--endpoint' flag must be specified if this flag is specified.
Defines the token to be used when communicating with Cloud Observability
EOF
)
info "$USAGE"
Expand Down Expand Up @@ -441,11 +434,6 @@ install_package()
succeeded
fi

# TODO: If an endpoint was specified, we need to update the config
#if [ -n "$OPAMP_ENDPOINT" ]; then
# create_manager_yml "$MANAGEMENT_YML_PATH"
#fi

if [ -f "/Library/LaunchDaemons/$SERVICE_NAME.plist" ]; then
# Existing service file, we should stop & unload first.
info "Uninstalling existing service file..."
Expand All @@ -471,20 +459,6 @@ install_package()
decrease_indent
}

# create_manager_yml creates the manager.yml at the specified path, containing opamp information.
create_manager_yml()
{
manager_yml_path="$1"
if [ ! -f "$manager_yml_path" ]; then
info "Creating manager yaml..."
command printf 'endpoint: "%s"\n' "$OPAMP_ENDPOINT" > "$manager_yml_path"
[ -n "$OPAMP_LABELS" ] && command printf 'labels: "%s"\n' "$OPAMP_LABELS" >> "$manager_yml_path"
[ -n "$OPAMP_SECRET_KEY" ] && command printf 'secret_key: "%s"\n' "$OPAMP_SECRET_KEY" >> "$manager_yml_path"
succeeded
fi
}


# This will display the results of an installation
display_results()
{
Expand Down
Loading

0 comments on commit 0e03a31

Please sign in to comment.