Skip to content

Commit e941cda

Browse files
Replace Redis with Solid Cable
1 parent 796175f commit e941cda

File tree

10 files changed

+30
-25
lines changed

10 files changed

+30
-25
lines changed

.env.erb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
RAILS_MASTER_KEY=<%= ENV["RAILS_MASTER_KEY"] %>
2-
REDIS_URL=<%= ENV["REDIS_URL"] %>
32

43
<% ENV["RAILS_ENV"] = "production" %>
54
<% require_relative "config/application" %>

.github/workflows/cd.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,6 @@ jobs:
2121
- name: Setup Docker
2222
uses: docker/setup-buildx-action@v3
2323
- uses: crazy-max/ghaction-github-runtime@v3
24-
- name: Get credentials from Heroku
25-
env:
26-
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
27-
run: |
28-
curl https://cli-assets.heroku.com/install-ubuntu.sh | sudo sh
29-
REDIS_URL=$(heroku config:get REDIS_URL -a hackathons)
30-
echo "REDIS_URL=${REDIS_URL}" >> $GITHUB_ENV
3124
- name: Deploy to production!
3225
run: bundle exec kamal deploy
3326
env:

.kamal/secrets

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ KAMAL_REGISTRY_PASSWORD=$KAMAL_REGISTRY_PASSWORD
33

44
RAILS_MASTER_KEY=$RAILS_MASTER_KEY
55

6-
REDIS_URL=$REDIS_URL
7-
86
LITESTREAM_ACCESS_KEY_ID=$LITESTREAM_ACCESS_KEY_ID
97
LITESTREAM_SECRET_ACCESS_KEY=$LITESTREAM_SECRET_ACCESS_KEY
108
LITESTREAM_BUCKET=$LITESTREAM_BUCKET

Gemfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ gem "dotenv-rails", require: "dotenv/load"
1010
# Drivers
1111
gem "sqlite3"
1212
gem "puma"
13-
gem "redis"
13+
14+
gem "solid_cable"
1415

1516
# Assets
1617
gem "sprockets-rails"

Gemfile.lock

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -376,10 +376,6 @@ GEM
376376
rake (13.2.1)
377377
rdoc (6.10.0)
378378
psych (>= 4.0.0)
379-
redis (5.3.0)
380-
redis-client (>= 0.22.0)
381-
redis-client (0.22.2)
382-
connection_pool
383379
regexp_parser (2.10.0)
384380
reline (0.6.0)
385381
io-console (~> 0.5)
@@ -417,6 +413,11 @@ GEM
417413
simple_form (5.3.1)
418414
actionpack (>= 5.2)
419415
activemodel (>= 5.2)
416+
solid_cable (3.0.5)
417+
actioncable (>= 7.2)
418+
activejob (>= 7.2)
419+
activerecord (>= 7.2)
420+
railties (>= 7.2)
420421
solid_queue (1.1.2)
421422
activejob (>= 7.1)
422423
activerecord (>= 7.1)
@@ -530,8 +531,8 @@ DEPENDENCIES
530531
rack-cors
531532
rack-mini-profiler
532533
rails!
533-
redis
534534
simple_form
535+
solid_cable
535536
solid_queue
536537
sprockets-rails
537538
sqlite3

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,6 @@ brew install vips
6262

6363
**Vendors:**
6464

65-
- Heroku
66-
- Redis (Heroku Data for Redis `premium0`)
6765
- Hetzner
6866
- Runs the Rails app and Solid Queue (3 vCPU, 4 GB)
6967
- Deployed via [Kamal](https://kamal-deploy.org)

config/cable.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ test:
55
adapter: test
66

77
production:
8-
adapter: redis
9-
url: <%= ENV["REDIS_URL"] %>
10-
ssl_params:
11-
verify_mode: <%= OpenSSL::SSL::VERIFY_NONE %>
8+
adapter: solid_cable
9+
connects_to:
10+
database:
11+
writing: cable

config/database.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,10 @@ test:
1212
database: storage/test.sqlite3
1313

1414
production:
15-
<<: *default
16-
database: storage/production.sqlite3
15+
primary:
16+
<<: *default
17+
database: storage/production.sqlite3
18+
cable:
19+
<<: *default
20+
database: storage/production_cable.sqlite3
21+
migrations_paths: db/cable_migrate

config/deploy.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ env:
4040
WEB_CONCURRENCY: 2
4141
secret:
4242
- RAILS_MASTER_KEY
43-
- REDIS_URL
4443

4544
asset_path: "/hackathons/public/assets"
4645
volumes: ["hackathons-storage:/hackathons/storage"]

db/cable_schema.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
ActiveRecord::Schema[7.1].define(version: 1) do
2+
create_table "solid_cable_messages", force: :cascade do |t|
3+
t.binary "channel", limit: 1024, null: false
4+
t.binary "payload", limit: 536870912, null: false
5+
t.datetime "created_at", null: false
6+
t.integer "channel_hash", limit: 8, null: false
7+
t.index ["channel"], name: "index_solid_cable_messages_on_channel"
8+
t.index ["channel_hash"], name: "index_solid_cable_messages_on_channel_hash"
9+
t.index ["created_at"], name: "index_solid_cable_messages_on_created_at"
10+
end
11+
end

0 commit comments

Comments
 (0)