---
title: Rails Solid Queue in Production
url: https://calvin.my/posts/rails-solid-queue-in-production
published: 2024-07-13
updated: 2026-09-17
category: Development
tags:
- Rails
- Solid Queue
- Job
- Ruby
summary: The post describes testing Solid Queue, Rails 8’s planned default Active Job backend, in a Rails 7 application. The database-backed queue supports multithreading, preserves job data for easier debugging, and can be installed through migrations and configuration. For production on Ubuntu, the author runs queue workers under Supervisor with automatic restarts, then integrates Supervisor restarts into Capistrano deployments so workers reload after application updates.
---

# Rails Solid Queue in Production

I first encountered the "[solid queue](https://github.com/rails/solid_queue)" gem when it was announced to be shipped with Rails 8 as the default active job backend.

It is DB-based and compatible with Rails multi-threading. The debugging of active job issues is simpler with its enhanced logging and queue data persisted in the database.

Since Rails 8 is currently under development, I decided to try it with a Rails 7 application.

## Setup

It is plug-and-play, with 3 simple steps below.

1. Install the gem

   ```bash
   gem "solid_queue"
   ```

2. Install and run its migration

   ```bash
   $ rails solid_queue:install:migrations
   $ rails db:migrate
   ```

3. Update queue adapter in configuration

   ```ruby
   config.active_job.queue_adapter = :solid_queue
   ```

4. To test it, you can run this command

   ```bash
   $ bundle exec rake solid_queue:start
   ```
* * *
## Using it in Production

1. There are many ways to manage the solid queue processes. I choose to use supervisor on a Ubuntu server.

   ```bash
   $ sudo apt update && sudo apt install supervisor
   ```

2. This can be done by creating a configuration file

   ```bash
   $ sudo pico /etc/supervisor/conf.d/rails-solid-queue.conf
   ```

   ```bash
   [program:rails-solid-queue]
   process_name=%(program_name)s_%(process_num)02d
   directory=/path/to/app
   command=/path/to/bundle exec rake solid_queue:start
   environment=RAILS_ENV=production
   autostart=true
   autorestart=true
   stopasgroup=true
   killasgroup=true
   user=user
   numprocs=1
   redirect_stderr=true
   stdout_logfile=/path/to/log
   stopwaitsecs=3600
   ```

3. Then load and start the configuration

   ```bash
   $ sudo supervisorctl reread
   $ sudo supervisorctl update
   ```
* * *
## Integrate it with the Capistrano deployment

1. I use Capistrano to deploy the demo app. So the supervisor-monitored processes must be restarted when I deploy new codes.

2. The following codes are added in my deploy.rb to perform the restart after the deployment.

   ```ruby
   # etc

   # restart supervisor
   namespace :deploy do
     desc 'Restart supervisor rails-solid-queue'
     task :restart_application do
       on roles(:app) do
         execute :sudo, 'supervisorctl restart rails-solid-queue:*'
       end
     end

     after :finished, :restart_application
   end
   ```

3. That is all the setup needed to deploy Solid Queue in production.

  ![](https://camy-pub.s3.ap-southeast-1.amazonaws.com/105aa43c-95c3-4917-8c4c-e47c4e3b7004.png)
