Speeding up Ruby on Rails in docker
bundle package
version: “2” services: memcached: image: memcached networks: — back-tier redis: image: redis ports: [“6379”] networks: — back-tier db: image: mysql:5 volumes: — ./sql:/docker-entrypoint-initdb.d — mysql:/var/lib/mysql networks: — back-tier sse: image: mprokopov/sse build: context: sse/. command: “bundle exec rackup — host 0.0.0.0 — port 9292” environment: — RACK_ENV=production ## docker database settings in config.yml ports: — “9292:9292” links: — redis — db depends_on: — db — redis networks: — back-tier — front-tier worker: image: mprokopov/itservice_web_dev command: “bundle exec rake environment resque:work” environment: — QUEUE=* links: — db — redis depends_on: — db — redis networks: — back-tier worker-schedule: image: mprokopov/itservice_web_dev command: “bundle exec rake environment resque:scheduler” links: — db — redis depends_on: — redis networks: — back-tier search: image: mprokopov/itservice_search build: ./search volumes: — search-data:/search depends_on: — db links: — db networks: — back-tier expose: — “9306” web: ports: — “3000:3000” environment: — LETTER_OPENER=letter_opener_web — RAILS_SERVE_STATIC_FILES=true — SLACK_NOTIFICATION=false — EMAIL_NOTIFICATION=false — SLACK_WEBHOOK_CHANNEL=#events_test — STREAM_API=http://localhost:9292 depends_on: — db — redis links: — db — redis — search networks: — back-tier — front-tier volumes: — search-data:/search volumes: search-data: mysql: networks: back-tier: front-tier:
version: “2” services: db: environment: - MYSQL_DATABASE=itservice_development - MYSQL_USER= - MYSQL_ROOT_PASSWORD= - MYSQL_PASSWORD= sse: environment: - MYSQL_DATABASE=itservice_development - MYSQL_USER= - MYSQL_PASSWORD= - MYSQL_HOST=db - REDIS_HOST=redis - RACK_ENV=production ## docker database settings in config.yml worker: environment: - RAILS_ENV=development worker-schedule: environment: - RAILS_ENV=development search: environment: - SPHINX_ENV=development web: image: mprokopov/itservice_web_dev command: bundle exec rails s -b 0.0.0.0 -p 3000 environment: - RAILS_ENV=development - LETTER_OPENER=letter_opener_web - RAILS_SERVE_STATIC_FILES=true - SLACK_NOTIFICATION=false - EMAIL_NOTIFICATION=false - SLACK_WEBHOOK_CHANNEL=#events_test - STREAM_API=http://localhost:9292 - BUNDLE_PATH=/bundle volumes: - bundle:/bundle - ./app:/app volumes: bundle:
docker network connect itservice_front-tier nginx-proxy
It will enable to use nginx-proxy with docker-compose v2 syntax.
Originally published at blog.it-premium.com.ua.