Skip to content

Commit

Permalink
Rename zeroconfig config files (#3682)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffreyc-splunk committed Oct 16, 2023
1 parent 6634dd0 commit 79bb99a
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 25 deletions.
16 changes: 5 additions & 11 deletions instrumentation/packaging/fpm/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,8 @@ PKG_URL="https://github.com/signalfx/splunk-otel-collector"
INSTALL_DIR="/usr/lib/splunk-instrumentation"
LIBSPLUNK_INSTALL_PATH="${INSTALL_DIR}/libsplunk.so"
JAVA_AGENT_INSTALL_PATH="${INSTALL_DIR}/splunk-otel-javaagent.jar"
JAVA_CONFIG_REPO_PATH="${FPM_DIR}/zeroconfig_java.conf"
JAVA_CONFIG_INSTALL_PATH="/etc/splunk/zeroconfig_java.conf"
NODE_CONFIG_REPO_PATH="${FPM_DIR}/zeroconfig_node.conf"
NODE_CONFIG_INSTALL_PATH="/etc/splunk/zeroconfig_node.conf"
CONFIG_DIR_REPO_PATH="${FPM_DIR}/etc/splunk/zeroconfig"
CONFIG_DIR_INSTALL_PATH="/etc/splunk/zeroconfig"
EXAMPLES_INSTALL_DIR="${INSTALL_DIR}/examples"
EXAMPLES_DIR="${FPM_DIR}/examples"

Expand Down Expand Up @@ -100,13 +98,9 @@ setup_files_and_permissions() {
download_nodejs_agent "$nodejs_agent_release" "${buildroot}/${NODEJS_AGENT_INSTALL_PATH}"
sudo chmod 644 "$buildroot/$NODEJS_AGENT_INSTALL_PATH"

mkdir -p "$buildroot/$(dirname $JAVA_CONFIG_INSTALL_PATH)"
cp -f "$JAVA_CONFIG_REPO_PATH" "$buildroot/$JAVA_CONFIG_INSTALL_PATH"
sudo chmod 644 "$buildroot/$JAVA_CONFIG_INSTALL_PATH"

mkdir -p "$buildroot/$(dirname $NODE_CONFIG_INSTALL_PATH)"
cp -f "$NODE_CONFIG_REPO_PATH" "$buildroot/$NODE_CONFIG_INSTALL_PATH"
sudo chmod 644 "$buildroot/$NODE_CONFIG_INSTALL_PATH"
mkdir -p "$buildroot/$CONFIG_DIR_INSTALL_PATH"
cp -rf "$CONFIG_DIR_REPO_PATH"/* "$buildroot/$CONFIG_DIR_INSTALL_PATH"/
sudo chmod -R 644 "$buildroot/$CONFIG_DIR_INSTALL_PATH"

mkdir -p "$buildroot/$INSTALL_DIR"
cp -rf "$EXAMPLES_DIR" "$buildroot/$INSTALL_DIR/"
Expand Down
3 changes: 1 addition & 2 deletions instrumentation/packaging/fpm/deb/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ sudo fpm -s dir -t deb -n "$PKG_NAME" -v "$VERSION" -f -p "$OUTPUT_DIR" \
--deb-no-default-config-files \
--depends sed \
--depends grep \
--config-files "$JAVA_CONFIG_INSTALL_PATH" \
--config-files "$NODE_CONFIG_INSTALL_PATH" \
--config-files "$CONFIG_DIR_INSTALL_PATH" \
"$buildroot/"=/

dpkg -c "${OUTPUT_DIR}/${PKG_NAME}_${VERSION}_${ARCH}.deb"
3 changes: 1 addition & 2 deletions instrumentation/packaging/fpm/rpm/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ sudo fpm -s dir -t rpm -n "$PKG_NAME" -v "$VERSION" -f -p "$OUTPUT_DIR" \
--before-remove "$PREUNINSTALL_PATH" \
--depends sed \
--depends grep \
--config-files "$JAVA_CONFIG_INSTALL_PATH" \
--config-files "$NODE_CONFIG_INSTALL_PATH" \
--config-files "$CONFIG_DIR_INSTALL_PATH" \
"$buildroot/"=/

rpm -qpli "${OUTPUT_DIR}/${PKG_NAME}-${VERSION}-1.${ARCH}.rpm"
4 changes: 2 additions & 2 deletions instrumentation/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
static char *const allowed_env_vars[] = {ALLOWED_ENV_VARS};
static size_t const allowed_env_vars_size = sizeof(allowed_env_vars) / sizeof(*allowed_env_vars);

#define JAVA_ENV_VAR_FILE "/etc/splunk/zeroconfig_java.conf"
#define NODEJS_ENV_VAR_FILE "/etc/splunk/zeroconfig_node.conf"
#define JAVA_ENV_VAR_FILE "/etc/splunk/zeroconfig/java.conf"
#define NODEJS_ENV_VAR_FILE "/etc/splunk/zeroconfig/node.conf"

// TODO change to systemd drop in file paths
static char *const env_var_file_java = JAVA_ENV_VAR_FILE;
Expand Down
5 changes: 2 additions & 3 deletions instrumentation/tests/java/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ COPY Main.java .
RUN javac Main.java && \
jar cfe Main.jar Main Main.class

RUN mkdir -p /etc/splunk/
RUN mkdir -p /etc/splunk/zerconfig

COPY zeroconfig.conf /etc/splunk/zeroconfig_java.conf
COPY zeroconfig.conf /etc/splunk/zeroconfig/java.conf

CMD java -jar Main.jar

Expand All @@ -19,4 +19,3 @@ ENV ANOTHER_VAR foo
COPY libsplunk.so /usr/lib/splunk-instrumentation/libsplunk.so

RUN echo /usr/lib/splunk-instrumentation/libsplunk.so >> /etc/ld.so.preload

6 changes: 3 additions & 3 deletions instrumentation/tests/nodejs/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ FROM $BASE

COPY index.js .

RUN mkdir -p /etc/splunk/
RUN mkdir -p /etc/splunk/zeroconfig

COPY zeroconfig.conf /etc/splunk/zeroconfig_node.conf
COPY zeroconfig.conf /etc/splunk/zeroconfig/node.conf

CMD node index.js

COPY libsplunk.so /usr/lib/splunk-instrumentation/libsplunk.so

RUN echo /usr/lib/splunk-instrumentation/libsplunk.so >> /etc/ld.so.preload
RUN echo /usr/lib/splunk-instrumentation/libsplunk.so >> /etc/ld.so.preload
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@
SYSTEMD_CONF_DIR = "/usr/lib/systemd/system.conf.d"

JAVA_AGENT_PATH = "/usr/lib/splunk-instrumentation/splunk-otel-javaagent.jar"
JAVA_CONFIG_PATH = "/etc/splunk/zeroconfig_java.conf"
JAVA_CONFIG_PATH = "/etc/splunk/zeroconfig/java.conf"
CUSTOM_JAVA_CONFIG_PATH = TESTS_DIR / "instrumentation" / "libsplunk-java-test.conf"
SAMPLE_JAVA_SYSTEMD_CONF_PATH = "/usr/lib/splunk-instrumentation/examples/systemd/00-splunk-otel-javaagent.conf"
CUSTOM_JAVA_SYSTEMD_CONF_PATH = TESTS_DIR / "instrumentation" / "systemd-java-test.conf"

NODE_AGENT_PATH = "/usr/lib/splunk-instrumentation/splunk-otel-js.tgz"
NODE_CONFIG_PATH = "/etc/splunk/zeroconfig_node.conf"
NODE_CONFIG_PATH = "/etc/splunk/zeroconfig/node.conf"
CUSTOM_NODE_CONFIG_PATH = TESTS_DIR / "instrumentation" / "libsplunk-node-test.conf"
SAMPLE_NODE_SYSTEMD_CONF_PATH = "/usr/lib/splunk-instrumentation/examples/systemd/00-splunk-otel-js.conf"
CUSTOM_NODE_SYSTEMD_CONF_PATH = TESTS_DIR / "instrumentation" / "systemd-node-test.conf"
Expand Down

0 comments on commit 79bb99a

Please sign in to comment.