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, and docker-compose
from https://docs.docker.com/compose/install/.
$ 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.
Typically an ENV variable is set with your current user id (UID), verify it's set and matching your current shell.
echo $UID
# 501
id -u
# 501
If your UID isn't set, it's recommended that you set it anytime you're running docker-compose
so that the application container will run in the context of your current user.
UID=$(id -u) docker-compose ...
Important: Rebuilding the docker container is required whenever Gemfile or Dockerfile updates affect the application.
$ docker-compose build
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
).
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 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.
Docker has mounted the Nurax code directory inside the container at /data
, edits made directly to these files are reflected within the running container. As is the case with some application code, an application restart might be necessary for the system to reflect those changes.
Make yourself an admin user by adding the registered email address to the admin
users in config/role_map.yml
, then restart the server.
docker-compose down
... wait for the services to stop ...
docker-compose up server
Login to the app, and continue configuration or depositing works using the Hyrax UI.
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
... wait for a shell session to start ...
bundle exec rspec
OR run rspec
on the test (application) container directly:
docker-compose run test rspec