Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Warning

This documentation is a work in progress.

Migrate Database

...

Prepare R6 for migration

This migration requires:

  1. An R6 instance be stood up and run concurrently with an existing R5 instance. 
  2. The R5 fedora needs to be made accessible to the server running the R6 instance. (See the fedora migration step below.)
  3. The R6 instance is empty. Run wipeout rake task to clean out R6 database, solr, and fedora.
Code Block
languagebash
# ensure that Fedora, Solr, and the DB are clean
# it will ask you to verify the targets are correct
bundle exec rake avalon:wipeout  

Dump R5 database

Data from your R5 database will be loaded directly into your R6 database then migrated for R6 in a later step. Role_map data will be needed in R6 for the Fedora migrate step, so it needs to be imported first.

Code Block
# This example is for mysql. Adjust as necessary for your R5 database.
mysqldump -u avalonweb -p avalonweb --no-create-info --complete-insert --tables annotations api_tokens bookmarks courses identities ingest_batches playlist_items playlists role_maps  users > /tmp/avalon.r5.dump.sql

Load to

...

R6 database

SSH into your R6 box and load the R5 database dump.

Code Block
languagebash
# this example assumes R6 database is mysql. Adjust as necessary for your R6 database.
bundle exec rails dbconsole
mysql> source /tmp/avalon.r5.dump


If you are a developer wanting to test your migration on sqlite locally...

Expand
title...Follow these sqlite instructions

Sqllite3 doesn't like mysql dump files so a transformation script needs to be run on it. Download https://raw.githubusercontent.com/dumblob/mysql2sqlite/master/mysql2sqlite, make it executable, and run it on the dump file.

Code Block
chmod +x mysql2sqlite
./mysql2sqlite avalon.r5.dump.sql > avalon.r5.dump.sqlite
 
#then on r6
bundle exec rails dbconsole
sqlite> .read /tmp/avalon.r5.dump.sqlite

".read" returns "memory", which is good.

...

Code Block
# ensure that Fedora, Solr, and the DB are clean
# it will ask you to verify the targets are correct
bundle exec rake avalon:wipeout  
 
#go into the database console and import sqlite data
bundle exec rails dbconsole
mysql> source /tmp/avalon.r5.dump

 

Add yourself back in as administrator in the rails console

code

Clear role_map cache (TODO: fix me)

Rails won't use your newly imported role_map data unless you clear it from cache.

Code Block
languagebash
bundle exec rails c
> Rails.cache.delete("RoleMapHash")

Add users to administrator group as necessary (TODO: is this necessary?)

Code Block
languagebash
bundle exec rails c
> g = Admin::Group.find('administrator')
> g.users += ["archivist1@example.com"]
> g.save!

Clear role_map cache (TODO: fix me)

Rails won't use your newly imported role_map data unless you clear it from cache.

Code Block
languagebash
bundle exec rails c
> Rails.cache.delete("RoleMapHash")

...

Migrate Fedora Objects

SSH tunnel or open up your fedora3 server to your new Avalon app:

...