CRKN Canadiana Blacklight is a Rails 7 + Blacklight 8.8 app for search and discovery over MARC records, backed by Solr and integrated with IIIF (manifest + content search) endpoints, using Mirador viewer for IIIF Manifest Display.
- Install Docker Desktop.
- Copy
.env.exampleto.env. - Fill in the values in
.env. - Optional: create a master key if you plan to use encrypted credentials.
Save that value to
ruby -rsecurerandom -e 'puts SecureRandom.hex(64)'config/master.keyor export it asRAILS_MASTER_KEY. - Run the app.
docker compose up --build --force-recreate
The app will be available at http://localhost:3000.
Note: Docker Compose only runs the Rails app. You must provide a Solr core and update config/blacklight.yml if needed.
These steps set up Docker Desktop to build containers in Ubuntu on WSL2.
-
Install Docker Desktop (Windows).
-
Ensure Docker Desktop uses the WSL2 engine: Docker Desktop -> Settings -> General -> check
Use the WSL 2 based engine. -
Install WSL + Ubuntu in PowerShell (Admin).
wsl --install -d Ubuntu
-
Reboot if prompted.
-
Launch Ubuntu from the Start menu or run
wsl. -
Update Ubuntu packages.
sudo apt update sudo apt upgrade -y
-
In Ubuntu, navigate to the repo and build.
cd /mnt/c/Users/BrittnyLapierre/Documents/github/crkn_canadiana_blacklight docker compose build
- Install Ruby 3.4.1 and Bundler.
- Install Node.js and Yarn 4.2.2 (Corepack).
- Run
bundle install. - Run
yarn install. - Copy
.env.exampleto.envand fill in values. - Run
bin/rails server.
Optional: run bin/vite dev in another terminal for faster frontend rebuilds.
You can also run bin/setup to install dependencies.
.env is loaded in development and test via dotenv-rails.
Required variables:
IIIF_MANIFEST_BASE- Base URL for IIIF manifests.IIIF_CONTENT_SEARCH_BASE- Base URL for IIIF Content Search.RAILS_ENV- Usedevelopmentfor local work.SECRET_KEY_BASE- Needed for production-like use. Generate withbin/rails secret.
Optional variables for Swift-backed download links:
CAP_PASS- HMAC key used to sign Swift URLs.SWIFT_AUTH_URLSWIFT_USERNAMESWIFT_PASSWORDSWIFT_PREAUTH_URL
Do not commit .env.
Blacklight requires a Solr core for search. Configure the connection in config/blacklight.yml.
Local options:
- Point
config/blacklight.ymlto an existing Solr core. - Run your own Solr and use the config in
data/data/blacklight_marc/conf.
Index a MARC record:
rake solr:marc:index MARC_FILE=marc-file-name-here.mrcClear the Solr index:
curl -X POST -H "Content-Type: application/json" "http://username:password@host/solr/blacklight_marc_demo/update?commit=true" -d '{ "delete": {"query":"*:*"} }'
curl -X POST -H "Content-Type: application/json" "http://localhost:8983/solr/blacklight_marc_demo/update?commit=true" -d '{ "delete": {"query":"*:*"} }'For CRKN production, Solr runs in a docker container. The data dir needs to be a volume. High-level steps:
- SSH to the Solr container.
- Create the
blacklight_marccore andconfdirectory. - Copy the default configset.
- Replace
solrconfig.xmlandmanaged-schema.xmlwith the versions from this repo. - Restart Solr.
app/controllers/catalog_controller.rb- Search UI entry point.app/controllers/downloads_controller.rb- IIIF and Swift-backed download links.app/models/search_builder.rb- Solr query construction.app/models/solr_document.rb- Solr document mapping.app/models/marc_indexer.rb- MARC indexing.config/blacklight.yml- Solr connection settings.config/initializers/blacklight.rb- Blacklight configuration.config/initializers/canadiana_endpoints.rb- IIIF endpoint configuration.data/data/blacklight_marc/conf- Solr schema and config.deployImage.sh- Build and push deployment image.
Run the container:
docker compose upCommon in-container commands:
bin/rails server- Start the app.bin/rails console- Interactive Rails console.bin/rails routes- List routes and controllers.bin/rails test- Run tests.bin/vite dev- Run the Vite dev server.
We deploy to CRKN internal servers using ./deployImage.sh, which builds and pushes the image to the internal Docker registry.
Prereqs:
- Docker Desktop installed and running (Linux containers).
- VPN connected (OpenVPN), if required for registry access.
- Registry credentials from 1Password (item:
docker.c7a.ca).
Deploy:
./deployImage.shNotes:
- The script tags the image with a UTC timestamp and optional branch suffix.
- The script prints a link to create a Systems-Administration issue. Create it and include the image tag.
- Blacklight Wiki: https://github.com/projectblacklight/blacklight/wiki/
- Blacklight Workshop: https://workshop.projectblacklight.org/
- IIIF overview: https://iiif.io/
- IIIF Content Search API v2: https://iiif.io/api/search/2.0/
- Debugging Rails: https://guides.rubyonrails.org/debugging_rails_applications.html