diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..ad553f4 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,37 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: '' + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +Steps to reproduce the behavior: +1. Go to '...' +2. Click on '....' +3. Scroll down to '....' +4. See error + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Screenshots** +If applicable, add screenshots to help explain your problem. + +**Desktop (please complete the following information):** + - OS: [e.g. iOS] + - Browser [e.g. chrome, safari] + - Version [e.g. 22] + +**Smartphone (please complete the following information):** + - Device: [e.g. iPhone6] + - OS: [e.g. iOS8.1] + - Browser [e.g. stock browser, safari] + - Version [e.g. 22] + +**Additional context** +Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..a27874f --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,19 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: '' + +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000..8575e3b --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,37 @@ +# Description + +Please include a summary of the changes and the related issue. Please also include relevant motivation and context. List any dependencies that are required for this change. + +Fixes # (issue) + +## Type of change + +Please delete options that are not relevant. + +- [ ] Bug fix (non-breaking change which fixes an issue) +- [ ] New feature (non-breaking change which adds functionality) +- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) +- [ ] This change requires a documentation update + +# How Has This Been Tested? + +Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration + +- [ ] Test A +- [ ] Test B + +**Test Configuration**: +* Toolchain: +* SDK: + +# Checklist: + +- [ ] My code follows the style guidelines of this project +- [ ] I have performed a self-review of my code +- [ ] I have commented my code, particularly in hard-to-understand areas +- [ ] I have made corresponding changes to the documentation +- [ ] My changes generate no new warnings +- [ ] I have added tests that prove my fix is effective or that my feature works +- [ ] New and existing unit tests pass locally with my changes +- [ ] Any dependent changes have been merged and published in downstream modules + diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 14254a2..86c1826 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,10 +7,10 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: "Maven Cache" - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: ~/.m2/repository key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} @@ -20,14 +20,14 @@ jobs: with: java-version: 11 - - name: "Maven Tests" + - name: "Maven Test" run: mvn clean test jacoco:report coveralls:report -DdryRun=true - name: "Coverage Report" uses: MikeEdgar/github-action@raw_coverage_file with: github-token: ${{ secrets.github_token }} - path-to-file: 'target/coveralls.json' + path-to-file: './target/coveralls.json' coverage-format: raw - name: "Deploy GH-Pages" diff --git a/.gitignore b/.gitignore index 91365cb..4faeb8c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,12 +1,70 @@ -.apt_generated/ -target/ -.DS_Store +### Git ### +!.gitkeep + + +### STS ### +.apt_generated .classpath .factorypath .project .settings .springBeans -*.log* -bin/ +.sts4-cache + + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr + + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ + +/.nb-gradle/ + + +### VS Code ### +.vscode/ + +dump.rdb + + +### OS Specific ### +.DS_Store +.tmp/ + +tmp/ + + +### Maven ### logs/ -dump.rdb \ No newline at end of file +target/ + +.classpth +.mvn/timing.properties +.mvn/wrapper/maven-wrapper.jar +.project + +buildNumber.properties +dependency-reduced-pom.xml +pom.xml.next +pom.xml.tag +pom.xml.releaseBackup +pom.xml.versionsBackup +release.properties + + +### Weaver ### +dist/ + + +### Project Specific ### +.env* + +!**/src/main/** +!**/src/test/** diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a0e0915..62e3008 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,69 +1,65 @@ -# Contributing To IR IIIF Service + +# Contributing to Institutional Repository International Image Interoperability Framework Service -Though IR IIIF Service is developed and maintained by Texas A&M University Libraries, we welcome community contributions. Involvement in IR IIIF Service can take many forms: +Though *Institutional Repository International Image Interoperability Framework (IRIIIF) Service* is developed and maintained by Texas A&M University Libraries, we welcome community contributions. +Involvement in *IRIIIF Service* can take many forms. -#### Using IR IIIF Service +
(back to top)
-Deploying IR IIIF Service and trying it out at your own institution is itself a way of contributing to the development process. For more information on deployment strategies please see the [relevant documentation](https://github.com/TAMULib/IRIIIFService/blob/master/README.md). -#### Filing Issues +## Using -Once you are using IR IIIF Service the creation of new issues through Github is a major method of contribution towards IR IIIF Service development. Issues can be motivated by the discovery of a bug in the software, or by the desire to see either new features added to cap or existing features behaving differently. +Deploying *IRIIIF Service* and trying it out at your own institution is itself a way of contributing to the development process. +For more information on deployment strategies please see the [Deployment Guide][deployment-guide]. -These three categories of issue can be submitted using the following template: +
(back to top)
- [*] Bug Report - [] Feature Enhancement - [] Feature Request - Current Behavior: +## Filing Issues - [A description of the current behavior. This could include a list of steps to reproduce in the instance of a - Bug Report, and can be 'N/A' for Feature Requests] +Once you are using *IRIIIF Service* the creation of new issues through GitHub is a major method of contribution towards *IRIIIF Service* development. +Issues can be motivated by the discovery of a bug in the software, or by the desire to see either new features added or see changes to existing features. - Desired Behavior: +There are two primary types of issues: +1. Bug Report +2. Feature Request - [A description of the expected/desired behavior of the application] +A **Bug Report** involves a problem with the existing software or a **Feature** is not working as designed or expected. +A **Feature** involves new functionality or behavior. - Relevant Information: +
(back to top)
- [This section can include relevant error messages, or links to information that pertains to the issue] -Once an issue has been filed it will be curated by a IR IIIF Service developer and receive the appropriate labeling. +## Creating a Pull Request -#### Creating Pull Requests +Community code and documentation contributions are welcome and should take the form of a **GitHub Pull Request** (*PR*). +Each *PR* will need to be reviewed by a *IRIIIF Service* developer. +A review will result in the *PR* being accepted and merged, a descriptive request for changes, or the *PR* being closed along with a detailed explanation. -Community code and documentation contributions are welcome, and should take the form of a Github Pull Request (PR). Each PR will need to be reviewed by a IR IIIF Service developer. A review will result in the PR being accepted and merged, a descriptive request for changes, or the PR being closed along with a detailed explanation. +It is our intention to maintain labeling on issues that are deemed to be low difficulty in order to provide a good point of entry for those looking to begin contributing code or documentation. -It is our intention to maintain labeling on issues that are deemed to be low difficulty, in order to provide a good point of entry for those looking to begin contributing code or documentation. +A *PR* description should include a list of the specific issues resolved, the predicted *semantic versioning* impact of the changes, and a description which characterizes the nature of the changes made. +When creating a *PR*, an issue template is automatically provided to simplify this process. -A PR description should include a list of the specific issues resolved, the predicted semantic versioning impact of the changes and a description which characterizes the nature of the changes made. +For more information about *semantic versioning* please see [Semantic Versioning Website][semantic-versioning]. +In general keep in mind: -For more information about semantic versioning please see [this reference](https://semver.org/). In general keep in mind: +- A **Major Change** is a breaking change that is not backwards compatible. +- A **Minor Change** is a non-breaking change that is backwards compatible to the last **Major Change**. +- A **Patch** is a trivial change or bug fix that should not impact compatibility. -- A Major Change is a breaking change that is not backwards compatible. -- A Minor Change is a non breaking change that is backwards compatible to the last major change. -- A Patch is a trivial change or bug fix that should not impact compatibility +
(back to top)
-Please confirm you PR description to the following template: - Resolves: +## Good Luck! - - [List of # references to specific issues addressed by this PR] +We look forward to seeing your contributions. +If you have any additional questions please contact the *IRIIIF Service* developers at helpdesk@library.tamu.edu. - Changes: +
(back to top)
- [*] Major - [] Minor - [] Patch - [A description of the approach taken to resolving those issues] - -In addition to a well formatted PR we would also appreciate granular commits with descriptive messages. For instance a good commit message may be `Moved /foo endpoint logic into a FooService`, whereas `Everything I did Friday` is less granular or descriptive. - -If your commits do not conform to these recommendations you might consider rebasing your PR. Instructions for how this might work can be found [here](https://help.github.com/articles/about-git-rebase/). - -#### Good Luck! - -We look forward to seeing your contributions. If you have any additional questions please contact the IR IIIF Service developers at [helpdesk@library.tamu.edu](<>). + +[deployment-guide]: DEPLOYING.md +[semantic-versioning]: https://semver.org/ diff --git a/DEPLOYING.md b/DEPLOYING.md index e7aa60c..7c955f4 100644 --- a/DEPLOYING.md +++ b/DEPLOYING.md @@ -1,119 +1,60 @@ -## Packaging + +# Institutional Repository International Image Interoperability Framework Service Deployment Guide -IR IIIF Service build is done with [Maven](https://maven.apache.org/). The build is configured with [pom.xml](https://github.com/TAMULib/IRIIIFService/blob/master/pom.xml). +## Production Deployments -### Maven build arguments +For **production** deployments, deployment should ideally be done using `docker-compose`. +However, there is currently no *App* repository for *IRIIIF Service* providing a `docker-compose` file. -- `-DskipTests` will skip tests. -- `-Dspring.config.location=file:/var/ir-iiif-service/config/` will configure the external configuration directory for development using `spring-boot:run`. +For now, **production** deployments are identical to **development** deployments as described in the **Docker** method below. -**Ending trailing slash is required for spring.config.location** +
(back to top)
-The external configuration directory is where an application.yml file can be added to override default properties. When packaging the application, define `config.uri`. This will template context.xml file with the `spring.config.location` system variable for container deployment. -When running for development define `spring.config.location` to externalize the configuration. +## Development Deployment using Docker -**External configuration is recommended for production deployment** +To manually use `docker` rather than `docker-compose`, run the following: -### Development - -```bash -$ mvn clean spring-boot:run +```shell +docker image build -t iriifservice . +docker run -it iriifservice ``` -or run for development with external configuration +_* Note: `-t iriifservice` and `-it iriifservice` may be changed to another tag name as desired, such as `-t developing_on_this` and `-it developing_on_this`._
-```bash -$ mvn clean spring-boot:run -Dspring.config.location=file:/var/ir-iiif-service/config/ -``` +
(back to top)
-### Production -```bash -$ mvn clean package -DskipTests -Dconfig.uri=file:/var/ir-iiif-service/config/ -``` +## Development Deployment using Maven -If build succeeds, you should have `ROOT.war` in the `target/` directory. +Manual deployment can be summed up by running: -## Testing - -```bash -$ mvn clean test +```shell +mvn spring-boot:run ``` -## Configuration - -> Configuration for this service is done in [application.yml](https://github.com/TAMULib/IRIIIFService/blob/master/src/main/resources/application.yml) file located in src/main/resources directory. - -
-View Properties - -
- -| **Property** | **Type** | **Description** | **Example** | -| :-------------------------------------- | :----------- | :-------------------------------------------------------------------------- | :------------------------------------------------------------------------------ | -| server.contextPath | string | Path in which service is hosted. | /iiif-service | -| server.port | number | Port in which service is hosted. | 9000 | -| logging.file | string | Log file. | iiif-service.log | -| logging.level.edu.tamu.iiif | LOG_LEVEL | Log level for iiif service. | INFO | -| logging.level.org.springframework | LOG_LEVEL | Log level for spring framework. | INFO | -| logging.path | string | Path for log file. | /var/logs/iiif | -| spring.activemq.broker-url | url | ActiveMQ broker URL. | tcp://localhost:61616 | -| spring.activemq.username | string | ActiveMQ broker username. | username | -| spring.activemq.password | string | ActiveMQ broker password. | password | -| spring.redis.host | string | Host for redis server. | localhost | -| spring.redis.port | number | Port for redis server. | 6379 | -| spring.profiles.active | string | Build environment profile. | production | -| spring.profiles.include | string | Additional build environment profiles. | dspace, fedora, weaver-messaging | -| messaging.channels.cap | string | Channel to listen for Weaver messages in order to update chached manifests. | cap | -| iiif.admins | object array | Array of admin credentials. | [ { username: admin, password: password } ] | -| iiif.service.url | url | IIIF service URL. | | -| iiif.service.connection.timeout | number | HTTP connection request timeout in milliseconds. | 300000 | -| iiif.service.connection.request.timeout | number | HTTP connection timeout in milliseconds. | 300000 | -| iiif.service.socket.timeout | number | HTTP socket timeout in milliseconds. | 300000 | -| iiif.image.server.url | url | IIIF image server URL. | | -| iiif.logo.url | url | URL for a default logo. | | -| iiif.dspace.identifier | string | DSpace Identifier. | dspace | -| iiif.dspace.label-precedence | array | Array of valid RDF schema fields to determine title. | [ "http://purl.org/dc/elements/1.1/title", "http://purl.org/dc/terms/title" ] | -| iiif.dspace.description-precedence | array | Array of valid RDF schema fields to determine description. | [ "http://purl.org/dc/terms/abstract", "http://purl.org/dc/terms/description" ] | -| iiif.dspace.metadata-prefixes | array | Array of valid RDF schema URL to determine what metadate to include. | [ "http://purl.org/dc/elements/1.1/", "http://purl.org/dc/terms/" ] | -| iiif.dspace.url | url | DSpace base URL. | | -| iiif.dspace.webapp | string | DSpace UI webapp. | xmlui | -| iiif.fedora.identifier | string | Fedora PCDM identifier. | fedora | -| iiif.fedora.url | url | Fedora REST URL. | | -| iiif.dspace.label-precedence | array | Array of valid RDF schema fields to determine title. | [ "http://purl.org/dc/elements/1.1/title", "http://purl.org/dc/terms/title" ] | -| iiif.fedora.description-precedence | array | Array of valid RDF schema fields to determine description. | [ "http://purl.org/dc/terms/abstract", "http://purl.org/dc/terms/description" ] | -| iiif.fedora.metadata-prefixes | array | Array of valid RDF schema URL to determine what metadate to include. | [ "http://purl.org/dc/elements/1.1/", "http://purl.org/dc/terms/" ] | - -
- -Currently, in order to have Tomcat know where the external configuration directory is, `[Tomcat webapps directory]/ir-iiif-service/classes/META-INF/context.xml` will have to be updated. Skip step 1 if package built defining `config.uri`. - -1) Update [context.xml](https://github.com/TAMULib/IRIIIFService/blob/master/src/main/resources/META-INF/context.xml) to set external configuration directory - -```xml - - - - -``` +Those steps are a great way to start but they also fail to explain the customization that is often needed. +There are multiple ways to further configure this for deployment to better meet the desired requirements. -2) Update [application.yml](https://github.com/TAMULib/IRIIIFService/blob/master/src/main/resources/application.yml) +It is highly recommended only to perform *manual installation* when developing. +For **production** deployment, please use the **Docker** method above. -### Deploy to Tomcat +
(back to top)
-Copy war file into Tomcat webapps directory (your location may vary -- this is an example): -```bash -$ cp ~/ROOT.war /opt/tomcat/webapps/ir-iiif-service.war -``` +### Directly Configuring the `src/main/resources/application.yml` File -**if not specifying config.uri during build the application.yml will be under the IR IIIF Service webapp's classpath, /opt/tomcat/webapps/ir-iiif-service/WEB-INF/classes/application.yml** +This method of configuration works by altering the configuration file. -**if deployed from default WAR package and would like to externalize the config, you will have to edit /opt/tomcat/webapps/ir-iiif-service/META-INF/context.xml\*** +With this in mind, the deployment steps now look like: -### Running WAR as a stand-alone Spring Boot application +```shell +# Edit 'src/main/resources/application.yml' here. -```bash -java -jar target/ROOT.war +mvn spring-boot:run ``` + +
(back to top)
+ + + diff --git a/DEPLOYMENT.md b/DEPLOYMENT.md new file mode 100644 index 0000000..d4b1aef --- /dev/null +++ b/DEPLOYMENT.md @@ -0,0 +1,120 @@ + +## Packaging + +IR IIIF Service build is done with [Maven](https://maven.apache.org/). The build is configured with [pom.xml](https://github.com/TAMULib/IRIIIFService/blob/master/pom.xml). + +### Maven build arguments + +- `-DskipTests` will skip tests. +- `-Dspring.config.location=file:/var/ir-iiif-service/config/` will configure the external configuration directory for development using `spring-boot:run`. + +**Ending trailing slash is required for spring.config.location** + +The external configuration directory is where an application.yml file can be added to override default properties. When packaging the application, define `config.uri`. This will template context.xml file with the `spring.config.location` system variable for container deployment. + +When running for development define `spring.config.location` to externalize the configuration. + +**External configuration is recommended for production deployment** + +### Development + +```bash +$ mvn clean spring-boot:run +``` + +or run for development with external configuration + +```bash +$ mvn clean spring-boot:run -Dspring.config.location=file:/var/ir-iiif-service/config/ +``` + +### Production + +```bash +$ mvn clean package -DskipTests -Dconfig.uri=file:/var/ir-iiif-service/config/ +``` + +If build succeeds, you should have `ROOT.war` in the `target/` directory. + +## Testing + +```bash +$ mvn clean test +``` + +## Configuration + +> Configuration for this service is done in [application.yml](https://github.com/TAMULib/IRIIIFService/blob/master/src/main/resources/application.yml) file located in src/main/resources directory. + +
+View Properties + +
+ +| **Property** | **Type** | **Description** | **Example** | +| :-------------------------------------- | :----------- | :-------------------------------------------------------------------------- | :------------------------------------------------------------------------------ | +| server.contextPath | string | Path in which service is hosted. | /iiif-service | +| server.port | number | Port in which service is hosted. | 9000 | +| logging.file | string | Log file. | iiif-service.log | +| logging.level.edu.tamu.iiif | LOG_LEVEL | Log level for iiif service. | INFO | +| logging.level.org.springframework | LOG_LEVEL | Log level for spring framework. | INFO | +| logging.path | string | Path for log file. | /var/logs/iiif | +| spring.activemq.broker-url | url | ActiveMQ broker URL. | tcp://localhost:61616 | +| spring.activemq.username | string | ActiveMQ broker username. | username | +| spring.activemq.password | string | ActiveMQ broker password. | password | +| spring.redis.host | string | Host for redis server. | localhost | +| spring.redis.port | number | Port for redis server. | 6379 | +| spring.profiles.active | string | Build environment profile. | production | +| spring.profiles.include | string | Additional build environment profiles. | dspace, fedora, weaver-messaging | +| messaging.channels.cap | string | Channel to listen for Weaver messages in order to update chached manifests. | cap | +| iiif.admins | object array | Array of admin credentials. | [ { username: admin, password: password } ] | +| iiif.service.url | url | IIIF service URL. | | +| iiif.service.connection.timeout | number | HTTP connection request timeout in milliseconds. | 300000 | +| iiif.service.connection.request.timeout | number | HTTP connection timeout in milliseconds. | 300000 | +| iiif.service.socket.timeout | number | HTTP socket timeout in milliseconds. | 300000 | +| iiif.image.server.url | url | IIIF image server URL. | | +| iiif.logo.url | url | URL for a default logo. | | +| iiif.dspace.identifier | string | DSpace Identifier. | dspace | +| iiif.dspace.label-precedence | array | Array of valid RDF schema fields to determine title. | [ "http://purl.org/dc/elements/1.1/title", "http://purl.org/dc/terms/title" ] | +| iiif.dspace.description-precedence | array | Array of valid RDF schema fields to determine description. | [ "http://purl.org/dc/terms/abstract", "http://purl.org/dc/terms/description" ] | +| iiif.dspace.metadata-prefixes | array | Array of valid RDF schema URL to determine what metadate to include. | [ "http://purl.org/dc/elements/1.1/", "http://purl.org/dc/terms/" ] | +| iiif.dspace.url | url | DSpace base URL. | | +| iiif.dspace.webapp | string | DSpace UI webapp. | xmlui | +| iiif.fedora.identifier | string | Fedora PCDM identifier. | fedora | +| iiif.fedora.url | url | Fedora REST URL. | | +| iiif.dspace.label-precedence | array | Array of valid RDF schema fields to determine title. | [ "http://purl.org/dc/elements/1.1/title", "http://purl.org/dc/terms/title" ] | +| iiif.fedora.description-precedence | array | Array of valid RDF schema fields to determine description. | [ "http://purl.org/dc/terms/abstract", "http://purl.org/dc/terms/description" ] | +| iiif.fedora.metadata-prefixes | array | Array of valid RDF schema URL to determine what metadate to include. | [ "http://purl.org/dc/elements/1.1/", "http://purl.org/dc/terms/" ] | + +
+ +Currently, in order to have Tomcat know where the external configuration directory is, `[Tomcat webapps directory]/ir-iiif-service/classes/META-INF/context.xml` will have to be updated. Skip step 1 if package built defining `config.uri`. + +1) Update [context.xml](https://github.com/TAMULib/IRIIIFService/blob/master/src/main/resources/META-INF/context.xml) to set external configuration directory + +```xml + + + + +``` + +2) Update [application.yml](https://github.com/TAMULib/IRIIIFService/blob/master/src/main/resources/application.yml) + +### Deploy to Tomcat + +Copy war file into Tomcat webapps directory (your location may vary -- this is an example): + +```bash +$ cp ~/ROOT.war /opt/tomcat/webapps/ir-iiif-service.war +``` + +**if not specifying config.uri during build the application.yml will be under the IR IIIF Service webapp's classpath, /opt/tomcat/webapps/ir-iiif-service/WEB-INF/classes/application.yml** + +**if deployed from default WAR package and would like to externalize the config, you will have to edit /opt/tomcat/webapps/ir-iiif-service/META-INF/context.xml\*** + +### Running WAR as a stand-alone Spring Boot application + +```bash +java -jar target/ROOT.war +``` diff --git a/Dockerfile b/Dockerfile index df7a4dc..3f3d52f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,24 +1,27 @@ # Settings. ARG USER_ID=3001 ARG USER_NAME=iriif -ARG HOME_DIR=/$USER_NAME -ARG SOURCE_DIR=$HOME_DIR/source +ARG SOURCE_DIR=/$USER_NAME/source # Maven stage. FROM maven:3-openjdk-11-slim as maven ARG USER_ID ARG USER_NAME -ARG HOME_DIR ARG SOURCE_DIR -# Create the group (use a high ID to attempt to avoid conflits). -RUN groupadd -g $USER_ID $USER_NAME +# Create the user and group (use a high ID to attempt to avoid conflicts). +RUN groupadd --non-unique -g $USER_ID $USER_NAME && \ + useradd --non-unique -d /$USER_NAME -m -u $USER_ID -g $USER_ID $USER_NAME -# Create the user (use a high ID to attempt to avoid conflits). -RUN useradd -d $HOME_DIR -m -u $USER_ID -g $USER_ID $USER_NAME +# Update the system and install dependencies. +RUN apt-get update && \ + apt-get upgrade -y && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* -# Update the system. -RUN apt-get update && apt-get upgrade -y +# Make sure source directory exists. +RUN mkdir -p $SOURCE_DIR && \ + chown -R $USER_ID:$USER_ID $SOURCE_DIR # Set deployment directory. WORKDIR $SOURCE_DIR @@ -40,20 +43,17 @@ RUN mvn package -Pjar -DskipTests=true FROM openjdk:11-jre-slim ARG USER_ID ARG USER_NAME -ARG HOME_DIR ARG SOURCE_DIR -# Create the group (use a high ID to attempt to avoid conflits). -RUN groupadd -g $USER_ID $USER_NAME - -# Create the user (use a high ID to attempt to avoid conflits). -RUN useradd -d $HOME_DIR -m -u $USER_ID -g $USER_ID $USER_NAME +# Create the user and group (use a high ID to attempt to avoid conflicts). +RUN groupadd --non-unique -g $USER_ID $USER_NAME && \ + useradd --non-unique -d /$USER_NAME -m -u $USER_ID -g $USER_ID $USER_NAME # Login as user. USER $USER_NAME # Set deployment directory. -WORKDIR $HOME_DIR +WORKDIR /$USER_NAME # Copy over the built artifact from the maven image. COPY --from=maven $SOURCE_DIR/target/ROOT.jar ./iriif.jar diff --git a/LICENSE b/LICENSE index 408a7ff..9d02011 100644 --- a/LICENSE +++ b/LICENSE @@ -1,21 +1,8 @@ -MIT License +The MIT License (MIT) +Copyright © 2022 Texas A&M University Libraries -Copyright (c) 2018 Texas A&M University Libraries +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/README.md b/README.md index eea40f9..947b21b 100644 --- a/README.md +++ b/README.md @@ -1,101 +1,174 @@ -[![Build Status](https://github.com/TAMULib/IRIIIFService/workflows/Build/badge.svg)](https://github.com/TAMULib/IRIIIFService/actions?query=workflow%3ABuild) -[![Coverage Status](https://coveralls.io/repos/github/TAMULib/IRIIIFService/badge.svg?branch=main)](https://coveralls.io/github/TAMULib/IRIIIFService?branch=main) +[![Build Status][build-badge]][build-status] +[![Coverage Status][coverage-badge]][coverage-status] -# IR IIIF Service +# Institutional Repository International Image Interoperability Framework Service -> This service provides IIIF manifest generation from DSpace RDF and/or Fedora PCDM. + -## Requirements +A *Spring* backend for the *Institutional Repository International Image Interoperability Framework (IRIIIF) Service* developed and maintained by [Texas A&M University Libraries][tamu-library]. -- [Redis](https://redis.io/) - - manifest cache - - resource URL cache +This service provides **IIIF** manifest generation from **DSpace RDF** and/or **Fedora PCDM**. + +
+Table of contents + + - [Requirements:](#requirements) + - [External Requirements:](#external-requirements) + - [IIIF Server](#iiif-server) + - [DSpace](#dspace) + - [Fedora](#fedora) + - [Developer Documentation](#developer-documentation) + - [Additional Resources](#additional-resources) + +
+ + +## Requirements: + +- [Redis][redis] + - manifest cache + - resource URL cache + +
(back to top)
-## External Requirements -- IIIF Image Server - - must support API v2 - - script delegate to resolve identifier - - tested with [Cantaloupe](https://medusa-project.github.io/cantaloupe/) -- DSpace - - RDF webapp deployed and indexed - - Triplestore - - tested with [Fuseki](https://jena.apache.org/documentation/fuseki2/) -- Fedora - - structured with [PCDM](https://pcdm.org/) +### External Requirements: -### [IIIF](http://iiif.io/) Image Server +- IIIF Server + - must support API v2 + - script delegate to resolve identifier + - tested with [Cantaloupe][cantaloupe] +- DSpace + - RDF webapp deployed and indexed + - Triplestore + - tested with [Fuseki][fuseki] +- Fedora + - structured with [PCDM][pcdm] -- Image resolution by identifier - - `http://[iiif image server]/iiif/2/[UUID redis key]/full/full/0/default.jpg` - - UUID resource location resolution via resources interface -- [Presentation API v2](http://iiif.io/api/presentation/2.1/) -- [Image API v2](http://iiif.io/api/image/2.1/) +
(back to top)
+ + +#### [IIIF][iiif] Server + +- Image resolution by identifier + - `http://[iiif image server]/iiif/2/[UUID redis key]/full/full/0/default.jpg` + - UUID resource location resolution via resources interface +- [Presentation API v2][iiif-presentation-api-v2] +- [Image API v2][iiif-image-api-v2]
Example Cantaloupe custom delegate -
- - require 'base64' - class CustomDelegate - ## - # Returns one of the following: - # - # 1. String URI - # 2. Hash with the following keys: - # * `uri` [String] (required) - # * `username` [String] For HTTP Basic authentication (optional). - # * `secret` [String] For HTTP Basic authentication (optional). - # * `headers` [Hash] Hash of request headers (optional). - # 3. nil if not found. - # - # @param options [Hash] Empty hash. - # @return See above. - # - def httpsource_resource_info(options = {}) - id = context['identifier'] - puts id - if ( id =~ /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/ ) - uri = '<%= @iiif_service_url %>resources/' + id + '/redirect' - elsif - irid = Base64.decode64(id) - puts irid - if irid.include? ":" - parts = irid.split(':') - ir = parts[0] - path = parts[1] - if ir == 'fedora' - uri = '<%= @fedora_url %>' + path - elsif ir == 'dspace' - uri = '<%= @dspace_url %>' + path - else - uri = irid - end - else - uri = id - end + require 'base64' + class CustomDelegate + ## + # Returns one of the following: + # + # 1. String URI + # 2. Hash with the following keys: + # * `uri` [String] (required) + # * `username` [String] For HTTP Basic authentication (optional). + # * `secret` [String] For HTTP Basic authentication (optional). + # * `headers` [Hash] Hash of request headers (optional). + # 3. nil if not found. + # + # @param options [Hash] Empty hash. + # @return See above. + # + def httpsource_resource_info(options = {}) + id = context['identifier'] + puts id + if ( id =~ /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/ ) + uri = '<%= @iiif_service_url %>resources/' + id + '/redirect' + elsif + irid = Base64.decode64(id) + puts irid + if irid.include? ":" + parts = irid.split(':') + ir = parts[0] + path = parts[1] + if ir == 'fedora' + uri = '<%= @fedora_url %>' + path + elsif ir == 'dspace' + uri = '<%= @dspace_url %>' + path + else + uri = irid end - puts uri - return uri + else + uri = id end end + puts uri + return uri + end + end
-### [DSpace](http://www.dspace.org/) +
(back to top)
+ + +#### [DSpace][dspace] + +- [Installation][dspace-install] +- [RDF][dspace-rdf] + +
(back to top)
+ -- [Installation](https://wiki.duraspace.org/display/DSDOC6x/Installing+DSpace#space-menu-link-content) -- [RDF](https://wiki.duraspace.org/display/DSDOC6x/Linked+%28Open%29+Data) +#### [Fedora][fedora] -### [Fedora](https://fedorarepository.org/) +- [Installation][fedora-install] + +
(back to top)
-- [Installation](https://wiki.duraspace.org/display/FEDORA4x/Quick+Start) ## Developer Documentation -- [Contributors Documentation](https://github.com/TAMULib/IRIIIFService/blob/master/CONTRIBUTING.md) -- [Deployment Documentation](https://github.com/TAMULib/IRIIIFService/blob/master/DEPLOYING.md) -- [API Documentation](https://tamulib.github.io/IRIIIFService) +- [Contributors Documentation][contribute-guide] +- [Deployment Documentation][deployment-guide] +- [API Documentation][api-guide] + +
(back to top)
+ + +## Additional Resources + +Please feel free to file any issues concerning Ecosystem Identifier Service to the issues section of the repository. + +Any questions concerning Ecosystem Identifier Service can be directed to helpdesk@library.tamu.edu. + +Copyright © 2022 Texas A&M University Libraries under the [MIT License][license]. + +
(back to top)
+ + + +[build-badge]: https://github.com/TAMULib/IRIIIFService/workflows/Build/badge.svg +[build-status]: https://github.com/TAMULib/IRIIIFService/actions?query=workflow%3ABuild +[coverage-badge]: https://coveralls.io/repos/github/TAMULib/IRIIIFService/badge.svg +[coverage-status]: https://coveralls.io/github/TAMULib/IRIIIFService + +[api-guide]: https://tamulib.github.io/IRIIIFService +[tamu-library]: http://library.tamu.edu +[deployment-guide]: DEPLOYING.md +[contribute-guide]: CONTRIBUTING.md +[license]: LICENSE + +[redis]: https://redis.io/ + +[cantaloupe]: https://medusa-project.github.io/cantaloupe/ +[fuseki]: https://jena.apache.org/documentation/fuseki2/ + +[pcdm]: https://pcdm.org/ + +[iiif]: http://iiif.io/ +[iiif-presentation-api-v2]: http://iiif.io/api/presentation/2.1/) +[iiif-image-api-v2]: http://iiif.io/api/image/2.1/) + +[dspace]: http://www.dspace.org/ +[dspace-install]: https://wiki.duraspace.org/display/DSDOC6x/Installing+DSpace#space-menu-link-content +[dspace-rdf]: https://wiki.duraspace.org/display/DSDOC6x/Linked+%28Open%29+Data -Please feel free to file any issues concerning IRIIIFService to the issues section of the repository. Any questions concerning cap can be directed to [helpdesk@library.tamu.edu](<>) +[fedora]: https://fedorarepository.org/ +[fedora-install]: https://wiki.duraspace.org/display/FEDORA4x/Quick+Start diff --git a/pom.xml b/pom.xml index 3945d88..4ed0044 100644 --- a/pom.xml +++ b/pom.xml @@ -1,7 +1,6 @@ - 4.0.0 edu.tamu @@ -15,7 +14,7 @@ edu.tamu.weaver webservice-parent - 2.1.1-RC10 + 2.1.1-RC11 @@ -74,8 +73,8 @@ spring-boot-starter-data-redis - io.lettuce - lettuce-core + io.lettuce + lettuce-core @@ -362,14 +361,22 @@ tamu-releases https://artifacts.library.tamu.edu/repository/maven-releases - true - false + + true + + + false + tamu-snapshots https://artifacts.library.tamu.edu/repository/maven-snapshots - false - true + + false + + + true + diff --git a/src/test/resources/logback-test.xml b/src/test/resources/logback-test.xml index f6a703d..37b758e 100644 --- a/src/test/resources/logback-test.xml +++ b/src/test/resources/logback-test.xml @@ -1,9 +1,9 @@ - +