Skip to content

Commit

Permalink
Merge pull request #326 from blackcandy-org/litestack
Browse files Browse the repository at this point in the history
Use litestack as default stack
  • Loading branch information
aidewoode committed Dec 8, 2023
2 parents 2597f91 + 4877dcb commit bdabe71
Show file tree
Hide file tree
Showing 10 changed files with 51 additions and 18 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Expand Up @@ -12,6 +12,7 @@
/public/uploads/
/test
/screenshots
/coverage
/.github
/config/master.key
/.direnv
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Expand Up @@ -32,7 +32,7 @@ COPY . /app

RUN SECRET_KEY_BASE_DUMMY=1 bundle exec rails assets:precompile \
&& yarn cache clean \
&& rm -rf node_modules tmp/cache/* /tmp/* yarn.lock log/production.log app/javascript/* app/assets/*
&& rm -rf node_modules tmp/cache/* /tmp/* yarn.lock log/production.log app/javascript/* app/assets/* storage/*


FROM base
Expand Down
18 changes: 9 additions & 9 deletions Gemfile
Expand Up @@ -28,15 +28,9 @@ gem "jbuilder", "~> 2.11.5"
# Get meta data from audio file
gem "wahwah", "~> 1.5.0"

# Use sidekiq for backgroud job
gem "sidekiq", "~> 7.1.2"

# Pagination
gem "pagy", "~> 6.0.0"

# Use redis on cache and sidekiq
gem "redis", "~> 4.0"

# For image attachment
gem "carrierwave", "~> 3.0.0"

Expand All @@ -58,11 +52,17 @@ gem "bcrypt", "~> 3.1.11"
# For sync on library changes
gem "listen", "~> 3.8.0"

# For postgresql database adapter
# Default stack for database, cache, background job and pub/sub
gem "litestack", "~> 0.4.2"

# Optional support for sidekiq as background job
gem "sidekiq", "~> 7.1.2"

# Optional support for postgresql as database
gem "pg", "~> 1.3.2"

# For sqlite database adapter
gem "sqlite3", "~> 1.6.3"
# Optional support for redis as cache and pub/sub
gem "redis", "~> 4.0"

# Reduces boot times through caching; required in config/boot.rb
gem "bootsnap", "~> 1.17.0", require: false
Expand Down
23 changes: 21 additions & 2 deletions Gemfile.lock
Expand Up @@ -149,7 +149,14 @@ 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)
hashdiff (1.0.1)
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)
Expand Down Expand Up @@ -183,6 +190,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.21.4)
crass (~> 1.0.2)
nokogiri (>= 1.12.0)
Expand Down Expand Up @@ -217,6 +231,8 @@ GEM
nokogiri (1.15.4)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
oj (3.16.2)
bigdecimal (~> 3.1)
pagy (6.0.4)
parallel (1.23.0)
parser (3.2.2.4)
Expand Down Expand Up @@ -325,7 +341,7 @@ GEM
simplecov-lcov (0.8.0)
simplecov_json_formatter (0.1.4)
smart_properties (1.17.0)
sqlite3 (1.6.7)
sqlite3 (1.6.9)
mini_portile2 (~> 2.8.0)
sshkit (1.21.5)
net-scp (>= 1.1.2)
Expand All @@ -342,6 +358,7 @@ GEM
railties (>= 6.0.0)
stringio (3.0.8)
thor (1.3.0)
tilt (2.3.0)
timeout (0.4.0)
turbo-rails (1.4.0)
actionpack (>= 6.0.0)
Expand All @@ -351,6 +368,8 @@ GEM
concurrent-ruby (~> 1.0)
unicode-display_width (2.5.0)
uniform_notifier (1.16.0)
url_mount (0.2.1)
rack
wahwah (1.5.1)
web-console (4.2.1)
actionview (>= 6.0.0)
Expand Down Expand Up @@ -389,6 +408,7 @@ DEPENDENCIES
jsbundling-rails (~> 1.1.2)
kamal (~> 0.16.1)
listen (~> 3.8.0)
litestack (~> 0.4.2)
memory_profiler (~> 0.9.13)
pagy (~> 6.0.0)
pg (~> 1.3.2)
Expand All @@ -400,7 +420,6 @@ DEPENDENCIES
sidekiq (~> 7.1.2)
simplecov (~> 0.22.0)
simplecov-lcov (~> 0.8.0)
sqlite3 (~> 1.6.3)
standard (~> 1.25.0)
standard-rails
stimulus-rails (~> 1.2.1)
Expand Down
4 changes: 2 additions & 2 deletions config/cable.yml
@@ -1,5 +1,5 @@
development:
adapter: async
adapter: litecable

test:
adapter: test
Expand All @@ -11,5 +11,5 @@ production:
channel_prefix: black_candy_production
<% else %>
production:
adapter: async
adapter: litecable
<% end %>
2 changes: 1 addition & 1 deletion config/database.yml
@@ -1,5 +1,5 @@
sqlite_default: &sqlite_default
adapter: sqlite3
adapter: litedb
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
timeout: 5000

Expand Down
2 changes: 1 addition & 1 deletion config/environments/development.rb
Expand Up @@ -68,7 +68,7 @@

config.action_controller.action_on_unpermitted_parameters = :raise

config.active_job.queue_adapter = :async
config.active_job.queue_adapter = :litejob

config.after_initialize do
Bullet.enable = true
Expand Down
4 changes: 2 additions & 2 deletions config/environments/production.rb
Expand Up @@ -62,10 +62,10 @@
config.log_level = ENV.fetch("RAILS_LOG_LEVEL", "info")

# Use a different cache store in production.
config.cache_store = BlackCandy::Config.redis_cache_url.present? ? [:redis_cache_store, {url: BlackCandy::Config.redis_cache_url}] : [:file_store, "#{root}/tmp/cache/"]
config.cache_store = BlackCandy::Config.redis_cache_url.present? ? [:redis_cache_store, {url: BlackCandy::Config.redis_cache_url}] : [:litecache, {path: "storage/production_cache.sqlite3"}]

# Use a real queuing backend for Active Job (and separate queues per environment).
config.active_job.queue_adapter = BlackCandy::Config.redis_sidekiq_url.present? ? :sidekiq : :async
config.active_job.queue_adapter = BlackCandy::Config.redis_sidekiq_url.present? ? :sidekiq : :litejob

config.active_job.queue_name_prefix = "black_candy_production"

Expand Down
5 changes: 5 additions & 0 deletions config/litecable.yml
@@ -0,0 +1,5 @@
development:
path: storage/development_cable.sqlite3

production:
path: storage/production_cable.sqlite3
8 changes: 8 additions & 0 deletions config/litejob.yml
@@ -0,0 +1,8 @@
development:
path: storage/development_queue.sqlite3

test:
path: storage/test_queue.sqlite3

production:
path: storage/production_queue.sqlite3

0 comments on commit bdabe71

Please sign in to comment.