[#446] Redis authentication support

Previously we did not support authentication for redis anywhere. Also in the docker compose we were exposing redis port 6379 without any authentication. In the app side for the connections that app server (for storing keys as well as for socket connections made using action cable) and Sidekiq were making to redis server did not support authentication.

With this commit, we support authentication for redis connections from app side and Sidekiq. This is supported in docker-compose as well.

The changes include :
* Added support for new env variable REDIS_PASSWORD
* This redis password is now supported by action cable connections, Sidekiq connections and app side redis connections
* Since Sidekiq did not have an initializer, added an initializer to pass custom config to Sidekiq (for now it's options for redis)
* Changes in docker-compose to pickup a password set in .env file to protect the redis server running in docker
* Added necessary documentation changes in `docker.md` and `environment-variables.md`
This commit is contained in:
sony-mathew
2020-01-26 22:46:34 +05:45
parent e04ff6441b
commit 2168f823a5
7 changed files with 46 additions and 6 deletions

View File

@@ -7,6 +7,13 @@ title: "Docker Setup and Debugging Guide"
After cloning the repo and installing docker on your machine, run the following command from the root directory of the project.
```bash
cp .env.example .env
```
Make changes to the `.env` file as required [Optional]. If you want to set the password for redis when you run
docker-compose, set any string value to the environment variable `REDIS_PASSWORD` in the `.env` file. which will secure the redis running inside docker-compose with this password. This will be automatically picked up by app server and sidekiq, to authenticate while making connections to redis server.
```bash
docker-compose build
```

View File

@@ -60,7 +60,7 @@ AWS_SECRET_ACCESS_KEY=
AWS_REGION=
```
### Configure Redis URL
### Configure Redis
For development, you can use the following url to connect to redis.
@@ -68,6 +68,13 @@ For development, you can use the following url to connect to redis.
REDIS_URL='redis:://127.0.0.1:6379'
```
To authenticate redis connections made by app server and sidekiq, if it's protected by a password, use the following
environment variable to set the password.
```bash
REDIS_PASSWORD=
```
### Configure Postgres host
You can set the following environment variable to set the host for postgres.