Production ready? #250
Unanswered
davidhan527
asked this question in
Q&A
Replies: 1 comment
-
|
@davidhan527 Thanks for asking these questions. Unless you're willing and able to contribute to the codebase, I would not recommend using it in mission-critical applications yet. That said, I've been running it for an internal application (on SQLite) for a few months and it's been rock solid for us. Beamer and Litestream are for realtime replication, not point-in-time backup. Can I ask you to clarify which you're asking about? Backup can be done with the SQLite API in a recurring job, something like: ApplicationRecord.with_each_tenant do |tenant|
ApplicationRecord.with_connection do |conn|
current_adapter = conn.raw_connection
backup_db = backup_path(tenant, 1)
backup_adapter = SQLite3::Database.new(backup_db)
backup = SQLite3::Backup.new(backup_adapter, "main", current_adapter, "main")
pages = 0
elapsed = ActiveSupport::Benchmark.realtime(:float_millisecond) do
loop do
status = backup.step(step)
case status
when SQLite3::Constants::ErrorCode::DONE
break
when SQLite3::Constants::ErrorCode::OK
total = backup.pagecount
progress = total - backup.remaining
log(tenant, :debug) { "Wrote #{progress} of #{total} pages." }
when SQLite3::Constants::ErrorCode::BUSY, SQLite3::Constants::ErrorCode::LOCKED
log(tenant, :debug) { "Busy, retrying." }
else
log(tenant, :error) { "Failed with status #{status}." }
@failures << tenant
end
end
pages = backup.pagecount
backup.finish
end
end
endIf you mean replication:
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
@flavorjones thank you so much for working on this project. I'm very much looking forward to trying it out.
How production-ready is ActiveRecord::Tenanted?
I have a production app that is currently using ActsAsTenant with SQLite, and there's only one tenant so far, making it a good candidate to try migrating to using ActiveRecord::Tenanted.
I'm wondering what the suggested solution is for backing up the databases? I saw that Basecamp is working on Beamer, and while it's not public yet, is there a suggested solution to use in the meantime?
I'm currently using https://github.com/fractaledmind/litestream-ruby for backup, but I assume it won't work once I migrate to ActiveRecord::Tenanted.
Beta Was this translation helpful? Give feedback.
All reactions