version: '3' services: backend: container_name: backend build: context: . dockerfile: docker/dev.Dockerfile # TODO: Try using cache_from pointed at a Docker Hub image built from master # Though may need to also use the workaround for local vs remote: # https://github.com/moby/moby/issues/32612#issuecomment-294055017 # cache_from: TODO image: treeherder-backend environment: # Development/CI-specific environment variables only. # Those that do not vary across environments should go in `Dockerfile`. - BROKER_URL=amqp://guest:guest@rabbitmq// - DATABASE_URL=${DATABASE_URL:-mysql://root@mysql/treeherder} - GITHUB_TOKEN=${GITHUB_TOKEN:-} - UPSTREAM_DATABASE_URL=${UPSTREAM_DATABASE_URL:-} - PERF_SHERIFF_BOT_CLIENT_ID=${PERF_SHERIFF_BOT_CLIENT_ID:-} - PERF_SHERIFF_BOT_ACCESS_TOKEN=${PERF_SHERIFF_BOT_ACCESS_TOKEN:-} - REDIS_URL=redis://redis:6379 - SITE_URL=http://backend:8000/ - LOGGING_LEVEL=INFO - TREEHERDER_DEBUG=True - TREEHERDER_DJANGO_SECRET_KEY=secret-key-of-at-least-50-characters-to-pass-check-deploy - NEW_RELIC_DEVELOPER_MODE=True entrypoint: './docker/entrypoint.sh' command: './manage.py runserver 0.0.0.0:8000' # Django's runserver doesn't listen to the default of SIGTERM, so docker-compose # must send SIGINT instead to avoid waiting 10 seconds for the time out. stop_signal: SIGINT # https://github.com/SeleniumHQ/docker-selenium#running-the-images shm_size: 2g volumes: - .:/app ports: - '8000:8000' depends_on: - mysql - redis - rabbitmq frontend: container_name: frontend # https://hub.docker.com/_/node image: node:12.13.1-alpine environment: # Allows `.neutrinorc.js` to adjust filesystem watching and browser opening behaviour. - IN_DOCKER=1 # Installing JS dependencies at runtime so that they share the `node_modules` from the # host, improving speed (both install and build due to the webpack cache) and ensuring # the host copy stays in sync (for people that switch back and forth between UI-only # and full stack Treeherder development). working_dir: /app command: sh -c "yarn && yarn start --env.BACKEND=http://backend:8000 --host 0.0.0.0" volumes: - .:/app ports: - '5000:5000' mysql: container_name: mysql # https://hub.docker.com/r/library/mysql/ image: mysql:5.7.29 environment: - MYSQL_ALLOW_EMPTY_PASSWORD=true - MYSQL_DATABASE=treeherder volumes: - ./docker/mysql.cnf:/etc/mysql/conf.d/mysql.cnf - mysql_data:/var/lib/mysql ports: - '3306:3306' redis: container_name: redis # https://hub.docker.com/_/redis/ image: redis:5.0.7-alpine # Messages after starting the redis-server # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled. # Hide Redis `notice` log level startup output spam. command: redis-server --loglevel warning ports: - '6379:6379' rabbitmq: container_name: rabbitmq # https://hub.docker.com/r/library/rabbitmq/ image: rabbitmq:3.8-alpine environment: # Hide INFO and WARNING log levels to reduce log spam. - 'RABBITMQ_SERVER_ADDITIONAL_ERL_ARGS=-rabbit log [{console,[{level,error}]}]' ports: - '5672:5672' volumes: # TODO: Experiment with using tmpfs when testing, to speed up database-using Python tests. mysql_data: {}