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

PSMDB-1362. Add call home.sh script to PSMDB docker image #925

Merged
merged 1 commit into from
Jan 30, 2024
Merged
Show file tree
Hide file tree
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
9 changes: 9 additions & 0 deletions percona-server-mongodb-4.2/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ ENV FULL_PERCONA_VERSION "$PSMDB_VERSION.$OS_VER"
ENV K8S_TOOLS_VERSION "0.5.0"
ENV PSMDB_REPO release

# Do not report during Docker image creation.
ARG PERCONA_TELEMETRY_DISABLE=1

# check repository package signature in secure way
RUN set -ex; \
export GNUPGHOME="$(mktemp -d)"; \
Expand Down Expand Up @@ -78,6 +81,12 @@ RUN set -ex; \
rm -f /tmp/SHA256SUMS; \
chmod 0755 /usr/local/bin/k8s-mongodb-initiator /usr/local/bin/mongodb-healthcheck

ADD https://raw.githubusercontent.com/Percona-Lab/telemetry-agent/phase-0/call-home.sh /call-home.sh
RUN chmod a+rx call-home.sh
RUN mkdir -p /usr/local/percona
RUN chown 1001:1001 /usr/local/percona
ENV CALL_HOME_OPTIONAL_PARAMS=" -s ${OS_VER}"

VOLUME ["/data/db"]

COPY ps-entry.sh /entrypoint.sh
Expand Down
9 changes: 9 additions & 0 deletions percona-server-mongodb-4.2/Dockerfile.debug
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ LABEL org.opencontainers.image.authors="[email protected]"
LABEL org.label-schema.schema-version=${PSMDB_VERSION}
LABEL org.opencontainers.image.version=${PSMDB_VERSION}

# Do not report during Docker image creation.
ARG PERCONA_TELEMETRY_DISABLE=1

USER 0

RUN set -ex; \
Expand All @@ -41,6 +44,12 @@ RUN set -ex; \
dnf clean all; \
rm -rf /var/cache/dnf /var/cache/yum

ADD https://raw.githubusercontent.com/Percona-Lab/telemetry-agent/phase-0/call-home.sh /call-home.sh
RUN chmod a+rx call-home.sh
RUN mkdir -p /usr/local/percona
RUN chown 1001:1001 /usr/local/percona
ENV CALL_HOME_OPTIONAL_PARAMS=" -s ${OS_VER}"

VOLUME ["/data/db"]

ENTRYPOINT ["/entrypoint.sh"]
Expand Down
9 changes: 9 additions & 0 deletions percona-server-mongodb-4.2/Dockerfile.k8s
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ ENV K8S_TOOLS_VERSION "0.5.0"
LABEL org.label-schema.schema-version=${PSMDB_VERSION}
LABEL org.opencontainers.image.version=${PSMDB_VERSION}

# Do not report during Docker image creation.
ARG PERCONA_TELEMETRY_DISABLE=1

# check repository package signature in secure way
RUN set -ex; \
export GNUPGHOME="$(mktemp -d)"; \
Expand Down Expand Up @@ -103,6 +106,12 @@ RUN set -ex; \
rm -f /tmp/SHA256SUMS; \
chmod 0755 /usr/local/bin/k8s-mongodb-initiator /usr/local/bin/mongodb-healthcheck

ADD https://raw.githubusercontent.com/Percona-Lab/telemetry-agent/phase-0/call-home.sh /call-home.sh
RUN chmod a+rx call-home.sh
RUN mkdir -p /usr/local/percona
RUN chown 1001:1001 /usr/local/percona
ENV CALL_HOME_OPTIONAL_PARAMS=" -s ${OS_VER}"

VOLUME ["/data/db"]

COPY ps-entry.sh /entrypoint.sh
Expand Down
9 changes: 9 additions & 0 deletions percona-server-mongodb-4.2/Dockerfile.ubi8
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ ENV OS_VER el8
ENV FULL_PERCONA_VERSION "$PSMDB_VERSION.$OS_VER"
ENV K8S_TOOLS_VERSION "0.5.0"

# Do not report during Docker image creation.
ARG PERCONA_TELEMETRY_DISABLE=1

# check repository package signature in secure way
RUN set -ex; \
export GNUPGHOME="$(mktemp -d)"; \
Expand Down Expand Up @@ -85,6 +88,12 @@ RUN set -ex; \
rm -f /tmp/SHA256SUMS; \
chmod 0755 /usr/local/bin/k8s-mongodb-initiator /usr/local/bin/mongodb-healthcheck

ADD https://raw.githubusercontent.com/Percona-Lab/telemetry-agent/phase-0/call-home.sh /call-home.sh
RUN chmod a+rx call-home.sh
RUN mkdir -p /usr/local/percona
RUN chown 1001:1001 /usr/local/percona
ENV CALL_HOME_OPTIONAL_PARAMS=" -s ${OS_VER}"

VOLUME ["/data/db"]

COPY ps-entry.sh /entrypoint.sh
Expand Down
30 changes: 29 additions & 1 deletion percona-server-mongodb-4.2/ps-entry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -460,5 +460,33 @@ fi

rm -f "$jsonConfigFile" "$tempConfigFile"

set -o xtrace
set -o xtrace +u

# PERCONA_TELEMETRY_DISABLE is handled at the very beginning of call-home.sh
if [ ! -z "${PERCONA_INSTANCE_ID}" ]; then
CALL_HOME_OPTIONAL_PARAMS+=" -i ${PERCONA_INSTANCE_ID}"
fi

if [ ! -z "${PERCONA_TELEMETRY_CONFIG_FILE_PATH}" ]; then
CALL_HOME_OPTIONAL_PARAMS+=" -j ${PERCONA_TELEMETRY_CONFIG_FILE_PATH}"
fi

if [ ! -z "${PERCONA_TELEMETRY_URL}" ]; then
CALL_HOME_OPTIONAL_PARAMS+=" -u ${PERCONA_TELEMETRY_URL}"
fi

if [ ! -z "${PERCONA_SEND_TIMEOUT}" ]; then
CALL_HOME_OPTIONAL_PARAMS+=" -t ${PERCONA_SEND_TIMEOUT}"
else
CALL_HOME_OPTIONAL_PARAMS+=" -t 7"
fi

if [ ! -z "${PERCONA_CONNECT_TIMEOUT}" ]; then
CALL_HOME_OPTIONAL_PARAMS+=" -c ${PERCONA_CONNECT_TIMEOUT}"
else
CALL_HOME_OPTIONAL_PARAMS+=" -c 2"
fi

/call-home.sh -f "PRODUCT_FAMILY_PSMDB" -v "${PSMDB_VERSION}" -d "DOCKER" ${CALL_HOME_OPTIONAL_PARAMS} &> /dev/null || :

exec "$@"
Loading