Skip to content

Commit

Permalink
use sidekiq in all envs + amazon storage by default in pro + other sm…
Browse files Browse the repository at this point in the history
…all tweaks
  • Loading branch information
markets committed Feb 12, 2024
1 parent b925110 commit e90d8e2
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
DATABASE_USER=postgres
DATABASE_NAME=timeoverflow_development

#RAILS CONFIG
# Rails settings
RAILS_LOG_LEVEL=debug
STORAGE_PROVIDER=amazon
FORCE_SSL=true
Expand Down
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ source 'https://rubygems.org'

gem 'rails', '~> 7.0.8'
gem 'rails-i18n', '~> 7.0'
gem 'puma', '~> 6.4'
gem 'rdiscount', '~> 2.2.7'
gem 'rubyzip', '~> 2.3.0'
gem 'activeadmin', '~> 2.14'
Expand All @@ -18,15 +19,14 @@ gem 'simple_form', '~> 5.0.2'
gem 'rollbar', '~> 3.4'
gem 'prawn', '~> 2.4.0'
gem 'prawn-table', '~> 0.2.2'
gem 'matrix', '~> 0.4.1' # Ruby 3.1+ support for Prawn, see more: https://github.com/prawnpdf/prawn/issues/1195
gem 'pg_search', '~> 2.3.5'
gem 'skylight', '~> 6.0'
gem 'sidekiq', '~> 6.5'
gem 'sidekiq-cron', '~> 1.9.1'
gem 'aws-sdk-s3', '~> 1.94', require: false
gem 'image_processing', '~> 1.12'
gem 'active_storage_validations', '~> 1.1.3'
gem "puma", ">= 5.0.0"
gem 'matrix', '~> 0.4.1'

# Assets
gem 'jquery-rails', '~> 4.4.0'
Expand Down
9 changes: 6 additions & 3 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ GEM
mime-types-data (3.2023.1205)
mini_magick (4.12.0)
mini_mime (1.1.5)
minitest (5.22.0)
minitest (5.22.2)
msgpack (1.7.2)
net-imap (0.4.10)
date
Expand All @@ -241,6 +241,8 @@ GEM
net-protocol
netrc (0.11.0)
nio4r (2.7.0)
nokogiri (1.16.2-arm64-darwin)
racc (~> 1.4)
nokogiri (1.16.2-x86_64-linux)
racc (~> 1.4)
orm_adapter (0.5.0)
Expand Down Expand Up @@ -425,9 +427,10 @@ GEM
websocket-extensions (0.1.5)
xpath (3.2.0)
nokogiri (~> 1.8)
zeitwerk (2.6.12)
zeitwerk (2.6.13)

PLATFORMS
arm64-darwin-22
x86_64-linux

DEPENDENCIES
Expand Down Expand Up @@ -457,7 +460,7 @@ DEPENDENCIES
pg_search (~> 2.3.5)
prawn (~> 2.4.0)
prawn-table (~> 0.2.2)
puma (>= 5.0.0)
puma (~> 6.4)
pundit (~> 2.1.0)
rails (~> 7.0.8)
rails-controller-testing
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,8 @@ In order to configure the application you can use the following ENV variables:
| `WEB_CONCURRENCY` | Number of web server processes to use | `2` |
| `RUN_SIDEKIQ` | Run Sidekiq worker process in the docker instance (you might want to change this if want to run different docker instances for Sidekiq and Rails) | `true` |
| `RUN_RAILS` | Run Rails web server process in the docker instance | `true` |
| `QUEUE_ADAPTER` | Adapter to use for background jobs (currently the application is using exclusively Sidekiq, so no other options here right now) | `sidekiq` |
| `SIDEKIQ_CONCURRENCY` | Number of threads to use in Sidekiq | `5` |
| `STORAGE_PROVIDER` | Storage provider for the application (currently the application supports `local` and `amazon`) | `local` |
| `STORAGE_PROVIDER` | Storage provider for the application (currently the application supports `local` and `amazon`) | `amazon` |
| `FORCE_SSL` | Force SSL connections | `false` |
| `MAIL_LINK_HOST` | Host to use in the links sent by email (use your domain without protocol `mydomain.tld`) | |
| `MAIL_LINK_PROTOCOL` | Protocol to use in the previous host defined for links sent by email | `https` |
Expand Down
3 changes: 3 additions & 0 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ class Application < Rails::Application
# SKYLIGHT_AUTHENTICATION env var for this to work.
config.skylight.environments += ["staging"]

# ActiveJob configuration
config.active_job.queue_adapter = :sidekiq

# Use db/structure.sql with SQL as schema format
# This is needed to store in the schema SQL statements not covered by the ORM
config.active_record.schema_format = :sql
Expand Down
4 changes: 2 additions & 2 deletions config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX

# Store uploaded files on the local file system (see config/storage.yml for options).
config.active_storage.service = ENV.fetch("STORAGE_PROVIDER", :local)
config.active_storage.service = ENV.fetch("STORAGE_PROVIDER", :amazon)

# Mount Action Cable outside main process or domain.
# config.action_cable.mount_path = nil
Expand All @@ -71,7 +71,7 @@
# config.cache_store = :mem_cache_store

# Use a real queuing backend for Active Job (and separate queues per environment).
config.active_job.queue_adapter = :sidekiq
# config.active_job.queue_adapter = :sidekiq
# config.active_job.queue_name_prefix = "timeoverflow_production"

config.action_mailer.perform_caching = false
Expand Down

0 comments on commit e90d8e2

Please sign in to comment.