mirror of
https://github.com/basecamp/once-campfire.git
synced 2026-09-25 09:44:59 +09:00
Replace Redis with the Solid trifecta
This commit is contained in:
+17
-10
@@ -1,18 +1,25 @@
|
||||
default: &default
|
||||
adapter: redis
|
||||
url: redis://localhost:6379
|
||||
|
||||
# Async adapter only works within the same process, so for manually triggering cable updates from a console,
|
||||
# and seeing results in the browser, you must do so from the web console (running inside the dev process),
|
||||
# not a terminal started via bin/rails console! Add "console" to any action or any ERB template view
|
||||
# to make the web console appear.
|
||||
development:
|
||||
<<: *default
|
||||
channel_prefix: campfire_development
|
||||
adapter: async
|
||||
|
||||
test:
|
||||
adapter: test
|
||||
|
||||
performance:
|
||||
<<: *default
|
||||
channel_prefix: campfire_performance
|
||||
adapter: solid_cable
|
||||
connects_to:
|
||||
database:
|
||||
writing: cable
|
||||
polling_interval: 0.05.seconds
|
||||
message_retention: 1.day
|
||||
|
||||
production:
|
||||
<<: *default
|
||||
channel_prefix: campfire_production
|
||||
adapter: solid_cable
|
||||
connects_to:
|
||||
database:
|
||||
writing: cable
|
||||
polling_interval: 0.05.seconds
|
||||
message_retention: 1.day
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
default: &default
|
||||
store_options:
|
||||
# Cap age of oldest cache entry to fulfill retention policies
|
||||
# max_age: <%= 60.days.to_i %>
|
||||
max_size: <%= 256.megabytes %>
|
||||
namespace: <%= Rails.env %>
|
||||
|
||||
development:
|
||||
database: cache
|
||||
<<: *default
|
||||
|
||||
test:
|
||||
<<: *default
|
||||
|
||||
performance:
|
||||
database: cache
|
||||
<<: *default
|
||||
|
||||
production:
|
||||
database: cache
|
||||
<<: *default
|
||||
@@ -14,6 +14,10 @@ development:
|
||||
primary:
|
||||
<<: *default
|
||||
database: storage/db/development.sqlite3
|
||||
cache:
|
||||
<<: *default
|
||||
database: storage/db/development-cache.sqlite3
|
||||
migrations_paths: db/cache_migrate
|
||||
|
||||
# Warning: The database defined as "test" will be erased and
|
||||
# re-generated from your development database when you run "rake".
|
||||
@@ -27,8 +31,32 @@ performance:
|
||||
primary:
|
||||
<<: *default
|
||||
database: storage/db/performance.sqlite3
|
||||
queue:
|
||||
<<: *default
|
||||
database: storage/db/performance-queue.sqlite3
|
||||
migrations_paths: db/queue_migrate
|
||||
cache:
|
||||
<<: *default
|
||||
database: storage/db/performance-cache.sqlite3
|
||||
migrations_paths: db/cache_migrate
|
||||
cable:
|
||||
<<: *default
|
||||
database: storage/db/performance-cable.sqlite3
|
||||
migrations_paths: db/cable_migrate
|
||||
|
||||
production:
|
||||
primary:
|
||||
<<: *default
|
||||
database: storage/db/production.sqlite3
|
||||
queue:
|
||||
<<: *default
|
||||
database: storage/db/production-queue.sqlite3
|
||||
migrations_paths: db/queue_migrate
|
||||
cache:
|
||||
<<: *default
|
||||
database: storage/db/production-cache.sqlite3
|
||||
migrations_paths: db/cache_migrate
|
||||
cable:
|
||||
<<: *default
|
||||
database: storage/db/production-cable.sqlite3
|
||||
migrations_paths: db/cable_migrate
|
||||
|
||||
@@ -21,7 +21,7 @@ Rails.application.configure do
|
||||
config.action_controller.perform_caching = true
|
||||
config.action_controller.enable_fragment_cache_logging = true
|
||||
|
||||
config.cache_store = :redis_cache_store
|
||||
config.cache_store = :solid_cache_store
|
||||
config.public_file_server.headers = {
|
||||
"cache-control" => "public, max-age=#{2.days.to_i}"
|
||||
}
|
||||
@@ -65,7 +65,7 @@ Rails.application.configure do
|
||||
# config.action_cable.disable_request_forgery_protection = true
|
||||
|
||||
# Uncomment to test with production class job queue
|
||||
# config.active_job.queue_adapter = :resque
|
||||
# config.active_job.queue_adapter = :solid_queue
|
||||
|
||||
# Highlight code that enqueued background job in logs.
|
||||
config.active_job.verbose_enqueue_logs = true
|
||||
|
||||
@@ -68,7 +68,7 @@ Rails.application.configure do
|
||||
config.active_support.report_deprecations = false
|
||||
|
||||
# Cache in memory for now
|
||||
config.cache_store = :redis_cache_store
|
||||
config.cache_store = :solid_cache_store
|
||||
|
||||
# Assets are cacheable
|
||||
config.public_file_server.headers = {
|
||||
@@ -92,5 +92,6 @@ Rails.application.configure do
|
||||
# Only use :id for inspections in production.
|
||||
config.active_record.attributes_for_inspect = [ :id ]
|
||||
|
||||
config.active_job.queue_adapter = :resque
|
||||
config.active_job.queue_adapter = :solid_queue
|
||||
config.solid_queue.connects_to = { database: { writing: :queue } }
|
||||
end
|
||||
|
||||
@@ -35,8 +35,6 @@ pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" }
|
||||
worker_count = (Concurrent.processor_count * 0.666).ceil
|
||||
workers ENV.fetch("WEB_CONCURRENCY") { worker_count }
|
||||
|
||||
ENV["JOB_CONCURRENCY"] ||= worker_count.to_s
|
||||
|
||||
# Use the `preload_app!` method when specifying a `workers` number.
|
||||
# This directive tells Puma to first boot the application and load code
|
||||
# before forking the application. This takes advantage of Copy On Write
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
default: &default
|
||||
dispatchers:
|
||||
- polling_interval: 1
|
||||
batch_size: 500
|
||||
workers:
|
||||
- queues: "*"
|
||||
threads: 3
|
||||
processes: <%= ENV.fetch("JOB_CONCURRENCY") { (Concurrent.processor_count * 0.5).ceil } %>
|
||||
polling_interval: 0.1
|
||||
|
||||
development:
|
||||
<<: *default
|
||||
|
||||
test:
|
||||
<<: *default
|
||||
|
||||
performance:
|
||||
<<: *default
|
||||
|
||||
production:
|
||||
<<: *default
|
||||
@@ -0,0 +1,15 @@
|
||||
# examples:
|
||||
# periodic_cleanup:
|
||||
# class: CleanSoftDeletedRecordsJob
|
||||
# queue: background
|
||||
# args: [ 1000, { batch_size: 500 } ]
|
||||
# schedule: every hour
|
||||
# periodic_cleanup_with_command:
|
||||
# command: "SoftDeletedRecord.due.delete_all"
|
||||
# priority: 2
|
||||
# schedule: at 5am every day
|
||||
|
||||
production:
|
||||
clear_solid_queue_finished_jobs:
|
||||
command: "SolidQueue::Job.clear_finished_in_batches(sleep_between_batches: 0.3)"
|
||||
schedule: every hour at minute 12
|
||||
@@ -1,4 +0,0 @@
|
||||
port 6379
|
||||
daemonize no
|
||||
appendonly no
|
||||
save ""
|
||||
@@ -1 +0,0 @@
|
||||
default: <%= (Concurrent.processor_count * 0.5).ceil %>
|
||||
Reference in New Issue
Block a user