Skip to content

Commit

Permalink
Package updates (open-telemetry#29)
Browse files Browse the repository at this point in the history
* Fix deb filenames for publish

* Update systemd env file for SPLUNK_BALLAST

* Rename systemd environment file

* Allow otelcol options to be configurable in env file
  • Loading branch information
jchengsfx authored Oct 14, 2020
1 parent 1b20e2b commit 389fbb1
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 20 deletions.
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ commands:
bin/otelcol_linux_arm64
bin/otelcol_linux_amd64
bin/otelcol_windows_amd64.exe
dist/splunk-otel-collector_*.amd64.deb
dist/splunk-otel-collector_*.arm64.deb
dist/splunk-otel-collector_*_amd64.deb
dist/splunk-otel-collector_*_arm64.deb
dist/splunk-otel-collector-*.arm64.rpm
dist/splunk-otel-collector-*.x86_64.rpm
steps:
Expand Down
4 changes: 2 additions & 2 deletions internal/buildscripts/packaging/fpm/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ SPLUNK_CONFIG_REPO_PATH="$REPO_DIR/cmd/otelcol/config/collector/splunk_config.ya
SPLUNK_CONFIG_INSTALL_PATH="/etc/otel/collector/splunk_config.yaml"
OTLP_CONFIG_REPO_PATH="$REPO_DIR/cmd/otelcol/config/collector/otlp_config.yaml"
OTLP_CONFIG_INSTALL_PATH="/etc/otel/collector/otlp_config.yaml"
SPLUNK_ENV_REPO_PATH="$REPO_DIR/internal/buildscripts/packaging/fpm/splunk_env.sh.example"
SPLUNK_ENV_INSTALL_PATH="/etc/otel/collector/splunk_env.sh.example"
SPLUNK_ENV_REPO_PATH="$FPM_DIR/splunk_env.example"
SPLUNK_ENV_INSTALL_PATH="/etc/otel/collector/splunk_env.example"


get_version() {
Expand Down
3 changes: 2 additions & 1 deletion internal/buildscripts/packaging/fpm/postinstall.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#!/bin/sh

if command -v systemctl >/dev/null 2>&1; then
systemctl daemon-reload
systemctl enable splunk-otel-collector.service
# only start the service after package is installed if the environment file exists
if [ -f /etc/otel/collector/splunk_env.sh ]; then
if [ -f /etc/otel/collector/splunk_env ]; then
systemctl start splunk-otel-collector.service
fi
fi
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ Description=Splunk OpenTelemetry Collector
After=network.target

[Service]
EnvironmentFile=/etc/otel/collector/splunk_env.sh
ExecStart=/usr/bin/otelcol --config /etc/otel/collector/splunk_config.yaml
EnvironmentFile=/etc/otel/collector/splunk_env
ExecStart=/usr/bin/otelcol $OTELCOL_OPTIONS
KillMode=mixed
Restart=on-failure
Type=simple
Expand Down
21 changes: 21 additions & 0 deletions internal/buildscripts/packaging/fpm/splunk_env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Sample environment file for passing variables to the splunk-otel-collector service.
# See /etc/otel/collector/splunk_config.yaml for how these variables will be consumed.

# To use this file, update the values below appropriately,
# and save the changes to "/etc/otel/collector/splunk_env".

# Then run the following commands to apply the changes and restart the service:
# sudo systemctl daemon-reload
# sudo systemctl restart splunk-otel-collector.service

# Command-line options for the splunk-otel-collector service. Run `/usr/bin/otelcol --help` to see all available options.
OTELCOL_OPTIONS="--config /etc/otel/collector/splunk_config.yaml"

# Access token to authenticate requests.
SPLUNK_ACCESS_TOKEN=12345

# Which realm to send the data to.
SPLUNK_REALM=us0

# How much memory to allocate to the ballast. This should be set to 1/3 to 1/2 of configured memory.
SPLUNK_BALLAST=683
12 changes: 0 additions & 12 deletions internal/buildscripts/packaging/fpm/splunk_env.sh.example

This file was deleted.

2 changes: 1 addition & 1 deletion internal/buildscripts/packaging/fpm/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ if $docker_exec systemctl --no-pager status $SERVICE_NAME; then
fi

# start the service with the sample env file
$docker_exec cp /etc/otel/collector/splunk_env.sh.example /etc/otel/collector/splunk_env.sh
$docker_exec cp /etc/otel/collector/splunk_env.example /etc/otel/collector/splunk_env
$docker_exec systemctl daemon-reload
$docker_exec systemctl start splunk-otel-collector.service

Expand Down

0 comments on commit 389fbb1

Please sign in to comment.