897 support heroku redis tls connection #966
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pr is to solve the issue 897 support heroku redis tls connection.
This branch has been update based on the new version. I have rebase rebase this branch on top of master.
I have done two tests.
First test: test the job could be enqueue or not
![d4a58f798121dbbe0d5be187f40332f](https://user-images.githubusercontent.com/127426375/235406534-044aaf1b-1480-4758-9e1b-9c06287bf9d1.png)
Second test: open the democracylab website, login the test account, and then send the email to the volunteer. If the job is enqueued correctly, the rqworker could handle the job. And finally, you could see the email in the rqworker windows rather than the windows you ran python manage.py runserver.
![b95b0c915448f9f646d6ec6901e4fcd](https://user-images.githubusercontent.com/127426375/235406549-070576fd-7494-47a2-85b7-b5785e82ccea.png)
First test's steps:
sudo openssl req -x509 -newkey rsa:4096 -keyout /etc/redis/ssl/redis.key -out /etc/redis/ssl/redis.crt -days 365 -nodes
Add: port 6379
tls-port 6380
tls-cert-file /etc/redis/ssl/redis.crt
tls-key-file /etc/redis/ssl/redis.key
tls-ca-cert-file /etc/redis/ssl/redis.crt
export REDIS_ENABLED='True'
export REDIS_URL='rediss://localhost:6380/0?ssl_cert_reqs=none&ssl_ca_certs=/etc/redis/ssl/redis.crt'
open a window and run:
source ~/Desktop/democracylab_environment_variables.sh
source ~/git/virtualenv/bin/activate
sudo -E redis-server --tls-port 6380 --tls-cert-file /etc/redis/ssl/redis.crt --tls-key-file /etc/redis/ssl/redis.key --tls-ca-cert-file /etc/redis/ssl/redis.crt --tls-auth-clients no --tls-replication yes
open another window and run:
source ~/Desktop/democracylab_environment_variables.sh
source ~/git/virtualenv/bin/activate
cd ~/git/CivicTechExchange
python manage.py rqworker
open third window and run:
source ~/Desktop/democracylab_environment_variables.sh
source ~/git/virtualenv/bin/activate
python manage.py test
Second test's steps:
1-5 steps in first test's step
6. Add an environment variable:
export REDIS_ENABLED='True'
7. restart the vm
open a window and run:
source ~/Desktop/democracylab_environment_variables.sh
source ~/git/virtualenv/bin/activate
sudo -E redis-server --tls-port 6380 --tls-cert-file /etc/redis/ssl/redis.crt --tls-key-file /etc/redis/ssl/redis.key --tls-ca-cert-file /etc/redis/ssl/redis.crt --tls-auth-clients no --tls-replication yes
open another window and run:
source ~/Desktop/democracylab_environment_variables.sh
source ~/git/virtualenv/bin/activate
cd ~/git/CivicTechExchange
python manage.py rqworker
open third window and run:
source ~/Desktop/democracylab_environment_variables.sh
source ~/git/virtualenv/bin/activate
python manage.py runserver
8. open the website and send an email(contact the volunteer)