General outline

  1. Spin up machine
    a. If mounting drives for fedora-data or for the tmp directory for migration, make sure to change the owner to tomcat7 (sudo chown tomcat7:tomcat7 folder)
  2. Deploy Sufia
  3. Ensure apache is off
  4. Activate maintenance mode on old server
  5. Move over minter
  6. Fedora Export - see below
  7. migrate postgres
  8. Fedora Import - see below
  9. run (currently nonexistent) verification job
  10. migrate dump.rdb
  11. Reindex solr

Fedora export

In sufia 6 instance:

RAILS_ENV=production bundle exec sufia_survey -v
$ RAILS_ENV=production bundle exec sufia_export --models GenericFile=Chf::Export::GenericFileConverter,Collection=Chf::Export::CollectionConverter
$ find tmp/export -type f -name "*.json" -print0 | xargs -0 sed -i "s/127\.0\.0\.1/staging.hydra.chemheritage.org/g"
$ cd tmp; tar -czf json_export_201611141510.tgz export
$ scp staging:/opt/sufia-project/current/tmp/json_export_201611141510.tgz new_box_ip:/opt/sufia-project/current/tmp/.

Fedora import

On sufia 7 instance:

cd opt/sufia-project/current/tmp/
tar -xzf json_export_201611141510.tgz
mv export import
$ RAILS_ENV=production bundle exec sufia_import -d tmp/import --json_mapping Chf::Import::GenericFileTranslator=generic_file_
$ RAILS_ENV=production bundle exec sufia_import -d /opt/sufia-project/import/gf_batch_0 --json_mapping Chf::Import::GenericFileTranslator=generic_file_

Postgres export/Import

On Staging

On Migration

How to check the statefile

There are 3 parts to the state: sequence, counters, and seed. You need the correct combination of all three in order to have the right state. However, if you know you have two valid state files with the same origin you can do a rough comparison of their equivalence just by checking the sequence. To check sequence in our 7.2-based application:

$ cd /opt/sufia-project/current
$ bin/rails c production
> sf = ActiveFedora::Noid::Minter::File.new
> state = sf.read
> state[:seq]


To check in our 6.7-based application:

$ cd /opt/sufia-project/current
$ bin/rails c production
> sm = ActiveFedora::Noid::SynchronizedMinter.new
> state = {}
> ::File.open(sm.statefile, ::File::RDWR|::File::CREAT, 0644) do |f|
>   f.flock(::File::LOCK_EX)
>   state = sm.send(:state_for, f)
> end
> state[:seq]


To check sequence on a file that's not in the default location, pass the template and the filename when you create the object with 'new', e.g:

> sm = ActiveFedora::Noid::SynchronizedMinter.new(".reeddeeddk", "/var/sufia/minter-state")


Misc.

Postgres

You can get a list of all tables and fields with the command:

SELECT * FROM information_schema.columns WHERE table_schema = 'public'