Replacing Redis-To-Go Heroku Add-on

Wheel Run Content Team

Wheel Run Content Team

Jul 22, 2022

Introduction

Heroku Add-on goes off on August 8th, 2022. Hence we have to replace it with another service.

Which Service?

We decided to go with the Heroku Data For Redis.

Steps We Followed

CHANGE CONFIG TO USE REDIS_URL

We had to change the config/cable.yml file to reference the REDIS_URL and not the REDIS_TO_GO_URL.

# config/cable.yml
# ...
production:
  adapter: any_cable
  url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %>
  channel_prefix: wheel_run_backend_api_production

DEPLOY NEW CONFIGURATION

After we created a PR and waited for the tests to run successfully, then we used the script:

$ ./bin/deploy.rb

to deploy to production.

Note: In the future, we might want to use Github actions to do the deployment.

STOP DYNOS FROM RUNNING.

We wanted to make sure that the application is not servicing any clients.

First the Ruby on Rails server:

$ heroku ps:scale web=0 worker=0 --app wheel-run-backend-api

Then, the AnyCable (WebSockets) Server

$ heroku ps:scale web=0 --app wheel-run-backend-api-ws

REMOVE THE OLD ADD-ON

Then we removed the old add-on:

$ heroku addons:destroy <redis-go-to-add-on-name> --app wheel-run-backend-api

PROVISION THE NEW ADD-ON

$ heroku addons:create heroku-redis:hobby-dev --ap wheel-run-backend-api

ATTACH THE NEW ADD-ON TO WEBSOCKET SERVER

$ heroku addons:attach wheel-run-backend-api::REDIS --app wheel-run-backend-api-ws

RESTART DYNOS

On Ruby on Rails server app:

$ heroku ps:scale web=1 worker=1 --app wheel-run-backend-api

On AnyCable Web Sockets server app:

$ heroku ps:scale web=1 --app wheel-run-backend-api-ws

MANUAL TESTS

After everything has been restarted, we did some manual tests using the mobile app.

Closing Notes

The migration to the Heroku Data for Redis add-on was quite easy, with minimum disruption in our case.