Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configurable domain #109

Merged
merged 3 commits into from
Dec 2, 2020
Merged

Configurable domain #109

merged 3 commits into from
Dec 2, 2020

Conversation

dannylamb
Copy link
Contributor

@dannylamb dannylamb commented Nov 9, 2020

GitHub Issue: Islandora/documentation#1664

What does this Pull Request do?

These changes let you configure Gemini with drupal and fedora domains. If you do not configure these values, behaviour is unchanged.

This is useful when you want to take data ingested in one environment to another, like a testing/staging server to production. By configuring the drupal_domain and fedora_domain variables, you can force gemini to rewrite the urls on the way out so that they have the new domain.

What's new?

Jams in two new config variables and makes getUrls() and findByUri() respect them.

How should this be tested?

  • Pull these changes in
  • Copy/paste this chunk from config.example.yml to your config.yaml file
# Leave these blank unless you know what you're doing.  If you're moving
# data from one server to another and the domain changes, set these
# to your new domain.
fedora_domain:
drupal_domain:
  • test gemini and confirm behaviour is the same. i queried for a uuid, and then queried for the same item using by_uri
$ curl -s -H "Authorization: Bearer islandora" http://localhost:8000/gemini/02862b7c-0a80-45af-bc2a-690a007e40a0 | jq
{
  "drupal": "http://localhost:18000/_flysystem/fedora/islandora_3_TECHMD.xml",
  "fedora": "http://127.0.0.1:8080/fcrepo/rest/islandora_3_TECHMD.xml"
}

$ curl -I -H "X-Islandora-URI: http://localhost:18000/_flysystem/fedora/islandora_3_TECHMD.xml" -H "Authorization: Bearer islandora" http://localhost:8000/gemini/by_uri
HTTP/1.1 200 OK
Date: Mon, 09 Nov 2020 19:32:02 GMT
Server: Apache/2.4.29 (Ubuntu)
X-Powered-By: PHP/7.2.30-1+ubuntu18.04.1+deb.sury.org+1
Location: http://127.0.0.1:8080/fcrepo/rest/islandora_3_TECHMD.xml
Cache-Control: no-cache, private
Content-Type: text/html; charset=UTF-8
  • Now go set drupal_domain and fedora_domain in your config.yaml file. I used these
# Leave these blank unless you know what you're doing.  If you're moving
# data from one server to another and the domain changes, set these
# to your new domain.
fedora_domain: fcrepo.example.org
drupal_domain: drupal.example.org
  • Do the tests again and confirm the urls are rewritten to use the domains you configured
$ curl -s -H "Authorization: Bearer islandora" http://localhost:8000/gemini/02862b7c-0a80-45af-bc2a-690a007e40a0 | jq
{
  "drupal": "http://drupal.example.org/_flysystem/fedora/islandora_3_TECHMD.xml",
  "fedora": "http://fcrepo.example.org/fcrepo/rest/islandora_3_TECHMD.xml"
}
$ curl -I -H "X-Islandora-URI: http://drupal.example.org/_flysystem/fedora/islandora_3_TECHMD.xml" -H "Authorization: Bearer islandora" http://localhost:8000/gemini/by_uri
HTTP/1.1 200 OK
Date: Mon, 09 Nov 2020 19:39:25 GMT
Server: Apache/2.4.29 (Ubuntu)
X-Powered-By: PHP/7.2.30-1+ubuntu18.04.1+deb.sury.org+1
Location: http://fcrepo.example.org/fcrepo/rest/islandora_3_TECHMD.xml
Cache-Control: no-cache, private
Content-Type: text/html; charset=UTF-8
  • Change your config back to empty strings or the fedora urls will go missing from your objects' displays

Additional Notes:

Part of the ongoin ISLE sprint: https://github.com/orgs/Islandora/projects/2

Interested parties

@Islandora/8-x-committers

@codecov
Copy link

codecov bot commented Nov 9, 2020

Codecov Report

Merging #109 (28eae07) into dev (937e394) will decrease coverage by 0.15%.
The diff coverage is 89.28%.

Impacted file tree graph

@@             Coverage Diff              @@
##                dev     #109      +/-   ##
============================================
- Coverage     91.89%   91.74%   -0.16%     
- Complexity      175      184       +9     
============================================
  Files             9        9              
  Lines           728      751      +23     
============================================
+ Hits            669      689      +20     
- Misses           59       62       +3     
Impacted Files Coverage Δ Complexity Δ
Gemini/src/Controller/GeminiController.php 98.24% <ø> (ø) 19.00 <0.00> (ø)
Gemini/src/UrlMapper/UrlMapper.php 95.65% <89.28%> (-4.35%) 17.00 <2.00> (+9.00) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 937e394...28eae07. Read the comment docs.

Copy link
Contributor

@seth-shaw-unlv seth-shaw-unlv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works as advertised. 👍

@seth-shaw-unlv
Copy link
Contributor

Other than codecov, it looks good to me, @dannylamb.

@dannylamb
Copy link
Contributor Author

You mind merging @seth-shaw-unlv ?

@seth-shaw-unlv
Copy link
Contributor

@dannylamb, are we not worrying about codecov on this one?

@dannylamb
Copy link
Contributor Author

dannylamb commented Dec 2, 2020

@seth-shaw-unlv Nope, Travis is the only required check that must pass. Codecov is mostly there to remind us to update the tests, which I did, only to create a 0.15% drop in code coverage 😞

@seth-shaw-unlv seth-shaw-unlv merged commit afdb8d0 into dev Dec 2, 2020
@seth-shaw-unlv seth-shaw-unlv deleted the configurable-domain branch December 2, 2020 16:18
@dannylamb
Copy link
Contributor Author

Many thanks @seth-shaw-unlv 🙇

ruebot added a commit to islandora-deprecated/ansible-role-crayfish that referenced this pull request Dec 2, 2020
- Remove crayfish_gemini_fedora_base_url
- Add crayfish_gemini_fedora_domain
- Add crayfish_gemini_drupal_domain
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants