From b4db839a359268390ebc905d36b4ce8ab7ab84fd Mon Sep 17 00:00:00 2001 From: slorello89 Date: Tue, 11 Jul 2023 08:05:23 -0400 Subject: [PATCH] pre-commit --- .github/workflows/ci.yml | 2 +- README.md | 4 ++-- examples/tls/Dockerfile | 10 +++++----- examples/tls/test.sh | 2 +- src/redis_cache.cc | 7 ++++--- 5 files changed, 13 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 33ea57b..10aec9d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,7 +7,7 @@ on: branches: ['main'] jobs: tls: - runs-on: ubuntu-latest + runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: install dependencies diff --git a/README.md b/README.md index 20e69ad..5ca79e4 100644 --- a/README.md +++ b/README.md @@ -110,8 +110,8 @@ Optionally you may configure your `user`/`password` via environment variables. T ### TLS -Transport Layer Security (TLS) can be enabled in Redis and within the Triton Redis Cache, to do so you will need a TLS -enabled version of Redis, e.g. [OSS Redis](https://redis.io/docs/management/security/encryption/) or +Transport Layer Security (TLS) can be enabled in Redis and within the Triton Redis Cache, to do so you will need a TLS +enabled version of Redis, e.g. [OSS Redis](https://redis.io/docs/management/security/encryption/) or [Redis Enterprise](https://docs.redis.com/latest/rs/security/tls/enable-tls/). You will also need to configure Triton Server to use TLS with Redis through the following `--cache-config` TLS options. diff --git a/examples/tls/Dockerfile b/examples/tls/Dockerfile index bb0b75f..fb8b0b2 100644 --- a/examples/tls/Dockerfile +++ b/examples/tls/Dockerfile @@ -1,9 +1,9 @@ -FROM nvcr.io/nvidia/tritonserver:23.03-py3-sdk +FROM nvcr.io/nvidia/tritonserver:23.06-py3-sdk -RUN apt install -y lsb-release curl gpg -RUN curl -fsSL https://packages.redis.io/gpg | gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg -RUN echo "deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/redis.list -RUN apt-get update +RUN apt install -y lsb-release curl gpg +RUN curl -fsSL https://packages.redis.io/gpg | gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg +RUN echo "deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/redis.list +RUN apt-get update RUN apt-get install -y redis CMD "/app/test.sh" \ No newline at end of file diff --git a/examples/tls/test.sh b/examples/tls/test.sh index 32e281e..035fffb 100755 --- a/examples/tls/test.sh +++ b/examples/tls/test.sh @@ -9,7 +9,7 @@ fi numKeys=$(redis-cli -h triton-redis --tls --cert /certs/redis.crt --key /certs/redis.key --cacert /certs/ca.crt DBSIZE) # check that there's only one key -if [[ $numKeys -eq 1 ]]; then +if [[ $numKeys -eq 1 ]]; then exit 0 else echo "Redis did not have the expected number of keys." diff --git a/src/redis_cache.cc b/src/redis_cache.cc index 717d4f1..007435e 100644 --- a/src/redis_cache.cc +++ b/src/redis_cache.cc @@ -146,9 +146,10 @@ RedisCache::Create( poolOptions.wait_timeout = std::chrono::milliseconds(1000); } - //tls options - if(document.HasMember("tls_enabled")){ - options.tls.enabled = strcmp(document["tls_enabled"].GetString(), "true") == 0; + // tls options + if (document.HasMember("tls_enabled")) { + options.tls.enabled = + strcmp(document["tls_enabled"].GetString(), "true") == 0; setOption("cert", options.tls.cert, document); setOption("key", options.tls.key, document); setOption("cacert", options.tls.cacert, document);