You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I set a password on my redis database by adding command: ["redis-server"] and args = ["--requirepass " ] to the azure-vote-back container specification in my copy of azure-vote-all-in-one-redis.yml. I was able to validate with redis-cli AUTH on that container that the password was really set.
I also added the extra environment variable, REDIS_PWD, that was referenced in main.py in the azure-vote-front container and set it to the same password.
However, the azure-vote-front app could not connect to the redis database. It gave the error: "redis.exceptions.ResponseError: NOAUTH Authentication required."
But when I used kubectl exec cats-and-dogs-front -i -t -- bash to access the container and used apt-get update and apt-get install redis-tools and then used redis-cli against the correct host and port, I was able to connect. I was also able to run the AUTH command and authenticate. Additionally, I could see that REDIS_PWD was set with the correct password by running env | grep REDIS.
My conclusion was that the redis password was being set correctly both in the front and back apps and that I did not have a connectivity issue between the containers themselves (since redis-cli worked). So, I concluded that something must be wrong with the python code.
I researched the redis-py module being used and found docs at https://redis-py.readthedocs.io/en/latest/ which suggested that redis.Redis() is provided for backwards compatibility with older versions of redis-py and that redis.StrictRedis() is preferred.
So, I changed the code to use redis.StrictRedis instead of redis.Redis when the REDIS_PWD environment variable is set.
I built my own docker image at rberlind/azure-vote-front:redis-pwd and modified the yml file to use that image. Everything then worked.
I will submit a pull request.
The text was updated successfully, but these errors were encountered:
I set a password on my redis database by adding command: ["redis-server"] and args = ["--requirepass " ] to the azure-vote-back container specification in my copy of azure-vote-all-in-one-redis.yml. I was able to validate with redis-cli AUTH on that container that the password was really set.
I also added the extra environment variable, REDIS_PWD, that was referenced in main.py in the azure-vote-front container and set it to the same password.
However, the azure-vote-front app could not connect to the redis database. It gave the error: "redis.exceptions.ResponseError: NOAUTH Authentication required."
But when I used
kubectl exec cats-and-dogs-front -i -t -- bash
to access the container and used apt-get update and apt-get install redis-tools and then used redis-cli against the correct host and port, I was able to connect. I was also able to run the AUTH command and authenticate. Additionally, I could see that REDIS_PWD was set with the correct password by runningenv | grep REDIS
.My conclusion was that the redis password was being set correctly both in the front and back apps and that I did not have a connectivity issue between the containers themselves (since redis-cli worked). So, I concluded that something must be wrong with the python code.
I researched the redis-py module being used and found docs at https://redis-py.readthedocs.io/en/latest/ which suggested that redis.Redis() is provided for backwards compatibility with older versions of redis-py and that redis.StrictRedis() is preferred.
So, I changed the code to use redis.StrictRedis instead of redis.Redis when the REDIS_PWD environment variable is set.
I built my own docker image at rberlind/azure-vote-front:redis-pwd and modified the yml file to use that image. Everything then worked.
I will submit a pull request.
The text was updated successfully, but these errors were encountered: