From 2511d21f39db9a1de0b79161a6c2b2dc36d3ada5 Mon Sep 17 00:00:00 2001 From: Adrien POLY Date: Sat, 20 Jan 2024 01:57:52 +0100 Subject: [PATCH] add litestack configuration --- Gemfile | 2 ++ Gemfile.lock | 20 ++++++++++++++++++++ config/cable.yml | 12 ++++++------ config/environments/development.rb | 2 +- config/litecable.yml | 4 ++++ config/litejob.yml | 11 +++++++++++ 6 files changed, 44 insertions(+), 7 deletions(-) create mode 100644 config/litecable.yml create mode 100644 config/litejob.yml diff --git a/Gemfile b/Gemfile index eac1023..41d2c6a 100644 --- a/Gemfile +++ b/Gemfile @@ -97,3 +97,5 @@ gem "dry-types", "~> 1.7" # Avo admin gem "avo", ">= 3.2" gem "ransack", "~> 4.1" + +gem "litestack", "~> 0.4.2" diff --git a/Gemfile.lock b/Gemfile.lock index a709685..11d0a4b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -186,6 +186,10 @@ GEM ffi (1.16.3) globalid (1.2.1) activesupport (>= 6.1) + hanami-router (0.6.2) + hanami-utils (~> 0.7) + http_router (~> 0.11) + hanami-utils (0.9.2) heroicon (1.0.0) rails (>= 5.2) highline (3.0.0) @@ -194,6 +198,9 @@ GEM actioncable (>= 6.0.0) listen (>= 3.0.0) railties (>= 6.0.0) + http_router (0.11.2) + rack (>= 1.0.0) + url_mount (~> 0.2.1) httparty (0.21.0) mini_mime (>= 1.0.0) multi_xml (>= 0.5.2) @@ -246,6 +253,13 @@ GEM listen (3.8.0) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) + litestack (0.4.2) + erubi + hanami-router + oj + rack + sqlite3 + tilt loofah (2.22.0) crass (~> 1.0.2) nokogiri (>= 1.12.0) @@ -291,6 +305,8 @@ GEM racc (~> 1.4) nokogiri (1.16.0-x86_64-linux) racc (~> 1.4) + oj (3.16.3) + bigdecimal (>= 3.0) pagy (6.4.1) parallel (1.24.0) parser (3.3.0.4) @@ -439,6 +455,7 @@ GEM terminal-table (3.0.2) unicode-display_width (>= 1.1.1, < 3) thor (1.3.0) + tilt (2.3.0) timeout (0.4.1) turbo-rails (2.0.0.pre.beta.2) actionpack (>= 6.0.0) @@ -449,6 +466,8 @@ GEM tzinfo (2.0.6) concurrent-ruby (~> 1.0) unicode-display_width (2.5.0) + url_mount (0.2.1) + rack view_component (3.10.0) activesupport (>= 5.2.0, < 8.0) concurrent-ruby (~> 1.0) @@ -496,6 +515,7 @@ DEPENDENCIES jsbundling-rails kamal letter_opener + litestack (~> 0.4.2) magic_test! propshaft puma (>= 5.0) diff --git a/config/cable.yml b/config/cable.yml index 95bac7b..2cdaa39 100644 --- a/config/cable.yml +++ b/config/cable.yml @@ -1,11 +1,11 @@ development: - adapter: redis - url: redis://localhost:6379/1 + adapter: litecable test: - adapter: test + adapter: litecable + +staging: + adapter: litecable production: - adapter: redis - url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %> - channel_prefix: daisy_on_rails_production + adapter: litecable diff --git a/config/environments/development.rb b/config/environments/development.rb index 9dd37d7..52841af 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -24,7 +24,7 @@ config.action_controller.perform_caching = true config.action_controller.enable_fragment_cache_logging = true - config.cache_store = :memory_store + config.cache_store = :litecache, {path: "./storage/cache.development.db"} config.public_file_server.headers = { "Cache-Control" => "public, max-age=#{2.days.to_i}" } diff --git a/config/litecable.yml b/config/litecable.yml new file mode 100644 index 0000000..9f50dfe --- /dev/null +++ b/config/litecable.yml @@ -0,0 +1,4 @@ +path: "./storage/cable.db" + +test: + path: "./storage/cable.test.db" diff --git a/config/litejob.yml b/config/litejob.yml new file mode 100644 index 0000000..c7cfe04 --- /dev/null +++ b/config/litejob.yml @@ -0,0 +1,11 @@ +path: "storage/queue.db" # where the database file resides +queues: + - [default, 1] # default queue with the lowest priority + - [urgent, 10, spawn] # this is not a default, a higher priority queue which will run every job in its own thread or fiber +workers: 5 # how many threads/fibers to spawn for queue processing +retries: 5 # how many times to retry a failed job before giving up +retry_delay: 60 # seconds +retry_delay_multiplier: 10 # 60 -> 600 -> 6000 and so on +dead_job_retention: 864000 # 10 days to keep completely faild jobs in the _dead queue +gc_sleep_interval: 7200 # 2 hours of sleep between checking for dead jobs that are ready to be buried forever +logger: STDOUT # possible values are STDOUT, STDERR, NULL or a file location