Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save rococodogs/2dcf9fb66906818bda6c816ff2160136 to your computer and use it in GitHub Desktop.
Save rococodogs/2dcf9fb66906818bda6c816ff2160136 to your computer and use it in GitHub Desktop.

getting up and running w/ geoblacklight

1a. install: the easy way

$ rails new my-app -m https://raw.githubusercontent.com/geoblacklight/geoblacklight/master/template.rb
// ...
$ cd my-app

1b. install: the hard way

$ rails new my-app && cd my-app

add to Gemfile:

gem 'blacklight', '>=6.3'
gem 'geoblacklight', '>=1.4'

then run

$ bundle install
// ...

$ rails generate blacklight:install --devise
// ...

$ rails generate geoblacklight:install -f
// ...

$ rake db:migrate

2. import sample data

(in the same terminal window)

$ solr_wrapper

(in another terminal window)

$ git clone https://github.com/geoblacklight/geoblacklight-schema
// ...

$ cd geoblacklight-schema

a helpful tool resides at tools/solr/upload.rb to upload geodata into the solr instance. to run it, you'll need to pass the url of the solr instance and the path to the sample data. so, from the root of geoblacklight-schema, you would run:

$ tools/solr/upload.rb http://127.0.0.1:8983/solr/blacklight-core examples/selected.json

you may run into an error:

/Users/adam/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rsolr-2.0.2/lib/rsolr/client.rb:24:in `initialize': uninitialized constant URI (NameError)
  from /Users/adam/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rsolr-2.0.2/lib/rsolr.rb:22:in `new'
  from /Users/adam/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rsolr-2.0.2/lib/rsolr.rb:22:in `connect'
  from tools/solr/upload.rb:15:in `<main>'

to fix this, edit tools/solr/upload.rb by adding

require 'uri'

to the top of the file. run the command again and you should be okay. afterwards, you can remove the geoblacklight-schema directory:

$ cd ..
$ rm -rf geoblacklight-schema

3. start the geoblacklight server

from the original terminal window, run:

$ rails server

and open http://localhost:3000 in a browser.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment