diff --git a/.env.erb b/.env.erb index bfdf39a4..a8b9babd 100644 --- a/.env.erb +++ b/.env.erb @@ -1,5 +1,4 @@ RAILS_MASTER_KEY=<%= ENV["RAILS_MASTER_KEY"] %> -REDIS_URL=<%= ENV["REDIS_URL"] %> <% ENV["RAILS_ENV"] = "production" %> <% require_relative "config/application" %> diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index ef860414..1efa7e69 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -21,13 +21,6 @@ jobs: - name: Setup Docker uses: docker/setup-buildx-action@v3 - uses: crazy-max/ghaction-github-runtime@v3 - - name: Get credentials from Heroku - env: - HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }} - run: | - curl https://cli-assets.heroku.com/install-ubuntu.sh | sudo sh - REDIS_URL=$(heroku config:get REDIS_URL -a hackathons) - echo "REDIS_URL=${REDIS_URL}" >> $GITHUB_ENV - name: Deploy to production! run: bundle exec kamal deploy env: diff --git a/.kamal/secrets b/.kamal/secrets index 4f9afe72..cd533d83 100644 --- a/.kamal/secrets +++ b/.kamal/secrets @@ -3,8 +3,6 @@ KAMAL_REGISTRY_PASSWORD=$KAMAL_REGISTRY_PASSWORD RAILS_MASTER_KEY=$RAILS_MASTER_KEY -REDIS_URL=$REDIS_URL - LITESTREAM_ACCESS_KEY_ID=$LITESTREAM_ACCESS_KEY_ID LITESTREAM_SECRET_ACCESS_KEY=$LITESTREAM_SECRET_ACCESS_KEY LITESTREAM_BUCKET=$LITESTREAM_BUCKET diff --git a/Gemfile b/Gemfile index f18c78c2..4b8b8589 100644 --- a/Gemfile +++ b/Gemfile @@ -10,7 +10,8 @@ gem "dotenv-rails", require: "dotenv/load" # Drivers gem "sqlite3" gem "puma" -gem "redis" + +gem "solid_cable" # Assets gem "sprockets-rails" diff --git a/Gemfile.lock b/Gemfile.lock index 4cafe4a1..b2ca4602 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -376,10 +376,6 @@ GEM rake (13.2.1) rdoc (6.10.0) psych (>= 4.0.0) - redis (5.3.0) - redis-client (>= 0.22.0) - redis-client (0.22.2) - connection_pool regexp_parser (2.10.0) reline (0.6.0) io-console (~> 0.5) @@ -417,6 +413,11 @@ GEM simple_form (5.3.1) actionpack (>= 5.2) activemodel (>= 5.2) + solid_cable (3.0.5) + actioncable (>= 7.2) + activejob (>= 7.2) + activerecord (>= 7.2) + railties (>= 7.2) solid_queue (1.1.2) activejob (>= 7.1) activerecord (>= 7.1) @@ -530,8 +531,8 @@ DEPENDENCIES rack-cors rack-mini-profiler rails! - redis simple_form + solid_cable solid_queue sprockets-rails sqlite3 diff --git a/README.md b/README.md index 51fc3ded..3df03655 100644 --- a/README.md +++ b/README.md @@ -62,8 +62,6 @@ brew install vips **Vendors:** -- Heroku - - Redis (Heroku Data for Redis `premium0`) - Hetzner - Runs the Rails app and Solid Queue (3 vCPU, 4 GB) - Deployed via [Kamal](https://kamal-deploy.org) diff --git a/config/cable.yml b/config/cable.yml index f57f96b9..fd924c75 100644 --- a/config/cable.yml +++ b/config/cable.yml @@ -5,7 +5,7 @@ test: adapter: test production: - adapter: redis - url: <%= ENV["REDIS_URL"] %> - ssl_params: - verify_mode: <%= OpenSSL::SSL::VERIFY_NONE %> + adapter: solid_cable + connects_to: + database: + writing: cable diff --git a/config/database.yml b/config/database.yml index 5ef7c10f..a5326d38 100644 --- a/config/database.yml +++ b/config/database.yml @@ -12,5 +12,10 @@ test: database: storage/test.sqlite3 production: - <<: *default - database: storage/production.sqlite3 + primary: + <<: *default + database: storage/production.sqlite3 + cable: + <<: *default + database: storage/production_cable.sqlite3 + migrations_paths: db/cable_migrate diff --git a/config/deploy.yml b/config/deploy.yml index 5fb6be56..27043c61 100644 --- a/config/deploy.yml +++ b/config/deploy.yml @@ -40,7 +40,6 @@ env: WEB_CONCURRENCY: 2 secret: - RAILS_MASTER_KEY - - REDIS_URL asset_path: "/hackathons/public/assets" volumes: ["hackathons-storage:/hackathons/storage"] diff --git a/db/cable_schema.rb b/db/cable_schema.rb new file mode 100644 index 00000000..23666604 --- /dev/null +++ b/db/cable_schema.rb @@ -0,0 +1,11 @@ +ActiveRecord::Schema[7.1].define(version: 1) do + create_table "solid_cable_messages", force: :cascade do |t| + t.binary "channel", limit: 1024, null: false + t.binary "payload", limit: 536870912, null: false + t.datetime "created_at", null: false + t.integer "channel_hash", limit: 8, null: false + t.index ["channel"], name: "index_solid_cable_messages_on_channel" + t.index ["channel_hash"], name: "index_solid_cable_messages_on_channel_hash" + t.index ["created_at"], name: "index_solid_cable_messages_on_created_at" + end +end