mirror of
https://github.com/GSA/notifications-api.git
synced 2026-09-05 14:28:25 -04:00
Improve running redis locally
- adds simple explicit instructions for how to install and run redis - gets celery running in docker able to talk to redis running natively on your machine as per https://docs.docker.com/desktop/mac/networking/#i-want-to-connect-from-a-container-to-a-service-on-the-host
This commit is contained in:
12
README.md
12
README.md
@@ -61,10 +61,18 @@ export PATH=${PATH}:/Applications/Postgres.app/Contents/Versions/11/bin/
|
|||||||
|
|
||||||
### Redis
|
### Redis
|
||||||
|
|
||||||
To switch redis on you'll need to install it locally. On a OSX we've used brew for this. To use redis caching you need to switch it on by changing the config for development:
|
You can run redis locally using
|
||||||
|
|
||||||
REDIS_ENABLED = True
|
```
|
||||||
|
brew install redis
|
||||||
|
redis-server
|
||||||
|
```
|
||||||
|
|
||||||
|
To get the API to use redis locally you need to change the config for development:
|
||||||
|
|
||||||
|
```
|
||||||
|
REDIS_ENABLED = True
|
||||||
|
```
|
||||||
|
|
||||||
## To run the application
|
## To run the application
|
||||||
|
|
||||||
|
|||||||
@@ -428,7 +428,7 @@ class Development(Config):
|
|||||||
NOTIFY_EMAIL_DOMAIN = "notify.tools"
|
NOTIFY_EMAIL_DOMAIN = "notify.tools"
|
||||||
|
|
||||||
SQLALCHEMY_DATABASE_URI = os.getenv('SQLALCHEMY_DATABASE_URI', 'postgresql://localhost/notification_api')
|
SQLALCHEMY_DATABASE_URI = os.getenv('SQLALCHEMY_DATABASE_URI', 'postgresql://localhost/notification_api')
|
||||||
REDIS_URL = 'redis://localhost:6379/0'
|
REDIS_URL = os.getenv('REDIS_URL', 'redis://localhost:6379/0')
|
||||||
|
|
||||||
ANTIVIRUS_ENABLED = os.getenv('ANTIVIRUS_ENABLED') == '1'
|
ANTIVIRUS_ENABLED = os.getenv('ANTIVIRUS_ENABLED') == '1'
|
||||||
|
|
||||||
|
|||||||
@@ -9,11 +9,13 @@ source environment.sh
|
|||||||
AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID:-"$(aws configure get aws_access_key_id)"}
|
AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID:-"$(aws configure get aws_access_key_id)"}
|
||||||
AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY:-"$(aws configure get aws_secret_access_key)"}
|
AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY:-"$(aws configure get aws_secret_access_key)"}
|
||||||
: "${SQLALCHEMY_DATABASE_URI:=postgresql://postgres@host.docker.internal/notification_api}"
|
: "${SQLALCHEMY_DATABASE_URI:=postgresql://postgres@host.docker.internal/notification_api}"
|
||||||
|
REDIS_URL="redis://host.docker.internal:6379"
|
||||||
|
|
||||||
docker run -it --rm \
|
docker run -it --rm \
|
||||||
-e AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID \
|
-e AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID \
|
||||||
-e AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY \
|
-e AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY \
|
||||||
-e SQLALCHEMY_DATABASE_URI=$SQLALCHEMY_DATABASE_URI \
|
-e SQLALCHEMY_DATABASE_URI=$SQLALCHEMY_DATABASE_URI \
|
||||||
|
-e REDIS_URL=$REDIS_URL \
|
||||||
-v $(pwd):/home/vcap/app \
|
-v $(pwd):/home/vcap/app \
|
||||||
${DOCKER_IMAGE_NAME} \
|
${DOCKER_IMAGE_NAME} \
|
||||||
${@}
|
${@}
|
||||||
|
|||||||
Reference in New Issue
Block a user