diff --git a/Procfile.dev b/Procfile.dev index 90f69c8b3..f7c4e6a67 100644 --- a/Procfile.dev +++ b/Procfile.dev @@ -1,3 +1,3 @@ backend: bin/rails s -p 3000 frontend: bin/webpack-dev-server -worker: bundle exec sidekiq \ No newline at end of file +worker: bundle exec sidekiq -C config/sidekiq.yml diff --git a/config/initializers/sidekiq.rb b/config/initializers/sidekiq.rb index 748b1e60c..e14e4c839 100644 --- a/config/initializers/sidekiq.rb +++ b/config/initializers/sidekiq.rb @@ -2,10 +2,11 @@ sidekiq_redis_config = { url: ENV.fetch('REDIS_URL', 'redis://127.0.0.1:6379'), password: ENV.fetch('REDIS_PASSWORD', nil) } + Sidekiq.configure_client do |config| - config.redis = sidekiq_redis_config + config.redis = sidekiq_redis_config.merge(size: 5) end Sidekiq.configure_server do |config| - config.redis = sidekiq_redis_config + config.redis = sidekiq_redis_config.merge(size: 10) end diff --git a/config/sidekiq.yml b/config/sidekiq.yml index 0f8bb4bf2..fa944ddae 100644 --- a/config/sidekiq.yml +++ b/config/sidekiq.yml @@ -4,7 +4,7 @@ # pick it up automatically. --- :verbose: false -:concurrency: 10 +:concurrency: 3 :timeout: 25 # Sidekiq will run this file through ERB when reading it so you can @@ -18,6 +18,6 @@ # you can override concurrency based on environment production: - :concurrency: 3 + :concurrency: 10 staging: - :concurrency: 15 \ No newline at end of file + :concurrency: 5 diff --git a/docker-compose.yaml b/docker-compose.yaml index ce00d4d4e..97f1ac71d 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -13,6 +13,7 @@ services: tty: true stdin_open: true image: chatwoot:development + env_file: .env rails: <<: *base @@ -25,14 +26,15 @@ services: - node_modules:/app/node_modules - packs:/app/public/packs - cache:/app/tmp/cache + - bundle:/usr/local/bundle depends_on: - postgres - redis - webpack - mailhog + - sidekiq ports: - 3000:3000 - env_file: .env environment: - WEBPACKER_DEV_SERVER_HOST=webpack - NODE_ENV=development @@ -40,6 +42,24 @@ services: entrypoint: docker/entrypoints/rails.sh command: ["bundle", "exec", "rails", "s", "-p", "3000", "-b", "0.0.0.0"] + sidekiq: + <<: *base + image: chatwoot-rails:development + volumes: + - ./:/app:delegated + - node_modules:/app/node_modules + - packs:/app/public/packs + - cache:/app/tmp/cache + - bundle:/usr/local/bundle + depends_on: + - postgres + - redis + - mailhog + environment: + - NODE_ENV=development + - RAILS_ENV=development + command: ["bundle", "exec", "sidekiq", "-C", "config/sidekiq.yml"] + webpack: <<: *base build: @@ -51,9 +71,9 @@ services: - node_modules:/app/node_modules # Node modules shared across containers - packs:/app/public/packs - cache:/app/tmp/cache + - bundle:/usr/local/bundle ports: - "3035" # Webpack dev server - env_file: .env environment: - WEBPACKER_DEV_SERVER_HOST=0.0.0.0 - NODE_ENV=development @@ -95,3 +115,4 @@ volumes: packs: node_modules: cache: + bundle: diff --git a/docker/entrypoints/rails.sh b/docker/entrypoints/rails.sh index f1b1efe7f..3774a8b63 100755 --- a/docker/entrypoints/rails.sh +++ b/docker/entrypoints/rails.sh @@ -17,6 +17,8 @@ done echo "Database ready to accept connections." +bundle install + BUNDLE="bundle check" until $BUNDLE