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

Log a warning when running SQLite in production #42191

Merged
merged 1 commit into from May 11, 2021

Conversation

intrip
Copy link
Contributor

@intrip intrip commented May 10, 2021

Summary

Log a warning message when running SQlite in production.
The warning can be disabled by setting config.active_record.sqlite3_production_warning=false.

Closes #34715

@intrip intrip changed the title WIP Log a warning when running SQLite in production Log a warning when running SQLite in production May 10, 2021
@intrip intrip force-pushed the 34715-log-warning-sqlite-production branch from f38be41 to ae168c1 Compare May 10, 2021 19:48
Copy link
Member

@eileencodes eileencodes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a changelog entry?

railties/test/application/configuration_test.rb Outdated Show resolved Hide resolved
Logs a warning message when running SQlite in production.
The warning can be disabled by setting `config.active_record.sqlite3_production_warning=false`.

Closes rails#34715
@intrip intrip force-pushed the 34715-log-warning-sqlite-production branch from 49b3059 to ad6a62e Compare May 11, 2021 13:55
@intrip
Copy link
Contributor Author

intrip commented May 11, 2021

@eileencodes thanks for the review! I've applied the suggestion and added the CL entry

@eileencodes eileencodes merged commit 7fcddd1 into rails:main May 11, 2021
@intrip intrip deleted the 34715-log-warning-sqlite-production branch May 11, 2021 15:26
@strzibny
Copy link

strzibny commented Jun 2, 2021

I find this change a bit strange. SQLite is a good production-like database. Shouldn't this change be about reporting mismatch between dev and production environment rather than suggesting that SQLite is not a good database?

@intrip
Copy link
Contributor Author

intrip commented Jun 3, 2021

You can find all the conversations + the reasons of this change in #34715

@strzibny
Copy link

strzibny commented Jun 3, 2021

I reread it and I am very disappointed. Seriously folks! The argument is that SQLite doesn't scale beyond a certain point? As long as it's a supported database in Rails, this change should be reverted.

@zzak
Copy link
Member

zzak commented Jun 3, 2021

@strzibny That's fair, and there is nothing stopping you from using SQLite in production. This warning is intended to notify people who might not be as comfortable managing that database in a production environment, if you're comfortable choosing that database as your preferred solution more power to you.

@strzibny
Copy link

strzibny commented Jun 3, 2021

@zzak The problem is that you got it backward I think.

Managing SQLite is super simple whereas making a production-grade MySQL/PostgreSQL deployment is much more daunting. A lot of beginners have trouble making even a development environment work -- I know, because in my early days I used some Mac OS app to do it for me, and it was something I didn't understand.

Nobody should be forced to suddenly stop - and go learn about production-grade PostgreSQL deployment only to finish the deployment of their simple projects on a virtual server. They could just carry on with SQLite. It's a great first step. I and you understand that the warning is in fact wrong, but those starting would take it as a serious recommendation.

I always liked that Rails supported SQLite so that beginners (but also professionals) can make a simple app/showcase and also put it into production with very little effort. I compare it with Phoenix where we still don't have a good SQLite story and it's in fact a bit annoying. Deploying databases is not an easy feat! It requires some studying to do it right. But for SQLite? No issue. Can you manage a file? Then you can manage SQLite.

@strzibny
Copy link

strzibny commented Jun 3, 2021

I am trying to recheck the guides https://guides.rubyonrails.org/getting_started.html#creating-a-new-rails-project-installing-rails and there is nothing about SQLite not being supported for production.

I think this is about expectations. Is SQLite supported as a production database in Rails? If yes, there cannot be a warning about using it in production. If not, I would expect we change the docs to mention it.

Users (especially beginners) shouldn't find out the database they chose is not supported once they actually go and deploy. That's very unergnomic.

@eileencodes
Copy link
Member

@strzibny I appreciate your perspective and concern, but the core team discussed this on the issue and came to a consensus to add this logged warning. It doesn't prevent you from using sqlite. We don't have plans to revert this at the moment.

@strzibny
Copy link

strzibny commented Jun 3, 2021

Okay. It's unfortunate, but it's up to you.

@strzibny
Copy link

strzibny commented Jun 3, 2021

@eileencodes can you please confirm or deny whether SQLite is still supported for production use in Rails? The guides mention SQLite all the time, but it's actually not clear to me if this is supported now or not.

@eileencodes
Copy link
Member

eileencodes commented Jun 3, 2021

@strzibny it's a single warning issued on boot in the production env. Nothing is preventing you from using SQLIite in any environment. It is still supported the same as it was before, just with a little warning in your logs.

All the reasoning for adding this was explained in the issue. You're free to dislike it and you're free to keep using sqlite. However, please stop arguing with us about this. We are not reverting this change and I will lock this PR if you keep arguing with us because it's not productive.

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

Successfully merging this pull request may close these issues.

Log a warning if you run SQLite in production
5 participants