Skip to content

Commit

Permalink
added support for logging to kafka bus
Browse files Browse the repository at this point in the history
  • Loading branch information
Zakaria-Baani committed Oct 9, 2023
1 parent 593cd4c commit 396d011
Show file tree
Hide file tree
Showing 526 changed files with 123,159 additions and 129 deletions.
29 changes: 26 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,16 @@
#
# Dockerfile for cray-console-node service


# Build will be where we build the go binary
FROM artifactory.algol60.net/csm-docker/stable/registry.suse.com/suse/sle15:15.4 as build
FROM arti.hpc.amslabs.hpecorp.net/csm-docker-remote/stable/registry.suse.com/suse/sle15:15.4 as build

# The current sles15sp4 base image starts with a lock on coreutils, but this prevents a necessary
# security patch from being applied. Thus, adding this command to remove the lock if it is
# present.
RUN zypper --non-interactive removelock coreutils || true


ARG SLES_MIRROR=https://slemaster.us.cray.com/SUSE
ARG ARCH=x86_64
RUN set -eux \
Expand Down Expand Up @@ -59,8 +61,21 @@ RUN set -eux \
# && zypper --non-interactive ar ${SLES_MIRROR}/Updates/SLE-Product-SLES/15-SP4/${ARCH}/update/ sles15sp4-Product-SLES-update \
# && zypper --non-interactive ar ${SLES_MIRROR}/Updates/SLE-INSTALLER/15-SP4/${ARCH}/update/ sles15sp4-SLE-INSTALLER-update \
&& zypper --non-interactive clean \
&& zypper --non-interactive install go1.19
&& zypper --non-interactive install go1.19 \
&& zypper --non-interactive install librdkafka1 \
&& zypper --non-interactive install git gcc-c++ make

RUN git clone https://github.com/confluentinc/librdkafka.git && \
cd librdkafka && \
./configure && \
make && \
make install

# RUN curl -LO https://golang.org/dl/go1.19.linux-amd64.tar.gz
# RUN tar -C /usr/local -xzf go1.19.linux-amd64.tar.gz
# RUN rm go1.19.linux-amd64.tar.gz

# ENV PATH="/usr/local/go/bin:${PATH}"
# Apply security patches
COPY zypper-refresh-patch-clean.sh /
RUN /zypper-refresh-patch-clean.sh && rm /zypper-refresh-patch-clean.sh
Expand All @@ -76,7 +91,9 @@ COPY vendor/ $GOPATH/src
# Build configure_conman
RUN set -ex \
&& go env -w GO111MODULE=auto \
&& go build -v -i -o /app/console_node $GOPATH/src/console_node
&& go build -v -i -o /app/console_node $GOPATH/src/console_node



# NOTE:
# We need to switch to the below image, but for now it does not include the 'nobody' user
Expand All @@ -101,6 +118,7 @@ FROM arti.hpc.amslabs.hpecorp.net/baseos-docker-master-local/sles15sp4:sles15sp4
# present.
RUN zypper --non-interactive removelock coreutils || true


# Install conman application from package
RUN set -eux \
&& zypper --non-interactive install conman less vi openssh jq curl tar
Expand All @@ -115,6 +133,7 @@ RUN /zypper-refresh-patch-clean.sh && rm /zypper-refresh-patch-clean.sh

# Copy in the needed files
COPY --from=build /app/console_node /app/
COPY --from=build /usr/local/lib/librdkafka* /usr/local/lib/
COPY scripts/conman.conf /app/conman_base.conf
COPY scripts/ssh-console /usr/bin

Expand All @@ -126,7 +145,11 @@ USER 65534:65534
ENV VAULT_ADDR="http://cray-vault.vault:8200"
ENV VAULT_SKIP_VERIFY="true"

ENV LD_LIBRARY_PATH=/usr/local/lib
RUN export LD_LIBRARY_PATH=$LD_LIBRARY_PATH

RUN echo 'alias ll="ls -l"' > /app/bashrc
RUN echo 'alias vi="vim"' >> /app/bashrc

# RUN ldd /app/console_node
ENTRYPOINT ["/app/console_node"]
153 changes: 153 additions & 0 deletions Dockerfile-org
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
#
# MIT License
#
# (C) Copyright 2020-2022 Hewlett Packard Enterprise Development LP
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
#
# Dockerfile for cray-console-node service


# Build will be where we build the go binary
FROM arti.hpc.amslabs.hpecorp.net/csm-docker-remote/stable/registry.suse.com/suse/sle15:15.4 as build

# The current sles15sp4 base image starts with a lock on coreutils, but this prevents a necessary
# security patch from being applied. Thus, adding this command to remove the lock if it is
# present.
RUN zypper --non-interactive removelock coreutils || true


ARG SLES_MIRROR=https://slemaster.us.cray.com/SUSE
ARG ARCH=x86_64
RUN set -eux \
&& zypper --non-interactive rr --all \
&& zypper --non-interactive ar ${SLES_MIRROR}/Products/SLE-Module-Basesystem/15-SP4/${ARCH}/product/ sles15sp4-Module-Basesystem-product \
&& zypper --non-interactive ar ${SLES_MIRROR}/Updates/SLE-Module-Basesystem/15-SP4/${ARCH}/update/ sles15sp4-Module-Basesystem-update \
&& zypper --non-interactive ar ${SLES_MIRROR}/Products/SLE-Module-Development-Tools/15-SP4/${ARCH}/product/ sles15sp4-Module-Development-Tools-product \
&& zypper --non-interactive ar ${SLES_MIRROR}/Updates/SLE-Module-Development-Tools/15-SP4/${ARCH}/update/ sles15sp4-Module-Development-Tools-update \
# && zypper --non-interactive ar ${SLES_MIRROR}/Products/SLE-Module-Containers/15-SP4/${ARCH}/product/ sles15sp4-Module-Containers-product \
# && zypper --non-interactive ar ${SLES_MIRROR}/Updates/SLE-Module-Containers/15-SP4/${ARCH}/update/ sles15sp4-Module-Containers-update \
# && zypper --non-interactive ar ${SLES_MIRROR}/Products/SLE-Module-Desktop-Applications/15-SP4/${ARCH}/product/ sles15sp4-Module-Desktop-Applications-product \
# && zypper --non-interactive ar ${SLES_MIRROR}/Updates/SLE-Module-Desktop-Applications/15-SP4/${ARCH}/update/ sles15sp4-Module-Desktop-Applications-update \
# && zypper --non-interactive ar ${SLES_MIRROR}/Products/SLE-Module-HPC/15-SP4/${ARCH}/product/ sles15sp4-Module-HPC-product \
# && zypper --non-interactive ar ${SLES_MIRROR}/Updates/SLE-Module-HPC/15-SP4/${ARCH}/update/ sles15sp4-Module-HPC-update \
# && zypper --non-interactive ar ${SLES_MIRROR}/Products/SLE-Module-Legacy/15-SP4/${ARCH}/product/ sles15sp4-Module-Legacy-product \
# && zypper --non-interactive ar ${SLES_MIRROR}/Updates/SLE-Module-Legacy/15-SP4/${ARCH}/update/ sles15sp4-Module-Legacy-update \
# && zypper --non-interactive ar ${SLES_MIRROR}/Products/SLE-Module-Public-Cloud/15-SP4/${ARCH}/product/ sles15sp4-Module-Public-Cloud-product \
# && zypper --non-interactive ar ${SLES_MIRROR}/Updates/SLE-Module-Public-Cloud/15-SP4/${ARCH}/update/ sles15sp4-Module-Public-Cloud-update \
# && zypper --non-interactive ar ${SLES_MIRROR}/Products/SLE-Module-Python2/15-SP4/${ARCH}/product/ sles15sp4-Module-Python2-product \
# && zypper --non-interactive ar ${SLES_MIRROR}/Updates/SLE-Module-Python2/15-SP4/${ARCH}/update/ sles15sp4-Module-Python2-update \
# && zypper --non-interactive ar ${SLES_MIRROR}/Products/SLE-Module-Server-Applications/15-SP4/${ARCH}/product/ sles15sp4-Module-Server-Applications-product \
# && zypper --non-interactive ar ${SLES_MIRROR}/Updates/SLE-Module-Server-Applications/15-SP4/${ARCH}/update/ sles15sp4-Module-Server-Applications-update \
# && zypper --non-interactive ar ${SLES_MIRROR}/Products/SLE-Module-Web-Scripting/15-SP4/${ARCH}/product/ sles15sp4-Module-Web-Scripting-product \
# && zypper --non-interactive ar ${SLES_MIRROR}/Updates/SLE-Module-Web-Scripting/15-SP4/${ARCH}/update/ sles15sp4-Module-Web-Scripting-update \
# && zypper --non-interactive ar ${SLES_MIRROR}/Products/SLE-Product-SLES/15-SP4/${ARCH}/product/ sles15sp4-Product-SLES-product \
# && zypper --non-interactive ar ${SLES_MIRROR}/Updates/SLE-Product-SLES/15-SP4/${ARCH}/update/ sles15sp4-Product-SLES-update \
# && zypper --non-interactive ar ${SLES_MIRROR}/Updates/SLE-INSTALLER/15-SP4/${ARCH}/update/ sles15sp4-SLE-INSTALLER-update \
&& zypper --non-interactive clean \
&& zypper --non-interactive install go1.19 \
&& zypper --non-interactive install librdkafka1 \
&& zypper --non-interactive install git gcc-c++ make

RUN git clone https://github.com/confluentinc/librdkafka.git && \
cd librdkafka && \
./configure && \
make && \
make install || exit 1

# RUN curl -LO https://golang.org/dl/go1.19.linux-amd64.tar.gz
# RUN tar -C /usr/local -xzf go1.19.linux-amd64.tar.gz
# RUN rm go1.19.linux-amd64.tar.gz

# ENV PATH="/usr/local/go/bin:${PATH}"
# Apply security patches
COPY zypper-refresh-patch-clean.sh /
RUN /zypper-refresh-patch-clean.sh && rm /zypper-refresh-patch-clean.sh

# Configure go env - installed as package but not quite configured
ENV GOPATH=/usr/local/golib
RUN export GOPATH=$GOPATH

# Copy in all the necessary files
COPY src/console_node $GOPATH/src/console_node
COPY vendor/ $GOPATH/src

# Build configure_conman
RUN set -ex \
&& go env -w GO111MODULE=auto \
&& go build -v -i -o /app/console_node $GOPATH/src/console_node



# NOTE:
# We need to switch to the below image, but for now it does not include the 'nobody' user
# and we need to figure out why/how that user was removed from the image.
#FROM artifactory.algol60.net/csm-docker/stable/registry.suse.com/suse/sle15:15.4 as base
#ARG SLES_MIRROR=https://slemaster.us.cray.com/SUSE
#ARG ARCH=x86_64
#RUN set -eux \
# && zypper --non-interactive rr --all \
# && zypper --non-interactive ar ${SLES_MIRROR}/Products/SLE-Module-Basesystem/15-SP4/${ARCH}/product/ sles15sp4-Module-Basesystem-product \
# && zypper --non-interactive ar ${SLES_MIRROR}/Updates/SLE-Module-Basesystem/15-SP4/${ARCH}/update/ sles15sp4-Module-Basesystem-update \
# && zypper --non-interactive ar ${SLES_MIRROR}/Products/SLE-Module-HPC/15-SP4/${ARCH}/product/ sles15sp4-Module-HPC-product \
# && zypper --non-interactive ar ${SLES_MIRROR}/Updates/SLE-Module-HPC/15-SP4/${ARCH}/update/ sles15sp4-Module-HPC-update \
# && zypper --non-interactive install conman less vi openssh jq curl tar

### Final Stage ###
# Start with a fresh image so build tools are not included
FROM arti.hpc.amslabs.hpecorp.net/baseos-docker-master-local/sles15sp4:sles15sp4 as base

# The current sles15sp4 base image starts with a lock on coreutils, but this prevents a necessary
# security patch from being applied. Thus, adding this command to remove the lock if it is
# present.
RUN zypper --non-interactive removelock coreutils || true


# Install conman application from package
RUN set -eux \
&& zypper --non-interactive install conman less vi openssh jq curl tar

# NOTE: polkit is not needed but is included with one of the above packages.
# It has frequent security issues so just remove it here.
RUN zypper --non-interactive rm polkit

# Apply security patches
COPY zypper-refresh-patch-clean.sh /
RUN /zypper-refresh-patch-clean.sh && rm /zypper-refresh-patch-clean.sh

# Copy in the needed files
COPY --from=build /app/console_node /app/
COPY --from=build /usr/local/lib/librdkafka* /usr/local/lib/
COPY scripts/conman.conf /app/conman_base.conf
COPY scripts/ssh-console /usr/bin

# Change ownership of the app dir and switch to user 'nobody'
RUN chown -Rv 65534:65534 /app /etc/conman.conf
USER 65534:65534

# Environment Variables -- Used by the HMS secure storage pkg
ENV VAULT_ADDR="http://cray-vault.vault:8200"
ENV VAULT_SKIP_VERIFY="true"
ENV LD_LIBRARY_PATH=/usr/local/lib:${LD_LIBRARY_PATH}

RUN echo 'alias ll="ls -l"' > /app/bashrc
RUN echo 'alias vi="vim"' >> /app/bashrc

# RUN ldd /app/console_node
ENTRYPOINT ["/app/console_node"]
8 changes: 8 additions & 0 deletions configs/kafka_brokers-local.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[
{
"BrokerAddress": "kafka:9092",
"TopicsToPublish": {
"cray-console-logs": null
}
}
]
32 changes: 32 additions & 0 deletions configs/kafka_brokers-local_dual.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
[
{
"BrokerAddress": "kafka1:9092",
"TopicsToPublish": {
"cray-telemetry-temperature": null,
"cray-telemetry-voltage": null,
"cray-telemetry-power": null,
"cray-telemetry-energy": null,
"cray-telemetry-fan": null,
"cray-telemetry-pressure": null,
"cray-fabric-telemetry": null,
"cray-fabric-perf-telemetry": null,
"cray-fabric-crit-telemetry": null,
"cray-dmtf-resource-event": null
}
},
{
"BrokerAddress": "kafka2:9092",
"TopicsToPublish": {
"cray-telemetry-temperature": null,
"cray-telemetry-voltage": null,
"cray-telemetry-power": null,
"cray-telemetry-energy": null,
"cray-telemetry-fan": null,
"cray-telemetry-pressure": null,
"cray-fabric-telemetry": null,
"cray-fabric-perf-telemetry": null,
"cray-fabric-crit-telemetry": null,
"cray-dmtf-resource-event": null
}
}
]
8 changes: 8 additions & 0 deletions configs/kafka_brokers.template.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"BrokerAddress": "test:1234",
"TopicsToPublish": {
"bar": null,
"baz": null,
"foo": null
}
}
1 change: 1 addition & 0 deletions configs/namespace
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
namespace
1 change: 1 addition & 0 deletions configs/token
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
token
Loading

0 comments on commit 396d011

Please sign in to comment.