All threads / Capistrano, puma staging env keeps using production secrets

Ask A Question


You’re not receiving notifications from this thread.

Capistrano, puma staging env keeps using production secrets

Alex White asked in Rails

When we run bundler exec cap staging deploy the application is still trying to pulling secrets for Production and not Staging. How can we debug this process to find why the application is pulling production secrets instead of staging secrets?

Slight back story. Our team has had a Ruby project given to us to support. We're new to Ruby, so we've been thrown in at the deep end.

The project in question is running:

  • Ruby:2.3.3,
  • Rails:5.1.1
  • Puma:3.11
  • Capistrano:3.4

When given the project there was only a production and a development environment. The client wanted a staging environment as well. So we created additional blocks in the

  • config/database.yml
  • config/secrets.yml

Then we created

  • config/deploy/staging.rb
  • config/environments/staging.rb

Hey Alex,

Have you set RAILS_ENV=staging on the server so it knows to run the staging env in production?

Join the discussion

Want to stay up-to-date with Ruby on Rails?

Join 53,130+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.

    logo Created with Sketch.

    Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

    © 2021 GoRails, LLC. All rights reserved.