Skip to content
Next version of http://oregondigital.org built on Samvera Hyrax https://github.com/samvera/hyrax/
Ruby HTML XSLT JavaScript CSS Dockerfile Shell
Branch: master
Clone or download
Latest commit 9639ace Aug 23, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci Ruby bump to 2.5.5 (#677) Aug 9, 2019
.github added a11y issues section to template (#519) May 13, 2019
app Clean up after searchbox links (#737) Aug 21, 2019
bin initial commit Oct 31, 2017
build Remove staging (#473) Apr 5, 2019
config add config sidekiq for named queues Aug 23, 2019
db Add configurable facets to collections edit form (#549) Jun 3, 2019
lib crosswalk overrides updates (#703) Aug 15, 2019
log initial commit Oct 31, 2017
public Update robots.txt - disallow indexing (#483) Apr 7, 2019
spec Remove identifier metadata field from collections (#736) Aug 19, 2019
tmp fixes empty tmp/pids bug and makes entrypoint a single script (#135) Nov 21, 2018
vendor initial commit Oct 31, 2017
.dockerignore adds application code to docker image, ignores local artifacts (#116) Nov 16, 2018
.env.example Ruby bump to 2.5.5 (#677) Aug 9, 2019
.gitignore Feature/make env great again (#631) Jul 22, 2019
.rspec adds CCI2, defaults, and rspec (#17) Aug 8, 2018
.rubocop.yml Approve rake task (#709) Aug 14, 2019
.rubocop_fixme.yml Stop licenses and rights statements from opening in new tabs (#660) Jul 31, 2019
.ruby-version Ruby bump to 2.5.5 (#677) Aug 9, 2019
Dockerfile Ruby bump to 2.5.5 (#677) Aug 9, 2019
Gemfile Ruby bump to 2.5.5 (#677) Aug 9, 2019
Gemfile.lock update hyrax-migrator Aug 23, 2019
README.md Feature/make env great again (#631) Jul 22, 2019
Rakefile Unneeded scaffolding (#114) Nov 16, 2018
config.ru Ruby bump to 2.5.5 (#677) Aug 9, 2019
docker-compose.override.yml-example adds kakadu, rais (iiif), a service to make images work with UV and r… Nov 27, 2018
docker-compose.yml Disable honeycomb in debug environments (#721) Aug 14, 2019
package.json initial commit Oct 31, 2017

README.md

Oregon Digital

CircleCI Coverage Status

Docker Setup

Requirements

The details provided assume that the official Docker daemon is running in the background. Download and install Docker Community Edition from https://www.docker.com/community-edition.

Suggested: If using ohmyzsh (http://ohmyz.sh/), add the docker-compose plugin to the .zshrc for better command-line aliases and integration.

Important: By default, docker will run the services in the context of RAILS_ENV=development, and there is no valid AWS configuration. You can copy the included .env.example to .env and override these things if desired.

Docker notes

  • $ docker system prune : A command that will reclaim disk space by deleting stopped containers, networks, dangling images and build cache.
  • $ docker volume ls : Show a list of named volumes which hold persistent data for containers.
  • $ docker volume rm [VOLUME NAME] : Remove a named volume, to force the system to rebuild and start that services persistent data from scratch.

Docker Compose basics

Build the base application container

Important: Rebuilding the docker container is required whenever Gemfile or Dockerfile updates affect the application.

$ docker-compose build

Getting Started

Important: Setup a docker-compose.override.yml before starting development or testing.

cp docker-compose.override.yml-example docker-compose.override.yml

Development workflow

All of the required services are pre-configured with environment variables injected to the containers during boot. The database, repository, solr index, and redis queue are backed by persistent volumes to maintain data between use.

Start the development server:

docker-compose up server
(or, detached)
docker-compose up -d server

Open another terminal window (unless you run the previous command detached).

Automatic setup

On the first time building and starting the server, Hyrax defaults must be created and loaded. Run the commands on the server container.

"docker-compose exec" only works if the server is running. The first-run command only works if the server has already been initialized. Make sure migrations have finished running before you do these steps.

docker-compose exec server ./build/firstrun.sh

This will take a few minutes. Once it's done, you can visit http://localhost:3000/users/sign_in?locale=en and log in as "admin@example.org" with the password "admin123".

Manual

Or to run the commands manually:

docker-compose run server bash
# ... wait for a shell session to start ...
bundle exec rails hyrax:default_admin_set:create
bundle exec rails hyrax:default_collection_types:create
bundle exec rails hyrax:workflow:load

Visit http://localhost:3000/users/sign_up?locale=en to register an account.

Return to the server container shell session, start Rails console, create an admin role, and assign it to the user that was just created.

bundle exec rails c
# ... wait for the Rails console to start ...
Role.create(name: 'admin')
User.last.roles << Role.last

Login to the app, and continue configuration or depositing works using the Hyrax UI.

Testing workflow

Testing the application amounts to running all of the required services along side an instance of the application and then running the testing framework against those containers. All of the *-test services have applicable environment variables injected to the containers during boot.

Start the test server:

docker-compose up test
(or, detached)
docker-compose up -d test

Open another terminal window (unless you run the previous command detached)

Start a session, and run rspec on the test (application) container. (This method offers a more developer/TDD friendly experience)

docker-compose run test bash
root@8675309jenny:/data# bundle exec rspec

OR run rspec on the test (application) container directly:

docker-compose run test rspec

Additional Notes

Controlling Workers

Running rake tasks:

docker-compose exec workers rake -T

When you do anything that changes the filesystem (rake tasks or otherwise), you may want to pass through your user ID so that on your local filesystem you still own the files:

docker-compose exec -u 1000 workers rake -T

(Your user id may or may not be 1000 - use id -g or similar to find your actual user id)

It may behoove you to create an alias for this kind of thing:

alias dwork='docker-compose exec -u 1000 workers'
dwork rake -T
dwork rails generate ...
You can’t perform that action at this time.