diff --git a/fetch-validator-status/Dockerfile b/fetch-validator-status/Dockerfile index 9ea903a..f08e175 100644 --- a/fetch-validator-status/Dockerfile +++ b/fetch-validator-status/Dockerfile @@ -1,4 +1,59 @@ -FROM bcgovimages/von-image:next-1 +FROM python:3.10-slim-bullseye + +ARG uid=1001 +ARG user=indy +ARG tag_name=indy-node-monitor +ARG tag_version= + +ENV HOME="/home/$user" \ + APP_ROOT="$HOME" \ + LC_ALL=C.UTF-8 \ + LANG=C.UTF-8 \ + PIP_NO_CACHE_DIR=off \ + PYTHONUNBUFFERED=1 \ + PYTHONIOENCODING=UTF-8 \ + RUST_LOG=warning \ + SHELL=/bin/bash \ + SUMMARY="Indy Node Monitor" \ + DESCRIPTION="A container for monitoring the nodes of an Indy Node network." + +LABEL summary="$SUMMARY" \ + description="$DESCRIPTION" \ + io.k8s.description="$DESCRIPTION" \ + io.k8s.display-name="$tag_name $tag_version" \ + name="$tag_name" \ + version="$tag_version" \ + maintainer="" + +# Add local binaries and aliases to path +ENV PATH="$HOME/.local/bin:$PATH" + +# Make libraries resolvable by python +ENV LD_LIBRARY_PATH="$HOME/.local/lib:$LD_LIBRARY_PATH" +RUN echo "$HOME/.local/lib" > /etc/ld.so.conf.d/local.conf && ldconfig + +# Add indy user +RUN useradd -U -ms /bin/bash -u $uid $user +WORKDIR $HOME + +# - In order to drop the root user, we have to make some directories writable +# to the root group as OpenShift default security model is to run the container +# under random UID. +RUN usermod -a -G 0 indy + +# Create standard directories to allow volume mounting and set permissions +# Note: PIP_NO_CACHE_DIR environment variable should be cleared to allow caching +RUN mkdir -p \ + $HOME/log \ + $(python -m site --user-site) + +# The root group needs access the directories under $HOME for the container to function in OpenShift. +# Also ensure the permissions on the python 'site-packages' folder are set correctly. +RUN chown -R indy:root $HOME && \ + chmod -R ug+rw $HOME && \ + chmod +rx $(python -m site --user-site) + +USER $user ADD requirements.txt . RUN pip3 install --upgrade pip diff --git a/fetch-validator-status/requirements.txt b/fetch-validator-status/requirements.txt index fd5f597..0ed2289 100644 --- a/fetch-validator-status/requirements.txt +++ b/fetch-validator-status/requirements.txt @@ -4,4 +4,7 @@ gspread oauth2client fastapi uvicorn -gunicorn \ No newline at end of file +gunicorn + +base58 +indy-vdr \ No newline at end of file diff --git a/telegraf/telegraf.conf b/telegraf/telegraf.conf index f6fc45f..339bdcf 100644 --- a/telegraf/telegraf.conf +++ b/telegraf/telegraf.conf @@ -507,4 +507,4 @@ ## 1. Local -- interpret based on machine localtime ## 2. "America/New_York" -- Unix TZ values like those found in https://en.wikipedia.org/wiki/List_of_tz_database_time_zones ## 3. UTC -- or blank/unspecified, will return timestamp in UTC - json_timezone = "" \ No newline at end of file + json_timezone = ""