Skip to content

Adding user authentication to SAS #94

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

Open
wants to merge 163 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
163 commits
Select commit Hold shift + click to select a range
24ff802
testing out SLU requirements
glenrobson Sep 9, 2020
834959c
Adding first auth version
glenrobson Oct 28, 2020
74b9760
Building correct version
glenrobson Oct 28, 2020
13b0a12
Trying official aws client.
glenrobson Oct 28, 2020
8992525
Adding pass through credentials
glenrobson Oct 28, 2020
14bd427
Fixing new lines
glenrobson Oct 28, 2020
e5f9bc1
Reverting to stable verison
glenrobson Oct 28, 2020
9734230
Adding debug
glenrobson Oct 28, 2020
b0aed4f
Moving region
glenrobson Oct 28, 2020
5ea32d4
Removing debug
glenrobson Oct 28, 2020
dedc717
Adding Logout menu item
glenrobson Nov 4, 2020
b7eaf81
Adding external link page
glenrobson Nov 4, 2020
f4f0856
Adding User saving and profile editing
glenrobson Nov 6, 2020
f546b64
Making auth decisions in one place
glenrobson Nov 6, 2020
8c32865
Fixing SOLR schema error
glenrobson Nov 6, 2020
ed02c87
Fixing SOLR return types
glenrobson Nov 6, 2020
a1090f5
Ensuring Picture is added with SOLR
glenrobson Nov 6, 2020
76ff47a
Adding id to ElasticSearch user
glenrobson Nov 7, 2020
0a113c9
Adding collection support
glenrobson Nov 18, 2020
ab6a19a
Removing ListAnnoPages as this happens in manifest.xhtml now
glenrobson Nov 18, 2020
3a26886
Importing correct class
glenrobson Nov 18, 2020
8c7d78d
Removing listAnnoPages
glenrobson Nov 18, 2020
ae11f0f
Correcting spelling
glenrobson Nov 18, 2020
917add3
Fixing issue with Annotation shape for Mirador
glenrobson Nov 19, 2020
34e97df
Updating stats with users
glenrobson Nov 19, 2020
e851326
Updating IIIF search to support users
glenrobson Nov 19, 2020
873f1a4
Adding collections to ElasticSearch
glenrobson Nov 19, 2020
88fe417
Adding collection support to Solr
glenrobson Nov 19, 2020
51ec19b
Using personal credentials for docker hub to get round limits
glenrobson Nov 20, 2020
64854eb
Fixing logout redirect and adding error messages
glenrobson Nov 20, 2020
521212d
Adding auth check to see if user is collection owner
glenrobson Nov 20, 2020
50f0dec
Debugging shared collection issue
glenrobson Nov 20, 2020
f4a02a7
Changing to a term rather than a match query
glenrobson Nov 20, 2020
734e24a
Adding code so this can be tested locally
glenrobson Nov 20, 2020
3ddfda5
Send error message if index has the wrong mapping
glenrobson Nov 21, 2020
ced1738
Adding error checking and messages to the user if there are issues
glenrobson Nov 21, 2020
2502cd4
Adding docs for running Auth
glenrobson Nov 21, 2020
c6673fd
Adding code to handle labels with language
glenrobson Nov 26, 2020
90f118c
Debugging delete issue
glenrobson Nov 27, 2020
fe8d233
Ensuring identifier ends with slash
glenrobson Nov 27, 2020
68dd867
Getting Put params from body
glenrobson Nov 27, 2020
9c4faf3
Moving to JSON for doPut
glenrobson Nov 28, 2020
36d6b8c
Making collections public by default
glenrobson Dec 5, 2020
1c60b77
Adding content-state
glenrobson Dec 5, 2020
bf590a7
Making default collection name configurable
glenrobson Dec 5, 2020
6113a41
First UX changes from Ben
glenrobson Dec 8, 2020
af2ed6d
Switching location of close button
glenrobson Dec 8, 2020
64fe12f
Moving logo around
glenrobson Dec 9, 2020
f1d9fa9
Fixing colours on delete collection
glenrobson Dec 9, 2020
ad397d2
Moving s3 auth.json location to AWS parameter
glenrobson Jan 7, 2021
1f771a6
Removing hard coding of links
glenrobson Jan 27, 2021
c2260d7
Adding first draft of new theme
glenrobson Aug 4, 2021
bdf9f3d
Merge pull request #103 from glenrobson/stage3
glenrobson Aug 4, 2021
adf8ede
Updating collections screen.
glenrobson Aug 5, 2021
bb192db
Merge pull request #106 from glenrobson/stage3
glenrobson Aug 5, 2021
848f5f1
Fixing content state copy action
glenrobson Aug 5, 2021
39b9c46
Merge pull request #107 from glenrobson/stage3
glenrobson Aug 5, 2021
27ad522
Changes requested in #102
glenrobson Aug 13, 2021
8d5bcef
Merge pull request #109 from glenrobson/stage3
glenrobson Aug 13, 2021
08dd190
Updating Manifest view with tasks in #104
glenrobson Aug 17, 2021
9680d59
Adding annotations browse screen in #105
glenrobson Aug 18, 2021
ad4e6a3
Adding share manifest detailed in #97
glenrobson Aug 20, 2021
881595d
Adding local user option
glenrobson Sep 14, 2021
5e74cfb
Adding GitHub action and moving away from Travis
glenrobson Sep 15, 2021
d05584f
Removing Travis ci testing
glenrobson Sep 15, 2021
052ff7e
Fixing path
glenrobson Sep 15, 2021
d335ba7
Testing Elastic Search separately
glenrobson Sep 15, 2021
bcac44e
Fixing build name
glenrobson Sep 15, 2021
f94cfd4
Splitting out different backend tests
glenrobson Sep 15, 2021
5053930
Writing failing test
glenrobson Sep 17, 2021
51d9767
Fixing SOLR cloud build
glenrobson Sep 17, 2021
acd9000
Silently failing if webapps dir is empty
glenrobson Sep 17, 2021
0eaa557
Debugging cloud
glenrobson Sep 17, 2021
5d1d6aa
Adding debug
glenrobson Sep 17, 2021
0cee843
Removing container java
glenrobson Sep 17, 2021
7a6a767
Updating java version
glenrobson Sep 17, 2021
22bcbc3
Fixing jena test
glenrobson Sep 17, 2021
b031668
testing ci
glenrobson Sep 17, 2021
a746e07
fixing test ci test
glenrobson Sep 17, 2021
87d0c0c
Setting variable at same time
glenrobson Sep 17, 2021
df209ee
Fixing tests
glenrobson Sep 17, 2021
d7e7cba
Fixing user type test
glenrobson Sep 17, 2021
56a97bd
testing SOLR ci
glenrobson Sep 17, 2021
93532c8
Fixing ci test
glenrobson Sep 17, 2021
747cfc0
Changing the method for authenticating the admin
glenrobson Sep 21, 2021
ce87a89
Fixing elastic test failure
glenrobson Sep 21, 2021
833e72a
Adding password to SOLR schema
glenrobson Sep 21, 2021
34dd756
Fixing Elastic docker build
glenrobson Sep 21, 2021
12116b4
Stopping double encoding of password
glenrobson Sep 21, 2021
a4f58c4
Fixing auth docker file
glenrobson Sep 21, 2021
8fe3852
Fixing check on elastic search password
glenrobson Sep 21, 2021
68eb859
Removing debug message
glenrobson Sep 21, 2021
dee8acc
Adding help text
glenrobson Sep 21, 2021
82a78a1
Removing content state link and closing #104
glenrobson Sep 21, 2021
962332c
Making profile editing work for admin
glenrobson Sep 21, 2021
170aec6
Adding overall stats defined in #110
glenrobson Sep 24, 2021
7bdca07
Fixing annotation parsing for stats
glenrobson Sep 24, 2021
9dab005
Fixing syntax error
glenrobson Sep 24, 2021
426ba27
Fixing target parsing
glenrobson Sep 25, 2021
89055e7
Adding JS unit testing
glenrobson Sep 27, 2021
7db0c6e
Adding node to SOLR cloud tests
glenrobson Sep 27, 2021
fabe3a1
Fixing issue where rename wasn't working on tomcat
glenrobson Sep 28, 2021
3fa6db6
Changing collection name to default
glenrobson Sep 28, 2021
9273a46
Adding enter click submit
glenrobson Sep 28, 2021
7282411
Merge pull request #113 from glenrobson/js_testing
glenrobson Sep 28, 2021
6c31294
Searching for both http and https uri
glenrobson Sep 28, 2021
676e642
Adding delete user
glenrobson Sep 28, 2021
2625332
Adding delete front end code
glenrobson Sep 28, 2021
5a30d47
Merge pull request #114 from glenrobson/id_matching
glenrobson Sep 29, 2021
991ce02
Ensuring original id is used where possible
glenrobson Sep 29, 2021
0b0dba8
Merge pull request #115 from glenrobson/id_matching
glenrobson Sep 29, 2021
b951ab6
Fixing download annotation list
glenrobson Sep 30, 2021
75842fc
Making listAnnos User aware
glenrobson Oct 12, 2021
b080ddb
Fixing tests
glenrobson Oct 26, 2021
5ef662c
Handling empty user
glenrobson Oct 26, 2021
1dec7fe
Merge pull request #116 from glenrobson/user_anno_list
glenrobson Oct 26, 2021
6cf570f
Updating label to use latest
glenrobson Oct 26, 2021
c918913
Pushing latest and tagged version
glenrobson Oct 26, 2021
9ce2330
Adding missing space
glenrobson Oct 26, 2021
0a6f886
Fixing link to annotation list
glenrobson Oct 27, 2021
4076c70
Merge pull request #117 from glenrobson/editAnnoFix
glenrobson Oct 27, 2021
da2960d
Trying window.location.reload rather than redirect
glenrobson Nov 2, 2021
cc40b6c
Adding a time param to invalidate cache
glenrobson Nov 2, 2021
d5c688a
Adding no cache header
glenrobson Nov 2, 2021
0b3605a
Adding debug to trace caching issue
glenrobson Nov 12, 2021
3858ea4
Removing debug
glenrobson Nov 13, 2021
cd7ff89
Changing elastic search commit policy
glenrobson Nov 13, 2021
078f35c
If no collection specified default to inbox
glenrobson Nov 13, 2021
1c6d4fd
Moving iiif-logo local
glenrobson Nov 13, 2021
170333a
Fixing elastic docker build
glenrobson Nov 13, 2021
6afe330
Returning to home collection if its present in the URL
glenrobson Nov 16, 2021
ff5844f
Adding Clickable Manifest URL link
glenrobson Nov 16, 2021
e1cc2b9
Updating to get rid of log4j issue
glenrobson Dec 15, 2021
fd8b10c
Merge pull request #122 from glenrobson/update_libraries
glenrobson Dec 15, 2021
fe32286
Updating to latest elastic search
glenrobson Dec 15, 2021
b2105f7
Merge pull request #126 from glenrobson/update_libraries
glenrobson Dec 15, 2021
f51ae09
Downgrading ELS version to a version that works with openSearch
glenrobson Jan 15, 2022
7b5a5d8
Fixing import issue
glenrobson Jan 15, 2022
ebdb6f1
Merge pull request #131 from glenrobson/downgrading-els
glenrobson Jan 15, 2022
843e0ed
Speeding up index manifest
glenrobson Jan 25, 2022
09623b0
Moving linkupOrphanCanvas to a optional task
glenrobson Jan 25, 2022
fd79fc5
Removing unnecessary call.
glenrobson Jan 25, 2022
91e0692
Merge pull request #134 from glenrobson/test_es_calls
glenrobson Jan 25, 2022
f17d03d
Fixing manifest short_id when id has . in
glenrobson Mar 17, 2022
303da8b
Fixing bug where number of annotations weren't shown correctly
glenrobson Apr 27, 2022
1cd989a
Adding testing to make sure only admin can see other annotations
glenrobson Apr 28, 2022
d972b7d
Merge pull request #140 from glenrobson/fix_view_anno
glenrobson Apr 28, 2022
293bd07
Fixing exception on empty manifest
glenrobson Sep 22, 2022
993154b
Fixing issue with duplicate IDs
glenrobson Oct 28, 2022
0d0c968
Checking to see if Manifest is null before calling methods
glenrobson Oct 28, 2022
fd26e8f
Lengthening startup time
glenrobson Oct 28, 2022
650efd6
Adding check to see if container has started
glenrobson Oct 28, 2022
9146d51
Adding volume for SOLR data
glenrobson Oct 28, 2022
658392a
Creating SOLR home
glenrobson Oct 28, 2022
0846596
Making data directory writeable
glenrobson Oct 28, 2022
70ec172
Pinning to SOLR 8
glenrobson Oct 28, 2022
318c5d2
Adding solr data to ignore file
glenrobson Oct 28, 2022
5bfced9
Creating data dir
glenrobson Oct 28, 2022
9b5bdf1
Merge pull request #147 from glenrobson/ambigous_methods_fix
glenrobson Oct 28, 2022
6fcb8f0
Adding comment
glenrobson Sep 5, 2024
be2b932
Updating Docker names and versions
glenrobson Sep 9, 2024
8b579df
Updating the location of the v3 manifests
glenrobson Sep 9, 2024
a2b6a40
Merge pull request #153 from glenrobson/support-v3
glenrobson Sep 9, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
11 changes: 11 additions & 0 deletions .github/bin/waitHttp.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

http_code=100
while [ "$http_code" != "200" ]
do
sleep 5
http_code=`curl --write-out %{http_code} --silent --output /dev/null "$1"`
echo "$http_code";
done


23 changes: 23 additions & 0 deletions .github/workflows/elastic.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Elastic

on: [push]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'temurin'
cache: maven
- name: Starting ElasticSearch
run: docker compose -f docker/sas-elastic/compose.yaml --project-directory . up -d elastic
- name: Wait for Elastic to start
run: .github/bin/waitHttp.sh "http://localhost:9200/_cluster/health?wait_for_status=yellow&timeout=50s"
- name: Run Tests
run: export "config=elastic.properties" && mvn test

22 changes: 22 additions & 0 deletions .github/workflows/jena.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Jena

on: [push]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'temurin'
cache: maven

- name: Selecting Jena config
run: export "config=Jena.properties"

- name: Run Tests
run: mvn test
21 changes: 21 additions & 0 deletions .github/workflows/solr-cloud.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: SOLR Cloud

on: [push]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Starting SOLR
run: docker compose -f docker/sas-solr-cloud/compose.yaml --project-directory . up -d

- name: Wait for SOLR to start
run: docker exec -t solr1 /opt/docker-solr/scripts/wait-for-solr.sh --max-attempts 10 --wait-seconds 5 --solr-url http://0.0.0.0:8983/

# Due to the way docker-compose and SOLR works we can't access the SOLR cloud
# from this machine. Instead we have to run the test within the cluster
- name: Run Tests
run: docker exec --workdir /usr/src/sas simpleannotationserver_web_1 /usr/bin/mvn -q test
27 changes: 27 additions & 0 deletions .github/workflows/solr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: SOLR

on: [push]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'temurin'
cache: maven
- name: Starting SOLR
run: mkdir solr-data && chmod 777 solr-data && docker compose -f docker/sas-solr/compose.yaml --project-directory . up -d solr

- name: checking docker
run: docker ps && docker logs sas_solr

- name: Wait for SOLR to start
run: docker exec -t sas_solr /opt/docker-solr/scripts/wait-for-solr.sh --max-attempts 10 --wait-seconds 10 --solr-url http://0.0.0.0:8983/

- name: Run Tests
run: export "config=solr.properties" && mvn test
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,10 @@ src/main/webapp/demo.html
/data
cache
index-2.6.1.html
src/main/webapp/stats
src/main/webapp/stats/*.json
.aws-credentials
auth.json
*auth.json
node
node_modules
solr-data
5 changes: 0 additions & 5 deletions .travis.yml

This file was deleted.

8 changes: 5 additions & 3 deletions buildspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ phases:
- echo Logging in to Amazon ECR...
- aws --version
- $(aws ecr get-login --region $AWS_DEFAULT_REGION --no-include-email)
- echo Logging in to Docker Hub...
- echo $DOCKERHUB_PASSWORD | docker login --username $DOCKERHUB_USERNAME --password-stdin
- IMAGE_NAME="sas"
- REPOSITORY_URI=082101253860.dkr.ecr.eu-west-2.amazonaws.com/sas
- IMAGE_TAG=prod_$(echo $CODEBUILD_RESOLVED_SOURCE_VERSION | cut -c 1-7)
Expand All @@ -14,13 +16,13 @@ phases:
- echo Build started on `date`
- echo Building the Docker image...
- echo Image_tag $IMAGE_TAG
- docker build -t $REPOSITORY_URI:$IMAGE_TAG -f docker/sas-tomcat/Dockerfile .
- docker tag $REPOSITORY_URI:$IMAGE_TAG $REPOSITORY_URI:latest
- docker build --build-arg AUTH_JSON_LOCATION=$AUTH_JSON_LOCATION --build-arg AWS_DEFAULT_REGION=$AWS_DEFAULT_REGION --build-arg AWS_CONTAINER_CREDENTIALS_RELATIVE_URI=$AWS_CONTAINER_CREDENTIALS_RELATIVE_URI -t $REPOSITORY_URI:$IMAGE_TAG -t $REPOSITORY_URI:latest -f docker/sas-auth/Dockerfile .
post_build:
commands:
- echo Build completed on `date`
- echo Pushing the Docker images...
- docker push $REPOSITORY_URI
- docker push $REPOSITORY_URI:latest
- docker push $REPOSITORY_URI:$IMAGE_TAG
- echo Writing image definitions file...
- printf '[{"name":"SAS","imageUri":"%s"}]' $REPOSITORY_URI:$IMAGE_TAG > imagedefinitions.json
artifacts:
Expand Down
143 changes: 143 additions & 0 deletions doc/Auth.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
# Authentication

The SimpleAnnotationServer now supports Authentication through OAuth. This allows users to login using Google, GitHub or other OAuth provider and to work on a private workspace of Annotations, Manifests and Collections.

## Configuration

The presence of a file called `auth.json` in the `src/main/webapp/WEB-INF` is enough for SAS to know that it should use authentication for all requests. The `auth.json` file has settings for OAuth providers and should be kept secret and outside of GitHub. An example configuration for Google is shown below:

```
[{
"id":"google",
"class": "com.github.scribejava.apis.GoogleApi20",
"clientId": "**google_client_id**",
"clientSecret": "**google_client_secret",
"scope": "profile email",
"additionalParam": {
"access_type": "offline"
},
"button": {
"logo": "/images/GoogleLogo.svg",
"text": "Sign in with Google"
},
"userMapping": {
"endpoint": "https://www.googleapis.com/oauth2/v3/userinfo",
"responseKeys": {
"id":"sub",
"name": "name",
"email": "email",
"pic": "picture"
}
}
}]
```

The file is split into three sections; OAuth settings, button config and userMappings and details for each section can be seen below. To offer multiple login options it is possible to add extra configs to this file as the root of the JSON is a list.

### OAuth Settings

The OAuth settings from above are copied below for convenience:

```
"id":"google",
"class": "com.github.scribejava.apis.GoogleApi20",
"clientId": "**google_client_id**",
"clientSecret": "**google_client_secret",
"scope": "profile email",
"additionalParam": {
"access_type": "offline"
},
```

The files are:

* __id__ this should be unique in the file and be used to identify the authentication method
* __class__ this is the [ScribeJava](https://github.com/scribejava/scribejava) OAuth library class which implements this authentication method. The ScribeJava github site gives examples with lots of different OAuth providers.
* __clientId__ and __clientSecret__ these are generated by Google and you can apply for a set of keys by going to the [Google Developer Console](https://console.developers.google.com/apis/credentials). When you apply for keys you will need to add a Authorized redirect URI to the SAS system. This is the URL google will return the user if they authenticated correctly. The redirect URI should be:

https://example.com/login-callback

where example.com is the public domain name you are using to host SAS.

* __scope__ this is the information SAS is asking the user to give permission for. To find out what is required for your OAuth provider check the ScribeJava examples.
* __additionalParam__ some OAuth providers also require extra parameters. Again check ScribeJava to see if this is required.

### Button config
When you login to SAS it will present you with a login page where users are asked to choose which login service they would like to register with. The button config allows customisation of the logo and text that is offered to the user for this authentication method:

```
"button": {
"logo": "/images/GoogleLogo.svg",
"text": "Sign in with Google"
},
```

### User Mapping
Once a user has been authenticated then SAS will request the name, email and profile picture from the OAuth provider. This is usually done using a standard API that returns a JSON list of keys. The Key mapping configuration maps the OAuth User JSON to SAS's users.

```
"userMapping": {
"endpoint": "https://www.googleapis.com/oauth2/v3/userinfo",
"responseKeys": {
"id":"sub",
"name": "name",
"email": "email",
"pic": "picture"
}
}
```

## Extra customisation

As well as the general configuration above its also possible to customise the authentication in the following ways.



## Deployment with Docker

If you are working with SAS in the cloud you will need to make sure the that the auth.json doesn't end up in GitHub where it will be public. There is an example [Dockerfile](../docker/sas-auth/Dockerfile) in the sas-auth directory which will work with a `auth.json` held in an Amazon S3 bucket. To get this to work you will need to ensure the Code Pipeline role has the following permissions:


Codepipeline Service role to access s3:

Build project -> build details -> Service role ARN

Ensure ROLE has this:
```
{
"Action": [
"s3:GetObject",
"s3:GetObjectVersion",
"s3:GetBucketVersioning"
],
"Resource": [
"arn:aws:s3:::sasconfig*"
],
"Effect": "Allow"
},
{
"Effect": "Allow",
"Action": [
"kms:Decrypt",
"kms:GenerateDataKey",
"kms:GenerateDataKeyWithoutPlaintext",
"kms:GenerateDataKeyPairWithoutPlaintext",
"ssm:GetParameters",
"kms:GenerateDataKeyPair",
"ssm:GetParameter"
],
"Resource": [
"arn:aws:kms:$REGION:$AWS_ACCOUNT_ID:key/$ENCRYPT_KEY",
"arn:aws:ssm:$REGION:$AWS_ACCOUNT_ID:parameter/$PARAM_KEYS/*"
]
}
```

To find the relevant service role you can navigate to your Code Builder project where you can see the history of your build. At the top there is a tab called 'Build Details'. Click this then scroll down until you see a clickable link for the "Service role".

For your configuration you to will need to change `$REGION`, `$AWS_ACCOUNT_ID`, `$ENCRYPT_KEY` and $PARAM_KEYS to fit your AWS account details. To setup the required parameters there is a great write up here:

https://medium.com/rockedscience/fixing-docker-hub-rate-limiting-errors-in-ci-cd-pipelines-ea3c80017acb

## Migrating from previous versions of SAS
SAS previously hasn't had the concept of users or Authentication so this version will be a breaking change and any annotations created using previous versions of SAS will no longer be accessible because they are not associated with a user. Ensure you have backed up any annotations you would like to keep and it is advisable to use a new ElasticSearch or SOLR index to run this version of SAS.
28 changes: 28 additions & 0 deletions docker/sas-auth/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# build stage
FROM maven:3-jdk-11 AS buildstage
WORKDIR /usr/src/sas
COPY . /usr/src/sas
ARG MVN_ARGS="-DskipTests"
# build SAS using maven
RUN mvn $MVN_ARGS package

# runnable container stage
FROM tomcat:9-jre11 AS runstage
ARG AWS_DEFAULT_REGION
ARG AWS_CONTAINER_CREDENTIALS_RELATIVE_URI
ARG AUTH_JSON_LOCATION
# remove tomcat default webapps and create data directory
RUN rm -rf /usr/local/tomcat/webapps/*
# copy SAS from build image
COPY --from=buildstage /usr/src/sas/target/simpleAnnotationStore /usr/local/tomcat/webapps/ROOT
# copy properties
COPY docker/sas-auth/sas.properties /usr/local/tomcat/webapps/ROOT/WEB-INF

# Download auth config
# Install the AWS CLI
RUN apt-get update && \
apt-get -y install awscli
RUN aws --region eu-west-2 s3 cp $AUTH_JSON_LOCATION /usr/local/tomcat/webapps/ROOT/WEB-INF/
# For testing locally:
#COPY docker/sas-auth/auth.json /usr/local/tomcat/webapps/ROOT/WEB-INF/
# use default port and entrypoint
20 changes: 20 additions & 0 deletions docker/sas-auth/compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
version: '3'
services:
web:
container_name: sas
build:
context: .
dockerfile: docker/sas-auth/Dockerfile
ports:
- "8888:8080"
elastic:
image: "elasticsearch:7.8.1"
container_name: elasticsearch
environment:
- discovery.type=single-node
ulimits:
memlock:
soft: -1
hard: -1
ports:
- 9200:9200
36 changes: 36 additions & 0 deletions docker/sas-auth/sas.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Generic properties
# ==================

# Uncomment this if you are behind a proxy or want a public URI
# baseURI=http://dev.llgc.org.uk/annotation/

# Uncomment this if you would like to use an encoder which will work on
# the annotation before its stored in the triplestore
# encoder=uk.org.llgc.annotation.store.encoders.BookOfPeaceEncode

# if you are using Mirador versions greater than 2.1.4 then you need to uncomment the following
# as the annotation structure changed between versions
#encoder=uk.org.llgc.annotation.store.encoders.Mirador214

# Store configuration
# ==================

# Uncomment this if you would like to use Jena as a backend
#store=jena
#data_dir=/annotation-data

# Uncomment the following if you want to use Sesame
# store=sesame
# repo_url=http://localhost:8080/openrdf-sesame/repositories/test-anno

# Uncomment the following if you want to use SOLR cores
#store=solr
#solr_connection=http://solr:8983/solr/annotations

# Uncomment the following if you want to use SOLR collections (Cloud)
#store=solr-cloud
#solr_connection=http://solr:8983/solr,http://solr:7574/solr
#solr_collection=annotations

store=elastic
elastic_connection=http://elasticsearch:9200/annotations
4 changes: 2 additions & 2 deletions docker/sas-elastic/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ RUN mvn $MVN_ARGS package
# runnable container stage
FROM tomcat:9-jre11 AS runstage
# remove tomcat default webapps and create data directory
RUN rm -r /usr/local/tomcat/webapps/* && \
RUN rm -rf /usr/local/tomcat/webapps/* && \
mkdir /annotation-data
# copy SAS from build image
COPY --from=buildstage /usr/src/sas/target/simpleAnnotationStore /usr/local/tomcat/webapps/ROOT
# copy properties
COPY docker/sas-tomcat/sas.properties /usr/local/tomcat/webapps/ROOT/WEB-INF
COPY docker/sas-elastic/sas.properties /usr/local/tomcat/webapps/ROOT/WEB-INF

# use default port and entrypoint
File renamed without changes.
Loading
Loading