docker-compose.yml 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. version: '3'
  2. services:
  3. mq:
  4. image: rabbitmq:latest
  5. postgres:
  6. image: postgres:latest
  7. environment:
  8. - POSTGRES_HOST=postgres
  9. - POSTGRES_USER=user
  10. - POSTGRES_PASSWORD=pswd
  11. - POSTGRES_DB=replica
  12. - POSTGRES_HOST_AUTH_METHOD=md5
  13. - POSTGRES_INITDB_ARGS=--auth-host=md5
  14. replica:
  15. build:
  16. context: ..
  17. dockerfile: integration_tests/Dockerfile.Replica
  18. restart: always
  19. command: >
  20. bash -c "
  21. dockerize -wait tcp://mq:5672 -wait tcp://postgres:5432 -timeout 60s &&
  22. python manage.py makemigrations --settings=integration_tests.replica_settings &&
  23. python manage.py makemigrations dj_replica --settings=integration_tests.replica_settings &&
  24. python manage.py migrate --settings=integration_tests.replica_settings &&
  25. python manage.py cqrs_consume -w 2 --settings=integration_tests.replica_settings
  26. "
  27. depends_on:
  28. - mq
  29. - postgres
  30. volumes:
  31. - ../dj_cqrs:/replica/dj_cqrs
  32. environment:
  33. - POSTGRES_HOST=postgres
  34. - POSTGRES_USER=user
  35. - POSTGRES_PASSWORD=pswd
  36. - POSTGRES_DB=replica
  37. - CQRS_REPLICA_TRANSPORT=tests.dj.transport.RabbitMQTransportWithEvents
  38. - CQRS_BROKER_URL=amqp://mq:5672/
  39. master:
  40. build:
  41. context: ..
  42. dockerfile: integration_tests/Dockerfile.Master
  43. command: >
  44. bash -c "
  45. dockerize -wait tcp://mq:5672 -wait tcp://postgres:5432 -timeout 60s &&
  46. ./run_integration_tests.sh
  47. "
  48. depends_on:
  49. - mq
  50. - replica
  51. volumes:
  52. - ./tests/:/master/integration_tests/tests
  53. - ../dj_cqrs:/master/dj_cqrs
  54. environment:
  55. - CQRS_MASTER_TRANSPORT=dj_cqrs.transport.RabbitMQTransport
  56. - CQRS_BROKER_URL=amqp://mq:5672/