From 58aa8c0f644a6e0e29bc2084540576fb15f0127f Mon Sep 17 00:00:00 2001 From: Russ Poetker Date: Mon, 17 Jul 2023 17:04:08 -0400 Subject: [PATCH 1/9] Add ability to run deposit services --- .env | 30 +++++++- README.md | 27 ++++++- docker-compose-deposit.yml | 28 +++++++ docker-compose-dspace.yml | 141 ++++++++++++++++++++++++++++++++++++ docker-compose.yml | 19 +++++ dspace-cli.ingest.yml | 36 +++++++++ dspace-cli.yml | 43 +++++++++++ localstack/sqs_bootstrap.sh | 14 ++++ 8 files changed, 333 insertions(+), 5 deletions(-) create mode 100644 docker-compose-deposit.yml create mode 100644 docker-compose-dspace.yml create mode 100644 dspace-cli.ingest.yml create mode 100644 dspace-cli.yml create mode 100755 localstack/sqs_bootstrap.sh diff --git a/.env b/.env index ca5e78a..c731a7c 100644 --- a/.env +++ b/.env @@ -1,7 +1,15 @@ PASS_VERSION=0.8.0-SNAPSHOT ################################################### -# PASS_CORE config #################################### +# Localstack AWS props config ##################### +################################################### +AWS_ACCESS_KEY_ID=test +AWS_SECRET_ACCESS_KEY=test +AWS_REGION=us-east-1 +AWS_SQS_ENDPOINT_OVERRIDE=http://localstack:4566 + +################################################### +# PASS_CORE config ################################ ################################################### PASS_CORE_POSTGRES_PORT=5432 PASS_CORE_API_PORT=8080 @@ -26,13 +34,29 @@ PASS_CORE_JAVA_OPTS="-Djavax.persistence.schema-generation.database.action=creat PASS_CORE_BACKEND_USER=backend PASS_CORE_BACKEND_PASSWORD=backend -PASS_CORE_USE_SQS=false -PASS_CORE_EMBED_JMS_BROKER=true +PASS_CORE_USE_SQS=true +PASS_CORE_EMBED_JMS_BROKER=false + +PASS_CORE_SUBMISSION_QUEUE=submission +PASS_CORE_DEPOSIT_QUEUE=deposit +PASS_CORE_SUBMISSION_EVENT_QUEUE=submission-event PASS_CORE_POLICY_INSTITUTION=johnshopkins.edu PASS_CORE_POLICY_INSTITUTIONAL_POLICY_TITLE=Johns Hopkins University (JHU) Open Access Policy PASS_CORE_POLICY_INSTITUTIONAL_REPOSITORY_NAME=JScholarship +################################################### +# PASS_DEPOSIT_SERVICES config #################### +################################################### +PASS_DEPOSIT_REPOSITORY_CONFIGURATION:classpath:/jscholarship-repositories.json + +PASS_CLIENT_URL=http://pass-core:8080/ +PASS_CLIENT_USER=backend +PASS_CLIENT_PASSWORD=backend + +DSPACE_HOST=dspace +DSPACE_PORT=8080 + ################################################### # PASS_UI config ################################## # ## Changes here require new image build ######### diff --git a/README.md b/README.md index c665629..ba6cf49 100644 --- a/README.md +++ b/README.md @@ -2,11 +2,34 @@ The "demo" compose file describes an early system meant to demonstrate some new ## Running: -Docker compose works as normal, but for the demo you need to specify both correct `yml` file and env file. In order to run a local instance, you can run: -``` sh +Docker compose works as normal, but for the demo you need to specify both correct `yml` file and env file. + +In order to run a local instance **_without_** deposit-service and dspace, you can run: +``` docker compose up -d --no-build --quiet-pull --pull always ``` +In order to stop a local instance, you can run: +``` +docker compose -p pass-docker down -v +``` +Note the `-v` to remove the volumes, **this is critical** so on subsequent starts, user data is not duplicated. + +In order to run a local instance **_with_** deposit-service and dspace, you can run: +``` +docker compose -p pass-docker -f docker-compose.yml -f docker-compose-deposit.yml -f docker-compose-dspace.yml up -d --no-build --quiet-pull +``` + +Run the following to create a test admin user in dspace: +``` +docker-compose -p pass-docker -f dspace-cli.yml run --rm dspace-cli create-administrator -e test@test.edu -f admin -l user -p admin -c en +``` + +Run the following to load sample data into dspace: +``` +docker-compose -p pass-docker -f dspace-cli.yml -f dspace-cli.ingest.yml run --rm dspace-cli +``` + ## Services: ### [`pass-auth`](https://github.com/jaredgalanis/pass-auth) diff --git a/docker-compose-deposit.yml b/docker-compose-deposit.yml new file mode 100644 index 0000000..fced0af --- /dev/null +++ b/docker-compose-deposit.yml @@ -0,0 +1,28 @@ +# +# Copyright 2019 Johns Hopkins University +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# The docker-compose file to start PASS deposit services. +version: '3.8' + +services: + deposit-services: + image: "ghcr.io/eclipse-pass/deposit-services-core:0.8.0-SNAPSHOT" + container_name: pass-deposit-services + env_file: + - .env + networks: + - back + depends_on: + - pass-core diff --git a/docker-compose-dspace.yml b/docker-compose-dspace.yml new file mode 100644 index 0000000..40ef7f4 --- /dev/null +++ b/docker-compose-dspace.yml @@ -0,0 +1,141 @@ +# +# DSpace License +# Copyright (c) 2002-2021, LYRASIS. All rights reserved. +# Detailed available online at: http://www.dspace.org/license/ +# +# The docker-compose file to start Dspace7 with SwordV2 enabled. +# The dspace service definitions were taken from the dspace-angular project: +# https://github.com/DSpace/dspace-angular.git +# The service definitions have been slightly modified to run within the PASS docker-compose process. +version: '3.8' + +services: + # DSpace (backend) webapp container + dspace: + container_name: dspace + environment: + # Below syntax may look odd, but it is how to override dspace.cfg settings via env variables. + # See https://github.com/DSpace/DSpace/blob/main/dspace/config/config-definition.xml + # __P__ => "." (e.g. dspace__P__dir => dspace.dir) + # __D__ => "-" (e.g. google__D__metadata => google-metadata) + # dspace.dir, dspace.server.url, dspace.ui.url and dspace.name + dspace__P__dir: /dspace + dspace__P__server__P__url: http://dspace:8080/server + dspace__P__ui__P__url: http://localhost:4000 + dspace__P__name: 'DSpace Started with Docker Compose' + # db.url: Ensure we are using the 'dspacedb' image for our database + db__P__url: 'jdbc:postgresql://dspacedb:5432/dspace' + # solr.server: Ensure we are using the 'dspacesolr' image for Solr + solr__P__server: http://dspacesolr:8983/solr + # proxies.trusted.ipranges: This setting is required for a REST API running in Docker to trust requests + # from the host machine. This IP range MUST correspond to the 'dspacenet' subnet defined above. + proxies__P__trusted__P__ipranges: '172.23.0' + swordv2__D__server__P__enabled: true + swordv2__D__server__P__url: http://dspace:8080/server/swordv2 + image: "${DOCKER_OWNER:-dspace}/dspace:${DSPACE_VER:-dspace-7_x-test}" + depends_on: + - dspacedb + networks: + back: + ports: + - published: 8080 + target: 8080 + stdin_open: true + tty: true + volumes: + - assetstore:/dspace/assetstore + # Mount DSpace's solr configs to a volume, so that we can share to 'dspacesolr' container (see below) + - solr_configs:/dspace/solr + # Ensure that the database is ready BEFORE starting tomcat + # 1. While a TCP connection to dspacedb port 5432 is not available, continue to sleep + # 2. Then, run database migration to init database tables + # 3. Finally, start Tomcat + entrypoint: + - /bin/bash + - '-c' + - | + while (! /dev/null 2>&1; do sleep 1; done; + /dspace/bin/dspace database migrate + catalina.sh run + # DSpace database container + dspacedb: + container_name: dspacedb + environment: + PGDATA: /pgdata + POSTGRES_PASSWORD: dspace + image: dspace/dspace-postgres-pgcrypto + networks: + back: + ports: + - published: 5432 + target: 5432 + stdin_open: true + tty: true + volumes: + - pgdata:/pgdata + # DSpace Solr container + dspacesolr: + container_name: dspacesolr + image: "${DOCKER_OWNER:-dspace}/dspace-solr:${DSPACE_VER:-dspace-7_x}" + # Needs main 'dspace' container to start first to guarantee access to solr_configs + depends_on: + - dspace + networks: + back: + ports: + - published: 8983 + target: 8983 + stdin_open: true + tty: true + working_dir: /var/solr/data + volumes: + # Keep Solr data directory between reboots + - solr_data:/var/solr/data + # Initialize all DSpace Solr cores using the mounted local configsets (see above), then start Solr + # * First, run precreate-core to create the core (if it doesn't yet exist). If exists already, this is a no-op + # * Second, copy configsets to this core: + # Updates to Solr configs require the container to be rebuilt/restarted: + # `docker-compose -p d7 -f docker/docker-compose.yml -f docker/docker-compose-rest.yml up -d --build dspacesolr` + entrypoint: + - /bin/bash + - '-c' + - | + init-var-solr + precreate-core authority /opt/solr/server/solr/configsets/authority + cp -r /opt/solr/server/solr/configsets/authority/* authority + precreate-core oai /opt/solr/server/solr/configsets/oai + cp -r /opt/solr/server/solr/configsets/oai/* oai + precreate-core search /opt/solr/server/solr/configsets/search + cp -r /opt/solr/server/solr/configsets/search/* search + precreate-core statistics /opt/solr/server/solr/configsets/statistics + cp -r /opt/solr/server/solr/configsets/statistics/* statistics + exec solr -f + + dspace-angular: + container_name: dspace-angular + environment: + DSPACE_UI_SSL: 'false' + DSPACE_UI_HOST: dspace-angular + DSPACE_UI_PORT: '4000' + DSPACE_UI_NAMESPACE: / + DSPACE_REST_SSL: 'false' + DSPACE_REST_HOST: localhost + DSPACE_REST_PORT: 8080 + DSPACE_REST_NAMESPACE: /server + image: dspace/dspace-angular:dspace-7_x + networks: + back: + ports: + - published: 4000 + target: 4000 + - published: 9876 + target: 9876 + stdin_open: true + tty: true + +volumes: + assetstore: + pgdata: + solr_data: + # Special volume used to share Solr configs from 'dspace' to 'dspacesolr' container (see above) + solr_configs: \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 6824e79..c781cfc 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -28,6 +28,7 @@ services: - back depends_on: - postgres + - localstack healthcheck: test: "curl -u $PASS_CORE_BACKEND_USER:$PASS_CORE_BACKEND_PASSWORD -f http://pass-core:8080/data/user || exit 1" start_period: 30s @@ -131,6 +132,21 @@ services: volumes: - ./demo_data.json:/data.json + localstack: + container_name: "${LOCALSTACK_DOCKER_NAME-localstack_main}" + image: localstack/localstack + ports: + - "127.0.0.1:4566:4566" # LocalStack Gateway + - "127.0.0.1:4510-4559:4510-4559" # external services port range + environment: + - DOCKER_HOST=unix:///var/run/docker.sock + volumes: + - "${LOCALSTACK_VOLUME_DIR:-./volume}:/var/lib/localstack" + - "/var/run/docker.sock:/var/run/docker.sock" + - "./localstack/sqs_bootstrap.sh:/etc/localstack/init/ready.d/init-aws.sh" + networks: + - back + volumes: db: driver: local @@ -140,6 +156,9 @@ networks: driver: bridge back: driver: bridge + ipam: + config: + - subnet: 172.23.0.0/16 secrets: idp_backchannel: diff --git a/dspace-cli.ingest.yml b/dspace-cli.ingest.yml new file mode 100644 index 0000000..e0d029f --- /dev/null +++ b/dspace-cli.ingest.yml @@ -0,0 +1,36 @@ +# +# DSpace License +# Copyright (c) 2002-2021, LYRASIS. All rights reserved. +# Detailed available online at: http://www.dspace.org/license/ +# + +# +# This is a copy of the cli.ingest.yml that is available in the DSpace/DSpace +# (Backend) at: +# https://github.com/DSpace/DSpace/blob/main/dspace/src/main/docker-compose/cli.ingest.yml +# +# Therefore, it should be kept in sync with that file +version: "3.7" + +services: + dspace-cli: + environment: + - AIPZIP=https://github.com/DSpace-Labs/AIP-Files/raw/main/dogAndReport.zip + - ADMIN_EMAIL=test@test.edu + - AIPDIR=/tmp/aip-dir + entrypoint: + - /bin/bash + - '-c' + - | + rm -rf $${AIPDIR} + mkdir $${AIPDIR} /dspace/upload + cd $${AIPDIR} + pwd + curl $${AIPZIP} -L -s --output aip.zip + unzip aip.zip + cd $${AIPDIR} + + /dspace/bin/dspace packager -r -a -t AIP -e $${ADMIN_EMAIL} -f -u SITE*.zip + /dspace/bin/dspace database update-sequences + + /dspace/bin/dspace index-discovery diff --git a/dspace-cli.yml b/dspace-cli.yml new file mode 100644 index 0000000..4c3289a --- /dev/null +++ b/dspace-cli.yml @@ -0,0 +1,43 @@ +# +# DSpace License +# Copyright (c) 2002-2021, LYRASIS. All rights reserved. +# Detailed available online at: http://www.dspace.org/license/ +# + +# +# This is a copy of the docker-compose-cli.yml that is available in the DSpace/DSpace +# (Backend) at: +# https://github.com/DSpace/DSpace/blob/main/docker-compose-cli.yml +# +# Therefore, it should be kept in sync with that file +version: "3.7" + +services: + dspace-cli: + image: "${DOCKER_OWNER:-dspace}/dspace-cli:${DSPACE_VER:-dspace-7_x}" + container_name: dspace-cli + environment: + # Below syntax may look odd, but it is how to override dspace.cfg settings via env variables. + # See https://github.com/DSpace/DSpace/blob/main/dspace/config/config-definition.xml + # __P__ => "." (e.g. dspace__P__dir => dspace.dir) + # __D__ => "-" (e.g. google__D__metadata => google-metadata) + # dspace.dir + dspace__P__dir: /dspace + # db.url: Ensure we are using the 'dspacedb' image for our database + db__P__url: 'jdbc:postgresql://dspacedb:5432/dspace' + # solr.server: Ensure we are using the 'dspacesolr' image for Solr + solr__P__server: http://dspacesolr:8983/solr + volumes: + - "assetstore:/dspace/assetstore" + entrypoint: /dspace/bin/dspace + command: help + networks: + - back + tty: true + stdin_open: true + +volumes: + assetstore: + +networks: + back: diff --git a/localstack/sqs_bootstrap.sh b/localstack/sqs_bootstrap.sh new file mode 100755 index 0000000..029dbce --- /dev/null +++ b/localstack/sqs_bootstrap.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +echo "configuring sqs" +echo "===================" + +# https://docs.aws.amazon.com/cli/latest/reference/sqs/create-queue.html +create_queue() { + local QUEUE_NAME_TO_CREATE=$1 + awslocal sqs create-queue --queue-name ${QUEUE_NAME_TO_CREATE} --attributes VisibilityTimeout=30 +} + +create_queue "submission-event" +create_queue "submission" +create_queue "deposit" \ No newline at end of file From 27ca8ccf573d6ded47424bff70245aa66c265821 Mon Sep 17 00:00:00 2001 From: Russ Poetker Date: Mon, 17 Jul 2023 17:08:54 -0400 Subject: [PATCH 2/9] Use pass_version env var --- docker-compose-deposit.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose-deposit.yml b/docker-compose-deposit.yml index fced0af..5b9562f 100644 --- a/docker-compose-deposit.yml +++ b/docker-compose-deposit.yml @@ -18,7 +18,7 @@ version: '3.8' services: deposit-services: - image: "ghcr.io/eclipse-pass/deposit-services-core:0.8.0-SNAPSHOT" + image: "ghcr.io/eclipse-pass/deposit-services-core:${PASS_VERSION}" container_name: pass-deposit-services env_file: - .env From 9f7ce47ca0305b596af1ac0aac6a8715196d15a9 Mon Sep 17 00:00:00 2001 From: Russ Poetker Date: Mon, 17 Jul 2023 17:10:25 -0400 Subject: [PATCH 3/9] Fix typo --- docker-compose-dspace.yml | 2 +- dspace-cli.ingest.yml | 4 +--- dspace-cli.yml | 4 +--- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/docker-compose-dspace.yml b/docker-compose-dspace.yml index 40ef7f4..612b25f 100644 --- a/docker-compose-dspace.yml +++ b/docker-compose-dspace.yml @@ -1,7 +1,7 @@ # # DSpace License # Copyright (c) 2002-2021, LYRASIS. All rights reserved. -# Detailed available online at: http://www.dspace.org/license/ +# Details available online at: http://www.dspace.org/license/ # # The docker-compose file to start Dspace7 with SwordV2 enabled. # The dspace service definitions were taken from the dspace-angular project: diff --git a/dspace-cli.ingest.yml b/dspace-cli.ingest.yml index e0d029f..6f0efe7 100644 --- a/dspace-cli.ingest.yml +++ b/dspace-cli.ingest.yml @@ -1,9 +1,7 @@ # # DSpace License # Copyright (c) 2002-2021, LYRASIS. All rights reserved. -# Detailed available online at: http://www.dspace.org/license/ -# - +# Details available online at: http://www.dspace.org/license/ # # This is a copy of the cli.ingest.yml that is available in the DSpace/DSpace # (Backend) at: diff --git a/dspace-cli.yml b/dspace-cli.yml index 4c3289a..86a7767 100644 --- a/dspace-cli.yml +++ b/dspace-cli.yml @@ -1,9 +1,7 @@ # # DSpace License # Copyright (c) 2002-2021, LYRASIS. All rights reserved. -# Detailed available online at: http://www.dspace.org/license/ -# - +# Details available online at: http://www.dspace.org/license/ # # This is a copy of the docker-compose-cli.yml that is available in the DSpace/DSpace # (Backend) at: From 16c9e9ea12f41d2f0493b4be5d8997f1e71b26b1 Mon Sep 17 00:00:00 2001 From: Russ Poetker Date: Mon, 17 Jul 2023 17:25:35 -0400 Subject: [PATCH 4/9] Clean dspace license clause --- DSPACE_LICENSE | 31 +++++++++++++++++++++++++++++++ docker-compose-deposit.yml | 2 +- docker-compose-dspace.yml | 4 ++-- docker-compose.yml | 15 +++++++++++++++ dspace-cli.ingest.yml | 3 +-- dspace-cli.yml | 3 +-- 6 files changed, 51 insertions(+), 7 deletions(-) create mode 100644 DSPACE_LICENSE diff --git a/DSPACE_LICENSE b/DSPACE_LICENSE new file mode 100644 index 0000000..b381f6d --- /dev/null +++ b/DSPACE_LICENSE @@ -0,0 +1,31 @@ +BSD 3-Clause License + +Copyright (c) 2002-2021, LYRASIS. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + +- Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + +- Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. + +- Neither the name of the copyright holder nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR +TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE +USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. \ No newline at end of file diff --git a/docker-compose-deposit.yml b/docker-compose-deposit.yml index 5b9562f..4d04741 100644 --- a/docker-compose-deposit.yml +++ b/docker-compose-deposit.yml @@ -1,5 +1,5 @@ # -# Copyright 2019 Johns Hopkins University +# Copyright 2023 Johns Hopkins University # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/docker-compose-dspace.yml b/docker-compose-dspace.yml index 612b25f..91e4afc 100644 --- a/docker-compose-dspace.yml +++ b/docker-compose-dspace.yml @@ -1,12 +1,12 @@ # -# DSpace License -# Copyright (c) 2002-2021, LYRASIS. All rights reserved. +# DSpace License: DSPACE_LICENSE file in root of this project. # Details available online at: http://www.dspace.org/license/ # # The docker-compose file to start Dspace7 with SwordV2 enabled. # The dspace service definitions were taken from the dspace-angular project: # https://github.com/DSpace/dspace-angular.git # The service definitions have been slightly modified to run within the PASS docker-compose process. +# version: '3.8' services: diff --git a/docker-compose.yml b/docker-compose.yml index c781cfc..682c7de 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,3 +1,18 @@ +# +# Copyright 2023 Johns Hopkins University +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# version: '3.8' # The base docker-compose file for eclipse-pass.org deployments diff --git a/dspace-cli.ingest.yml b/dspace-cli.ingest.yml index 6f0efe7..6a4a04d 100644 --- a/dspace-cli.ingest.yml +++ b/dspace-cli.ingest.yml @@ -1,6 +1,5 @@ # -# DSpace License -# Copyright (c) 2002-2021, LYRASIS. All rights reserved. +# DSpace License: DSPACE_LICENSE file in root of this project. # Details available online at: http://www.dspace.org/license/ # # This is a copy of the cli.ingest.yml that is available in the DSpace/DSpace diff --git a/dspace-cli.yml b/dspace-cli.yml index 86a7767..8da77ca 100644 --- a/dspace-cli.yml +++ b/dspace-cli.yml @@ -1,6 +1,5 @@ # -# DSpace License -# Copyright (c) 2002-2021, LYRASIS. All rights reserved. +# DSpace License: DSPACE_LICENSE file in root of this project. # Details available online at: http://www.dspace.org/license/ # # This is a copy of the docker-compose-cli.yml that is available in the DSpace/DSpace From 2262c456dec06eb59ea7e0eca649220763eac66c Mon Sep 17 00:00:00 2001 From: Russ Poetker Date: Wed, 19 Jul 2023 10:04:24 -0400 Subject: [PATCH 5/9] Add localstack image version --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 682c7de..90d3d0f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -149,7 +149,7 @@ services: localstack: container_name: "${LOCALSTACK_DOCKER_NAME-localstack_main}" - image: localstack/localstack + image: localstack/localstack:2.1.0 ports: - "127.0.0.1:4566:4566" # LocalStack Gateway - "127.0.0.1:4510-4559:4510-4559" # external services port range From 33812951d6147f50ea17161bb949d6671242f329 Mon Sep 17 00:00:00 2001 From: Russ Poetker Date: Thu, 20 Jul 2023 17:04:08 -0400 Subject: [PATCH 6/9] Fix dspace configuration issue --- docker-compose-dspace.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/docker-compose-dspace.yml b/docker-compose-dspace.yml index 91e4afc..8fd7da9 100644 --- a/docker-compose-dspace.yml +++ b/docker-compose-dspace.yml @@ -20,7 +20,7 @@ services: # __D__ => "-" (e.g. google__D__metadata => google-metadata) # dspace.dir, dspace.server.url, dspace.ui.url and dspace.name dspace__P__dir: /dspace - dspace__P__server__P__url: http://dspace:8080/server + dspace__P__server__P__url: http://localhost:8080/server dspace__P__ui__P__url: http://localhost:4000 dspace__P__name: 'DSpace Started with Docker Compose' # db.url: Ensure we are using the 'dspacedb' image for our database @@ -32,7 +32,9 @@ services: proxies__P__trusted__P__ipranges: '172.23.0' swordv2__D__server__P__enabled: true swordv2__D__server__P__url: http://dspace:8080/server/swordv2 - image: "${DOCKER_OWNER:-dspace}/dspace:${DSPACE_VER:-dspace-7_x-test}" + swordv2__D__server__P__servicedocument__P__url: http://dspace:8080/server/swordv2/servicedocument + swordv2__D__server__P__collection__P__url: http://dspace:8080/server/swordv2/collection + image: "dspace/dspace:dspace-7.6-test" depends_on: - dspacedb networks: @@ -63,7 +65,7 @@ services: environment: PGDATA: /pgdata POSTGRES_PASSWORD: dspace - image: dspace/dspace-postgres-pgcrypto + image: dspace/dspace-postgres-pgcrypto:dspace-7.6 networks: back: ports: @@ -76,7 +78,7 @@ services: # DSpace Solr container dspacesolr: container_name: dspacesolr - image: "${DOCKER_OWNER:-dspace}/dspace-solr:${DSPACE_VER:-dspace-7_x}" + image: "dspace/dspace-solr:dspace-7.6" # Needs main 'dspace' container to start first to guarantee access to solr_configs depends_on: - dspace @@ -122,7 +124,7 @@ services: DSPACE_REST_HOST: localhost DSPACE_REST_PORT: 8080 DSPACE_REST_NAMESPACE: /server - image: dspace/dspace-angular:dspace-7_x + image: dspace/dspace-angular:dspace-7.6 networks: back: ports: From e44e824dd95bfb86ddd029e54464b0a5b136d53c Mon Sep 17 00:00:00 2001 From: Russ Poetker Date: Thu, 20 Jul 2023 17:16:29 -0400 Subject: [PATCH 7/9] Add ftp server for pmc deposits --- .env | 3 +++ docker-compose-deposit.yml | 17 +++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/.env b/.env index c731a7c..3eaa6f5 100644 --- a/.env +++ b/.env @@ -57,6 +57,9 @@ PASS_CLIENT_PASSWORD=backend DSPACE_HOST=dspace DSPACE_PORT=8080 +FTP_HOST=pmc-ftp-server +FTP_PORT=21 + ################################################### # PASS_UI config ################################## # ## Changes here require new image build ######### diff --git a/docker-compose-deposit.yml b/docker-compose-deposit.yml index 4d04741..b7c14a6 100644 --- a/docker-compose-deposit.yml +++ b/docker-compose-deposit.yml @@ -26,3 +26,20 @@ services: - back depends_on: - pass-core + + pmc-ftp-server: + container_name: pmc-ftp-server + environment: + - FTP_USER=nihmsftpuser + - FTP_PASS=nihmsftppass + image: fauria/vsftpd + ports: + - '20-21:20-21/tcp' + - '40000-40009:40000-40009/tcp' + networks: + - back + volumes: + - ftpdata:/home/user + +volumes: + ftpdata: From 42bd332e3856a5e56ff86ea7fe794ca24bb5eca1 Mon Sep 17 00:00:00 2001 From: Russ Poetker Date: Thu, 20 Jul 2023 17:32:13 -0400 Subject: [PATCH 8/9] Add deposit repositories config --- .env | 2 +- deposit/deposit-repositories.json | 85 +++++++++++++++++++++++++++++++ docker-compose-deposit.yml | 2 + 3 files changed, 88 insertions(+), 1 deletion(-) create mode 100644 deposit/deposit-repositories.json diff --git a/.env b/.env index 3eaa6f5..f15af64 100644 --- a/.env +++ b/.env @@ -48,7 +48,7 @@ PASS_CORE_POLICY_INSTITUTIONAL_REPOSITORY_NAME=JScholarship ################################################### # PASS_DEPOSIT_SERVICES config #################### ################################################### -PASS_DEPOSIT_REPOSITORY_CONFIGURATION:classpath:/jscholarship-repositories.json +PASS_DEPOSIT_REPOSITORY_CONFIGURATION:file:////deposit/deposit-repositories.json PASS_CLIENT_URL=http://pass-core:8080/ PASS_CLIENT_USER=backend diff --git a/deposit/deposit-repositories.json b/deposit/deposit-repositories.json new file mode 100644 index 0000000..727e377 --- /dev/null +++ b/deposit/deposit-repositories.json @@ -0,0 +1,85 @@ +{ + "JScholarship": { + "deposit-config": { + "processing": { + "beanName": "org.eclipse.pass.deposit.messaging.status.DefaultDepositStatusProcessor" + }, + "mapping": { + "http://dspace.org/state/archived": "accepted", + "http://dspace.org/state/withdrawn": "rejected", + "default-mapping": "submitted" + } + }, + "assembler": { + "specification": "http://purl.org/net/sword/package/METSDSpaceSIP", + "beanName": "dspaceMetsAssembler", + "options": { + "archive": "ZIP", + "compression": "NONE", + "algorithms": [ + "sha512", + "md5" + ] + } + }, + "transport-config": { + "auth-realms": [ + { + "mech": "basic", + "username": "test@test.edu", + "password": "admin", + "url": "http://${dspace.host}:${dspace.port}/server/swordv2" + } + ], + "protocol-binding": { + "protocol": "SWORDv2", + "username": "test@test.edu", + "password": "admin", + "server-fqdn": "${dspace.host}", + "server-port": "${dspace.port}", + "service-doc": "http://${dspace.host}:${dspace.port}/server/swordv2/servicedocument", + "default-collection": "http://${dspace.host}:${dspace.port}/server/swordv2/collection/123456789/20", + "on-behalf-of": null, + "deposit-receipt": true, + "user-agent": "pass-deposit/x.y.z" + } + } + }, + "pmc": { + "deposit-config": { + "processing": { + }, + "mapping": { + "INFO": "accepted", + "ERROR": "rejected", + "WARN": "rejected", + "default-mapping": "submitted" + } + }, + "assembler": { + "specification": "nihms-native-2017-07", + "beanName": "nihmsAssembler", + "options": { + "archive": "ZIP", + "compression": "NONE", + "algorithms": [ + "sha512", + "md5" + ] + } + }, + "transport-config": { + "protocol-binding": { + "protocol": "ftp", + "username": "nihmsftpuser", + "password": "nihmsftppass", + "server-fqdn": "${ftp.host}", + "server-port": "${ftp.port}", + "data-type": "binary", + "transfer-mode": "stream", + "use-pasv": true, + "default-directory": "/logs/upload/test/%s" + } + } + } +} \ No newline at end of file diff --git a/docker-compose-deposit.yml b/docker-compose-deposit.yml index b7c14a6..51e617a 100644 --- a/docker-compose-deposit.yml +++ b/docker-compose-deposit.yml @@ -26,6 +26,8 @@ services: - back depends_on: - pass-core + volumes: + - ./deposit/deposit-repositories.json:/deposit/deposit-repositories.json pmc-ftp-server: container_name: pmc-ftp-server From 397d56bd6f1b2712dd8a36e7f8f061f54a0a4f03 Mon Sep 17 00:00:00 2001 From: Russ Poetker Date: Fri, 21 Jul 2023 08:51:41 -0400 Subject: [PATCH 9/9] Update README --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index ba6cf49..f30b36c 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ The "demo" compose file describes an early system meant to demonstrate some new Docker compose works as normal, but for the demo you need to specify both correct `yml` file and env file. -In order to run a local instance **_without_** deposit-service and dspace, you can run: +In order to run a local instance **_without_** deposit-service, ftp, and dspace, you can run: ``` docker compose up -d --no-build --quiet-pull --pull always ``` @@ -15,19 +15,19 @@ docker compose -p pass-docker down -v ``` Note the `-v` to remove the volumes, **this is critical** so on subsequent starts, user data is not duplicated. -In order to run a local instance **_with_** deposit-service and dspace, you can run: +In order to run a local instance **_with_** deposit-service, ftp, dspace, you can run: ``` docker compose -p pass-docker -f docker-compose.yml -f docker-compose-deposit.yml -f docker-compose-dspace.yml up -d --no-build --quiet-pull ``` Run the following to create a test admin user in dspace: ``` -docker-compose -p pass-docker -f dspace-cli.yml run --rm dspace-cli create-administrator -e test@test.edu -f admin -l user -p admin -c en +docker compose -p pass-docker -f dspace-cli.yml run --rm dspace-cli create-administrator -e test@test.edu -f admin -l user -p admin -c en ``` Run the following to load sample data into dspace: ``` -docker-compose -p pass-docker -f dspace-cli.yml -f dspace-cli.ingest.yml run --rm dspace-cli +docker compose -p pass-docker -f dspace-cli.yml -f dspace-cli.ingest.yml run --rm dspace-cli ``` ## Services: