-
Notifications
You must be signed in to change notification settings - Fork 1
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
Support zero-downtime migration #5
Comments
I'll work on this. |
Hi @DmitryDrobotov , any thoughts on this? |
Perhaps extending (forking)
class User < ActiveRecord::Base
attr_encrypted :ssn,
key: ->(u) { ENV['NEXT_USER_SSN_ENC_KEY'] || ENV['USER_SSN_ENC_KEY'] },
mode: :per_attribute_iv_and_salt,
algorithm: 'aes-256-cbc'
# old configuration of attr_encrypted for :ssn column
attr_encrypted_compat :ssn,
key: ->(u) { ENV['OLD_USER_SSN_ENC_KEY'] || ENV['USER_SSN_ENC_KEY'] },
mode: :per_attribute_iv_and_salt,
algorithm: 'aes-256-gcm'
# ...
end
Rails would then be made to write to both
In summary, this extension would make Rails write to What do you think? cc: @DmitryDrobotov |
@ribose-jeffreylau sounds good!
Absolutely great solution @ribose-jeffreylau ! |
Awesome! Do you think this belongs in a new repo or should it remain inside |
I think we can implement it as part of |
👍 |
As discussed in #15, transcryption ordering has to be consistent and logging has to be detailed enough to ensure that interruptions to the transcryption process can be resumed in a controlled manner. |
Some deduplication of configs could perhaps be done here, e.g., class User < ActiveRecord::Base
attr_transcryptor :ssn,
old: {
key: proc { |user|
ENV['NEXT_USER_SSN_ENC_KEY'] || ENV['USER_SSN_ENC_KEY']
},
mode: :per_attribute_iv_and_salt,
algorithm: 'aes-256-cbc'
},
new: {
key: proc { |user|
ENV['OLD_USER_SSN_ENC_KEY'] || ENV['USER_SSN_ENC_KEY']
},
mode: :per_attribute_iv,
algorithm: 'aes-256-gcm'
}
# ...
end
Just an idea. Not very important at the moment but could help in the future when we abstract away from |
Hi @DmitryDrobotov , actually |
It feels like to implement Wow, it will be really hard to implement zero-downtime migration in time. Let's try, but I can not guarantee. |
😄 👍 |
@DmitryDrobotov just to confirm that you're working on this. Thanks! 👍 |
@ronaldtse it is done #29. Sorry, used wrong keyword to close issue automatically :( |
Roadmap #3
(foreseen to depend on #4)
http://blog.honeybadger.io/zero-downtime-migrations-of-large-databases-using-rails-postgres-and-redis/
Migrating large datasets takes time. Making key migrations not incur downtime would be crucial in time-critical production environments.
The above link outlines what's needed to facilitate this task.
The text was updated successfully, but these errors were encountered: