Skip to content

Commit

Permalink
Add DSpace submit functionality
Browse files Browse the repository at this point in the history
Why these changes are being introduced:
The core functionality of this app is to create new items with associated bitstreams in DSpace based on the messages retrieved from an input SQS queue. This commit adds the functionality to do so, along with some necessary functionality around configuration and secrets handling.

How this addresses that need:
* Adds a submission module with a Submission class that can be
  instantiated from an SQS message, with methods to facilitate creating
  a DSpace item with bitstreams and generating both success and error
  result messages
* Updates the sqs module process function to use the new submission
  module
* Adds an smm module with an SSM class that handles retrieving secrets
  from AWS Systems Manager Parameter Store
* Adds a config module that configures the application based on env
  (set by the WORKSPACE env variable)
* Adds and updates relevant tests, including adding a conftest.py and
  fixtures
* Updates Dockerfile and setup.py to reflect new dependencies

Additional changes in this commit:
* Adds logging throughout the app with logging configuration set by the
  root logger
* Adds pytest-cov and updates make test command to create a coverage
  report
* Updates .gitignore

Side effects of this change:
* For the app to work in staging and production environments, the
  WORKSPACE and SSM_PATH env variables must be set and the application
  must have an IAM role with access to SSM. This has been handled in a
  separate ticket, just noting it here (also added this info to the
  README).

Relevant ticket(s):
* https://mitlibraries.atlassian.net/browse/ETD-398
* https://mitlibraries.atlassian.net/browse/ETD-407
  • Loading branch information
hakbailey committed Sep 15, 2021
1 parent e2ee194 commit 1ee21b5
Show file tree
Hide file tree
Showing 20 changed files with 759 additions and 133 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,5 @@ dmypy.json

# Pyre type checker
.pyre/

.DS_Store
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ ENV PIP_NO_CACHE_DIR yes
WORKDIR /app
RUN pip install --no-cache-dir --upgrade pip pipenv

RUN apt-get update && apt-get upgrade -y && apt-get install -y git

COPY Pipfile* /
RUN pipenv install --system --clear --deploy

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ isort: ## isort your imports, so you don't have to
pipenv run isort . --diff

test: ## runs pytest
pipenv run pytest
pipenv run pytest --cov=submitter

coveralls: test
pipenv run coveralls
5 changes: 5 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ name = "pypi"
[packages]
click = "*"
boto3 = "*"
smart-open = "*"
dspace-python-client = {ref = "0.1.0", git = "https://github.com/mitlibraries/dspace-python-client.git"}

[dev-packages]
flake8 = "*"
Expand All @@ -15,6 +17,9 @@ bandit = "*"
moto = {extras = ["s3", "sqs"], version = "*"}
pytest = "*"
coveralls = "*"
requests-mock = "*"
pytest-cov = "*"
pytest-env = "*"

[requires]
python_version = "3.9"
Expand Down
100 changes: 73 additions & 27 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ make dist
docker run submitter:latest --
```

note: the application requires being run in an environment with Roles based access to the AWS resources.
note: the application requires being run in an environment with Roles based access to the AWS resources. in addition, the environment must have WORKSPACE and SSM_PATH variables set according to stage and prod conventions.
Loading

0 comments on commit 1ee21b5

Please sign in to comment.