- Running the stack
- Admin User
- Account (tenant) Creation
- Rescue Server Deploy
- Single Tenant Mode
- Switching accounts
- Importing
- DOI
- Local site:
- With dory: admin.bl.test
- Without dory: localhost:3000
- Staging site: http://bl-staging.notch8.cloud/
- Production site: http://iro.bl.uk/
- Solr: http://solr.bl.test
- Check the
SOLR_ADMIN_USER
andSOLR_ADMIN_PASSWORD
in "docker-compose.yml"
- Check the
- Sidekiq: http://bl.test/sidekiq
On OS X or Linux we recommend running Dory. It acts as a proxy allowing you to access domains locally such as bl.test or tenant.bl.test, making multitenant development more straightforward and prevents the need to bind ports locally. Be sure to adjust your ~/.dory.yml file to support the .test tld.
You can still run in development via docker with out Dory, but to do so please uncomment the ports section in docker-compose.yml
gem install dory
dory up
We distribute two configuration files:
docker-compose.yml
is set up for development / running the specsdocker-compose.production.yml
is for running the Hyku stack in a production setting
- Download Docker Desktop and log in
If this is your first time working in this repo recently, you may have remnants of an old setup that requires a few extra commands
docker compose down -v
rm -rf solr_db_initialized
#verify that the solr_db_initialized is actually gone
ls
docker compose build --no-cache
docker compose up
dory up
docker compose build --no-cache
docker compose up
dory up
docker compose down -v
docker compose build --no-cache
docker compose up
dory up
docker compose up
dory up
This command starts the web and worker containers allowing Rails to be started or stopped independent of the other services. You can now view your app at one of the dev URL's above.
if you want to automatically create a dataset, place the exported file in data/ before beginning. These files should not be added to the repo as they are often quite large.
sc be rails db:seed
When you first rebuild your app after removing all the volumes, you may need to seed a superadmin
docker compose exec web bash
rake hyku:superadmin:create
-
In a separate terminal window or tab than the running server, run:
sc sh
or
docker compose exec web bash
-
You need to be inside the container to:
- Access the rails console for debugging
rails c
- Run rspec
rspec
- Create a tenant called 'search' and check the box below make it search-only
- Change the cname of the search tenant
docker compose exec web bash
rails c
search_account = Account.find_by(cname: "search.bl.test")
search_account.update(cname: 'bl.test')
- if you'd like to use the logo links on the shared homepage, you can create tenants called 'mola', 'nms', 'bl', 'kew', 'tate', or 'britishmuseum'
- Press
Ctrl + C
in the window wheresc up
is running - When that's done
sc stop
shuts down the running containers dory down
stops Dory
-
Was the Dockerfile changed on your most recent
git pull
? Refer to the instructions above -
Double check your dory set up
-
Issue:
No such file or directory @ rb_sysopen - /app/samvera/hyrax-webapp/log/indexing.log
-
Try:
mkdir /app/samvera/hyrax-webapp/log touch /app/samvera/hyrax-webapp/log/indexing.log
-
Issue: Could not find in any of the sources (Bundler::GemNotFound)
-
Try:
docker compose down -v docker compose build --no-cache docker compose up dory up
-
Issue: Want to follow the logs during the
initialize_app
phase -
Try:
dc logs -f initialize_app
-
Issue: Sidekiq isn't working (e.g.: importer/exporter status stays stuck at "pending")
-
Try:
docker-compose exec web bash # or `sc sh` bundle exec sidekiq
Rubocop can be run in docker locally using either of the options below:
- Outside the container:
sc be rake
- With autocorrect: (learn about the
-a
flag here)sc exec rubocop -a
- Inside the container:
rubocop -a
You can log all of the I18n lookups to the Rails logger by setting the I18N_DEBUG environment variable to true. This will add a lot of chatter to the Rails logger (but can be very helpful to zero in on what I18n key you should or could use).
$ I18N_DEBUG=true bin/rails server
This is for the admin login on the Shared Research Repository page or when logging in to a specific tenant
- Local:
INITIAL_ADMIN_EMAIL
andINITIAL_ADMIN_PASSWORD
in ".env" - Staging:
INITIAL_ADMIN_EMAIL
andINITIAL_ADMIN_PASSWORD
in "staging-deploy.yaml"
- From the home page click on "Accounts" in the upper left corner
- Press "Create New Account"
- Give the account a short name
- Access the tenant at ".bl.test" NOTE: Although there are institutional logo's on the home page, all accounts are not created by default. If you would like to create an account for one of them, hover over its logo to see the url in the bottom left corner of the screen. Use the subdomain as the "short name" in the process above.
- Check the
authenticate_if_needed
method in application_controller.rb for the current username/password combination
- From the home page click on "Accounts" in the upper left corner
- Press "Create New Account"
- Select the check box for "search only account"
- Name the tenant 'search' if you would like to use it to execute searches from the splash page (bl.test)
- After clicking 'Save', select the button that says 'Edit Account'
- Scroll down to the 'Add Accounts' section
- Add any accounts you would like to include in the shared search
- If there is any text in the 'Solr URL' field, make sure to delete it. Save your edits.
- You will likely need to reindex your works in order to make them searchable
docker-compose exec web bash rails hyku:reindex_works
- Visit bl.test
- Execute a search from the search bar to check that your tenant works.
- This is a single large box with everything running in docker-compose. All files for the app are at
/data/bl-transfer
- Tmux on this box uses default settings; "ctrl-b" is the leader command
- Your ssh key should work
- This attaches to a shared session so you can see if anyone is running a special job and we don't step on each other
- If we have to run a migration or do something else that may make this process take a while, run
cp public/maintenance.html public/under_maintenance.html
afterdc build web
ssh -t [email protected] "tmux new-session -A -s main"
cd /data/bl-transfer
git pull gitlab main
dc build web
dc build worker
dc up -d web
dc exec web bash -l -c "DB_ADAPTER=nulldb DATABASE_URL='postgresql://fake' bundle exec rake assets:precompile && bundle exec pumactl restart -p 1"
Much of the default configuration in Hyku is set up to use multi-tenant mode. This default mode allows Hyku users to run the equivielent of multiple Hyrax installs on a single set of resources. However, sometimes the subdomain splitting multi-headed complexity is simply not needed. If this is the case, then single tenant mode is for you. Single tenant mode will not show the tenant sign up page, or any of the tenant management screens. Instead it shows a single Samvera instance at what ever domain is pointed at the application.
To enable single tenant, in your settings.yml file change multitenancy/enabled to false
or set HYKU_MULTITENAN=false
in your docker-compose.yml
and docker-compose.production.yml
configs. After changinig this setting, run rails db:seed
to prepopulate the single tenant.
In single tenant mode, both the application root (eg. localhost, or bl.test) and the tenant url single.* (eg. single.bl.test) will load the tenant. Override the root host by setting multitenancy/root_host in settings.yml or HYKU_ROOT_HOST
.
To change from single- to multi-tenant mode, change the multitenancy/enabled flag to true and restart the application. Change the 'single' tenant account cname in the Accounts edit interface to the correct hostname.
There are multiple ways to switch your current session from one account to another:
switch!(Account.first)
# or
switch!('my.site.com')
# or
switch!('myaccount')
- Change
HYKU_BULKRAX_ENABLED
totrue
in ".env" - Change
//require bulkrax/application
to//= require bulkrax/application
in "application.js" - Change
require bulkrax/application
to*= require bulkrax/application
in "application.css" - Change
HYKU_BULKRAX_ENABLED
totrue
in "docker-compose.yml" (it's in there more than once) - Change the value under
name: HYKU_BULKRAX_ENABLED
totrue
in "staging-deploy.yaml" (it's in there more than once) - Restart the server
- Revert each of the changes above
- Restart the server
- Choose "Importers" from the left navbar
- Click "New"
- Fill in the required fields (Refer to this Wiki article for more details about the fields and save options)
Reading a DOI will find the associated metadata for that object on DataCite and override the fields on your work with that data.
- Sign in to the admin dashboard
- Click Settings >> Account on the left navigation pane
- Check the box that says "DOI reader"
- Save changes
TODO
Minting a DOI will create a new entry on DataCite with the information from your work.
- Go to the Accounts page to edit the mola tenant
- Scroll down to the DataCite Endpoint section and input the following info
- Mode: test
- Prefix: 10.21259
- Username: RYUN.ZEOJHG
- Password: Acquaint5Reboot$showplace
- Save changes
- Sign in to the admin dashboard
- Click Settings >> Account on the left navigation pane
- Check the box that says "DOI minting"
- Save changes
- When creating or editing a work, you should see a tab that says "DOI"
- Click the "Create draft DOI" button
- Select any of the radio buttons (registered and findable can never be removed from DataCite):
- do not mint
- draft
- registered
- findable
- Edit and save your work as normal