Files
notifications-api/scripts/run_with_docker.sh
David McDonald d567d1529d 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
2022-02-08 17:09:36 +00:00

22 lines
743 B
Bash
Executable File

#!/bin/bash
set -eu
DOCKER_IMAGE_NAME=notifications-api
source environment.sh
# this script should be run from within your virtualenv so you can access the aws cli
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)"}
: "${SQLALCHEMY_DATABASE_URI:=postgresql://postgres@host.docker.internal/notification_api}"
REDIS_URL="redis://host.docker.internal:6379"
docker run -it --rm \
-e AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID \
-e AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY \
-e SQLALCHEMY_DATABASE_URI=$SQLALCHEMY_DATABASE_URI \
-e REDIS_URL=$REDIS_URL \
-v $(pwd):/home/vcap/app \
${DOCKER_IMAGE_NAME} \
${@}