Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mina 1.2.4: Allow multiple deployments with different RAILS_ENV #713

Closed
abhinavc opened this issue Sep 20, 2022 · 2 comments
Closed

mina 1.2.4: Allow multiple deployments with different RAILS_ENV #713

abhinavc opened this issue Sep 20, 2022 · 2 comments

Comments

@abhinavc
Copy link

abhinavc commented Sep 20, 2022

I am looking to deploy two instances of a Rails app on a VPS - one for production and one for sandbox (or staging / testing).

But it seems to me that mina wouldn't allow it.

In task rails:db_migrate, rails_env is hard-coded to production with no means to override it. And this rails_env then percolates down to bundle_prefix and thence to rake and rails etc.

Could a way be provided therefore to set :rails_env to something other than the default production?

Screenshot 2022-09-20 at 8 26 16 PM

@lovro-bikic
Copy link
Member

lovro-bikic commented Sep 20, 2022

You can override variables in your deploy.rb script.

If you set:

# config/deploy.rb
require 'mina/rails'

set :rails_env, 'staging'

it will set the rails_env variable to staging (or rather, the value staging will override the value production).

Regarding deploying to multiple environments, see this code sample, and let me know if it helps.

@abhinavc
Copy link
Author

abhinavc commented Sep 21, 2022

Thanks @lovro-bikic

I realized after I filed the issue that set :rails_env, 'staging' would work. I wrongly assumed that once set a value could not be changed - not realizing that if set is passed a block, then that block will be used by fetch to return the updated value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants