Skip to content

Commit

Permalink
Using db-backed Noid minter
Browse files Browse the repository at this point in the history
  • Loading branch information
awead committed Jan 10, 2017
1 parent e2ab533 commit a5d702b
Show file tree
Hide file tree
Showing 9 changed files with 61 additions and 18 deletions.
16 changes: 8 additions & 8 deletions Gemfile.lock
Expand Up @@ -113,7 +113,7 @@ GEM
active_attr (0.9.0)
activemodel (>= 3.0.2, < 5.1)
activesupport (>= 3.0.2, < 5.1)
active_fedora-noid (2.0.0)
active_fedora-noid (2.0.1)
active-fedora (>= 9.7, < 12)
noid (~> 0.9)
rails (>= 4.2.7.1, < 6)
Expand Down Expand Up @@ -141,7 +141,7 @@ GEM
sshkit (>= 1.6.1, != 1.7.0)
almond-rails (0.0.3)
rails (>= 4.2, < 6)
arel (6.0.3)
arel (6.0.4)
ast (2.3.0)
autoparse (0.3.3)
addressable (>= 2.3.1)
Expand Down Expand Up @@ -255,7 +255,7 @@ GEM
coffee-script-source
execjs
coffee-script-source (1.10.0)
concurrent-ruby (1.0.3)
concurrent-ruby (1.0.4)
crack (0.4.3)
safe_yaml (~> 1.0.0)
daemons (1.2.4)
Expand Down Expand Up @@ -508,7 +508,7 @@ GEM
websocket-driver (>= 0.2.0)
posix-spawn (0.3.12)
powerpack (0.1.1)
public_suffix (2.0.4)
public_suffix (2.0.5)
qa (0.10.2)
activerecord-import
deprecation
Expand All @@ -535,9 +535,9 @@ GEM
sprockets-rails
rails-deprecated_sanitizer (1.0.3)
activesupport (>= 4.2.0.alpha)
rails-dom-testing (1.0.7)
rails-dom-testing (1.0.8)
activesupport (>= 4.2.0.beta, < 5.0)
nokogiri (~> 1.6.0)
nokogiri (~> 1.6)
rails-deprecated_sanitizer (>= 1.0.1)
rails-html-sanitizer (1.0.3)
loofah (~> 2.0)
Expand Down Expand Up @@ -709,7 +709,7 @@ GEM
faraday
ruby-progressbar
rubyzip
solrizer (3.4.0)
solrizer (3.4.1)
activesupport
daemons
nokogiri
Expand Down Expand Up @@ -864,4 +864,4 @@ DEPENDENCIES
yaml_db

BUNDLED WITH
1.13.6
1.13.7
1 change: 0 additions & 1 deletion config/application.rb
Expand Up @@ -29,7 +29,6 @@ class Application < Rails::Application
config.derivatives_path = ss_config.fetch(:derivatives_path, File.join(Rails.root, 'tmp', 'derivatives'))
config.service_instance = ss_config.fetch(:service_instance, Socket.gethostname)
config.virtual_host = ss_config.fetch(:virtual_host, "https://#{Socket.gethostname}")
config.minter_statefile = ss_config.fetch(:minter_statefile, "/tmp/minter-state")

config.scholarsphere_version = "v2.8"
config.scholarsphere_release_date = "October 24, 2016"
Expand Down
7 changes: 7 additions & 0 deletions config/initializers/noid.rb
@@ -0,0 +1,7 @@
# frozen_string_literal: true
require 'active_fedora/noid'

ActiveFedora::Noid.configure do |config|
config.minter_class = ActiveFedora::Noid::Minter::Db
config.template = '.reeeddeeddk'
end
2 changes: 0 additions & 2 deletions config/initializers/sufia.rb
Expand Up @@ -46,7 +46,5 @@

config.derivatives_path = Rails.application.config.derivatives_path

config.minter_statefile = Rails.application.config.minter_statefile

config.noid_template = ".reeeddeeddk"
end
@@ -0,0 +1,16 @@
# This migration comes from active_fedora_noid_engine (originally 20160610010003)
# frozen_string_literal: true
class CreateMinterStates < ActiveRecord::Migration
def change
create_table :minter_states do |t|
t.string :namespace, null: false, default: 'default'
t.string :template, null: false
t.text :counters
t.bigint :seq, default: 0
t.binary :random
t.timestamps null: false
end
# Use both model and DB-level constraints for consistency while scaling horizontally
add_index :minter_states, :namespace, unique: true
end
end
@@ -0,0 +1,7 @@
# This migration comes from active_fedora_noid_engine (originally 20161021203429)
# frozen_string_literal: true
class RenameMinterStateRandomToRand < ActiveRecord::Migration
def change
rename_column :minter_states, :random, :rand
end
end
16 changes: 14 additions & 2 deletions db/schema.rb
Expand Up @@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 20161103162601) do
ActiveRecord::Schema.define(version: 20170110142323) do

create_table "bookmarks", force: :cascade do |t|
t.integer "user_id", limit: 4, null: false
Expand Down Expand Up @@ -171,6 +171,18 @@
t.string "status", limit: 255
end

create_table "minter_states", force: :cascade do |t|
t.string "namespace", limit: 255, default: "default", null: false
t.string "template", limit: 255, null: false
t.text "counters", limit: 65535
t.integer "seq", limit: 8, default: 0
t.binary "rand", limit: 65535
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end

add_index "minter_states", ["namespace"], name: "index_minter_states_on_namespace", unique: true, using: :btree

create_table "proxy_deposit_requests", force: :cascade do |t|
t.string "work_id", limit: 255, null: false
t.integer "sending_user_id", limit: 4, null: false
Expand Down Expand Up @@ -210,7 +222,7 @@
t.string "uri", limit: 255
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "lower_label", limit: 256
t.string "lower_label", limit: 175
end

add_index "qa_local_authority_entries", ["local_authority_id"], name: "index_qa_local_authority_entries_on_local_authority_id", using: :btree
Expand Down
5 changes: 0 additions & 5 deletions spec/config/scholarsphere_spec.rb
Expand Up @@ -28,9 +28,4 @@
subject { config.derivatives_path }
it { is_expected.to end_with("tmp/derivatives") }
end

describe "minter state file" do
subject { config.minter_statefile }
it { is_expected.to eq("/tmp/minter-state") }
end
end
9 changes: 9 additions & 0 deletions spec/support/minter.rb
@@ -0,0 +1,9 @@
# frozen_string_literal: true
require 'active_fedora/noid/rspec'

RSpec.configure do |config|
include ActiveFedora::Noid::RSpec

config.before(:suite) { disable_production_minter! }
config.after(:suite) { enable_production_minter! }
end

0 comments on commit a5d702b

Please sign in to comment.