diff --git a/docker-compose.redis.yml b/docker-compose.redis.yml new file mode 100644 index 000000000..77b86a7e6 --- /dev/null +++ b/docker-compose.redis.yml @@ -0,0 +1,106 @@ +# runs a local version of Epilepsy12 for development on port 8000 +# syncs changes in local code folder to the E12 container +# migrates the database + +version: "3.10" + +services: + # web container - runs the django app + web: + build: . + ports: + - 8000:8000 + links: + - redis + - db + - celery + depends_on: + - db + - redis + volumes: + - .:/app/ + environment: + # these env vars are ONLY for development + - E12_POSTGRES_DB_USER=epilepsy12user + - E12_POSTGRES_DB_PASSWORD=password + - E12_POSTGRES_DB_NAME=epilepsy12db + - E12_POSTGRES_DB_HOST=db + - E12_POSTGRES_DB_PORT=5432 + - E12_SECRET_KEY=mysecretkey + - DEBUG=True + - DJANGO_ALLOWED_HOSTS=0.0.0.0 + - DJANGO_CSRF_TRUSTED_ORIGINS=https://localhost,https://0.0.0.0 + - POSTCODES_IO_API_URL=https://api.postcodes.io/postcodes + - RCPCH_CENSUS_PLATFORM_URL=https://api.rcpch.ac.uk/deprivation/v1 # live + # - RCPCH_CENSUS_PLATFORM_URL=http://0.0.0.0:8001 # development + - RCPCH_HERMES_SERVER_URL=http://rcpch-hermes.uksouth.azurecontainer.io:8080/v1/snomed + - NHS_ODS_API_URL=https://api.nhs.uk/service-search?api-version=2 + # Below ENV vars are only needed for first creation of the superuser + - DJANGO_SUPERUSER_USERNAME=e12-dev-user + - DJANGO_SUPERUSER_PASSWORD=pw + - DJANGO_SUPERUSER_FIRST_NAME=dev + - DJANGO_SUPERUSER_SURNAME=dev + - DJANGO_SUPERUSER_EMAIL=e12-dev-user@rcpch.tech + - DJANGO_SUPERUSER_IS_RCPCH_AUDIT_TEAM_MEMBER=True + - DJANGO_SUPERUSER_ROLE=1 + - CELERY_BROKER_URL=redis://redis:6379/0 + - CELERY_RESULT_BACKEND=redis://redis:6379/0 + env_file: + - .env # env file with the token for RCPCH Census Platform, not committed to Git + command: > + sh -c "python manage.py collectstatic --noinput && + python manage.py migrate && + python manage.py seed --mode=seed_dummy_cases && + python manage.py seed --mode=seed_registrations && + python manage.py seed --mode=seed_groups_and_permissions && + python manage.py createsuperuser --noinput || true && + echo 'DEV SETUP SCRIPT: Development superuser email: e12-dev-user@rcpch.tech' && + echo 'DEV SETUP SCRIPT: Development superuser password: pw' && + python manage.py runserver 0.0.0.0:8000" + + # db container - runs postgres + db: + image: postgis/postgis:15-3.3 + volumes: + - "auditenginedb:/var/lib/postgresql/data" + environment: + - POSTGRES_USER=epilepsy12user + - POSTGRES_PASSWORD=password + - POSTGRES_DB=epilepsy12db + - TZ="Europe/London" + + # this is the redis backend for celery to run async/caching/cron tasks + redis: + image: redis:alpine + expose: + - 6379 + + # This is the celery worker + celery: + restart: always + build: + context: . + command: celery -A rcpch-audit-engine worker -l info + volumes: + - .:/app + environment: + - E12_POSTGRES_DB_USER=epilepsy12user + - E12_POSTGRES_DB_PASSWORD=password + - E12_POSTGRES_DB_NAME=epilepsy12db + - E12_POSTGRES_DB_HOST=db + depends_on: + - db + - redis + + # This is for celery cron tasks + celery-beat: + build: . + command: celery -A rcpch-audit-engine beat -l info + volumes: + - .:/app + depends_on: + - db + - redis + +volumes: + auditenginedb: