Name: session_store_relocator
Owner: Cookpad Inc.
Description: Supports Rails session store relocation with duplicate write session data to multiple stores
Created: 2016-03-23 04:16:46.0
Updated: 2018-05-19 14:24:16.0
Pushed: 2016-03-23 04:56:13.0
Homepage: null
Size: 28
Language: Ruby
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
Supports Rails session store relocation with duplicate write session data to multiple stores
Currently supports from Rails default ActionDispatch::Session::CookieStore to RedisSessionStore.
Add this line to your application's Gemfile:
'session_store_relocator'
And then execute:
$ bundle
This gem helps relocating session store by write data to both stores. After some weeks runnning with this gem, you switch session store to new one.
Edit config/initializers/session_store.rb
like below
s.application.config.session_store SessionStoreRelocator::CookieToRedis, {
okie_store: { key: '_myapp_session' },
dis_session_store: {
key: 'myapp_session:',
redis: {
url: ENV['SESSION_REDIS_URL'],
expire_after: 2.weeks,
key_prefix: 'myapp_session:',
},
serializer: :json,
cookie_store
parameter in config option is passwd ActionDispatch::Session::CookieStore.new
redis_session_store
parameter is passwd onto RedisSessionStore.new
See each documents for detail.
After some days with copying session data, you switch store simply remove this gem. Then configuration will be like below.
s.application.config.session_store RedisSessionStore, {
y: 'myapp_session:',
dis: {
url: ENV['SESSION_REDIS_URL'],
expire_after: 2.weeks,
key_prefix: 'myapp_session:',
rializer: :json,
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)The gem is available as open source under the terms of the MIT License.