From c2f94c34de5f7fa39a7bf51a4d8c8d30c7767674 Mon Sep 17 00:00:00 2001 From: Angel Aviel Domaoan Date: Tue, 1 Mar 2022 07:14:29 +0000 Subject: [PATCH] Implement workers --- Procfile | 1 + Procfile-worker | 1 + config/routes.rb | 3 +++ docker-compose.production.yml | 40 +++++++++++++++++++++++++++++++++++ 4 files changed, 45 insertions(+) create mode 100644 Procfile-worker diff --git a/Procfile b/Procfile index 2fec4ef..33a0e6e 100644 --- a/Procfile +++ b/Procfile @@ -1,2 +1,3 @@ web: rails s webpack: ./bin/webpack-dev-server +worker: bundle exec sidekiq -q default,2 -q mailers,1 -q active_storage_analysis,1 -q active_storage_purge,1 -q sunspot_index,1 diff --git a/Procfile-worker b/Procfile-worker new file mode 100644 index 0000000..b4d8b6d --- /dev/null +++ b/Procfile-worker @@ -0,0 +1 @@ +sidekiq: bundle exec sidekiq $SIDEKIQ_QUEUES diff --git a/config/routes.rb b/config/routes.rb index f43fd07..bdb835e 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -50,4 +50,7 @@ Rails.application.routes.draw do end end end + + require "sidekiq/web" + mount Sidekiq::Web => "/sidekiq" end diff --git a/docker-compose.production.yml b/docker-compose.production.yml index 5322b20..8fd79c0 100644 --- a/docker-compose.production.yml +++ b/docker-compose.production.yml @@ -53,3 +53,43 @@ services: - RAILS_MASTER_KEY=${WEB_RAILS_MASTER_KEY} - RAILS_LOG_TO_STDOUT=true - PORT=80 + worker: + restart: ${WEB_RESTART_MODE} + image: tenshiamd/ruby:2.7-alpine + command: | + bash -c 'bash -s <