-
Notifications
You must be signed in to change notification settings - Fork 10
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
Mongodb DAO Update #112
Merged
minottic
merged 27 commits into
SciCatProject:master
from
PatrickFuhrmann-HTWBerlin:mongodb-update
Jul 25, 2024
Merged
Mongodb DAO Update #112
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
6b8b89b
Updating all versions to the highest possible w/o conflicts.
patrickfuhrmann c0d6c09
Replacing the 'del' package by the 'rimraf' package to avoid
patrickfuhrmann 4b786dc
Updating the production/.env with some reasonable values.
patrickfuhrmann daa02c4
Updating the dao driver code to comply with mongdb >= 6.
patrickfuhrmann ee96447
Using the 'date' substructure of releaseDate. Error otherwise.
patrickfuhrmann 924ccdd
TS now requires to use 'const pino ..' instead of 'import pino ..'
patrickfuhrmann c8e8e19
Adding an upgrade of npm to [email protected].
patrickfuhrmann f1835ee
Adding a description of the required variables. Can to to README.md
patrickfuhrmann 3ba061a
Formatting fixed.
patrickfuhrmann 4485e2e
a) mongo 'Filter' type replacing 'any' b) Formatting improved
patrickfuhrmann 9819f17
Mongodb already returns Promises, which we forward to the calling fun…
patrickfuhrmann ea1c815
This is to get the test running again.
patrickfuhrmann 4e088c6
Run the TEST
patrickfuhrmann 2aac59c
Deployment taken from BE
patrickfuhrmann 658b721
Describing necessary ENV variables
patrickfuhrmann 8e50d62
Was moved to README.md
patrickfuhrmann 6ddedbf
Adding the real update time
patrickfuhrmann ee664d0
Fixing format with XML namespace url
patrickfuhrmann 0dc0853
Applying workflow to master instead of the development branch.
patrickfuhrmann daab992
Formal Fix: Merging MongoClient, Filter import from mongodb.
patrickfuhrmann 95b512b
Changed default LOG_LEVEL to 'error' in .env and README.md
patrickfuhrmann 738df60
Putting { id:1 } projection back to identifiersQuery.
patrickfuhrmann c16411c
Switching back to the node:18-slim version as apline seems to produce…
patrickfuhrmann 0c81791
Making the mongoFilter more typesafe with Filter<StatusFilter>), avoi…
patrickfuhrmann eac0a72
Only pushing output image to ghcr if we push code to master
patrickfuhrmann 372bfc7
Changing trigger back to master
patrickfuhrmann 077150a
Pushing to the GitHub Container Registry only on 'push' not on 'pr'
patrickfuhrmann File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: Deploy | ||
|
||
on: | ||
push: | ||
branches: [ "master" ] | ||
pull_request: | ||
branches: [ "master" ] | ||
|
||
|
||
jobs: | ||
deploy: | ||
name: Build and deploy | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Login to GHCR | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Create image tags | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ghcr.io/${{ github.repository }} | ||
flavor: latest=true # adds :latest tag to outputs.tags | ||
tags: type=sha,format=long,prefix= # adds :<sha> tag to outputs.tags | ||
|
||
- name: Build and push | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: . | ||
platforms: linux/amd64,linux/arm64/v8 | ||
push: ${{github.event_name == 'push' }} | ||
tags: ${{ steps.meta.outputs.tags }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"require": "tsx", | ||
"extension": ["ts"], | ||
"spec": [ "src/server/env.ts" , "test/**/*.ts"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
FROM node:18-alpine | ||
FROM node:18-slim | ||
|
||
minottic marked this conversation as resolved.
Show resolved
Hide resolved
|
||
WORKDIR /home/node/app | ||
|
||
COPY package*.json /home/node/app/ | ||
COPY . /home/node/app/ | ||
|
||
RUN npm install -g [email protected] | ||
|
||
minottic marked this conversation as resolved.
Show resolved
Hide resolved
|
||
RUN npm ci | ||
RUN npm run compile | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,9 +14,10 @@ The National Library of Finland. | |
|
||
## Dependenices | ||
|
||
* Node 8.9.4+ | ||
* Typescript 2.7.2+ | ||
* npm 5.6.0+ | ||
* Node v18.20.38+ | ||
* Typescript 5.5.3+ | ||
* npm 10.8.1+ | ||
* tsx v4.16.2 (for mocha tests only) | ||
|
||
## Capabilities | ||
|
||
|
@@ -56,6 +57,69 @@ Add new records to your mongodb instance by HTTP PUT using the following route: | |
* `http://localhost:3000/scicat/Publication` | ||
|
||
|
||
## ENVIRONMENT Variables | ||
|
||
*System variables** | ||
Key | Description | Default | ||
--------:|-------------| -------- | ||
DAPP_ID | No Idea | oai-pmh-service | ||
CONNECTOR | (don't change) | mongodb | ||
ADMIN_USER_EMAIL | E-Mail address of the admin user | none | ||
LOG_LEVEL | default/error/warning | error | ||
|
||
**Mongo DB variables** | ||
Key | Description | Default | ||
--------:|-------------| -------- | ||
CONNECTOR | (don't change) | mongodb | ||
DB_HOST | Database Hostname | none | ||
DB_PORT | Database Port | none | ||
DB_USER | Database Username | none | ||
DB_PASS | Database Password | none | ||
DB_URL | [<user>:<password>@]<host>:<port>/<dbName>| none | ||
DATABASE | Publication Database | dacat-next | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe change to new scicat namings in a follow-up There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok will do later. |
||
COLLECTION | Collection to storage Publation Documents| PublishedData | ||
COLLECTION_ID | Unique Identifier of records | 'doi' | ||
BASE_URL | Prefix to link back to this server | http://localhost | ||
|
||
**Note**: When DB_URL is specified, DB_HOST/DB_PORT/DB_USER/DB_PASS and DATABASE are ignored. | ||
|
||
**OAI_PMH Listen Port** | ||
|
||
Key | Description | Default | ||
--------:|-------------| -------- | ||
HOST_CONFIGURATION | web server configuration | production/host_config.json | ||
|
||
The content of the *host_config.json* file are the json encoded variables to steer the web server itself. | ||
As far as I can see, the 'host' variable is ignored in the code, but the 'port' variable is honored. | ||
|
||
**Example** for a *host_config.json* file. | ||
``` | ||
{ | ||
"host": "localhost", | ||
"port": 3000 | ||
} | ||
``` | ||
|
||
### Docker start example | ||
Docker start example, assuming there is a network called | ||
'scicatlive_default'. | ||
``` | ||
docker run \ | ||
--network=scicatlive_default \ | ||
-e CONNECTOR=mongodb \ | ||
-e DB_HOST=mongodb \ | ||
-e DB_PORT=27017 \ | ||
-e DB_USER="" \ | ||
-e DB_PASSWORD="" \ | ||
-e DATABASE=dacat-next \ | ||
-e COLLECTION=PublishedData \ | ||
-e COLLECTION_ID="_id" \ | ||
-e HOST_CONFIG=server/host_config.json \ | ||
-p 7002:3001 \ | ||
--name=oai-pmh-provider \ | ||
oai-pmh-provider | ||
``` | ||
|
||
## Run in *production* mode: | ||
|
||
At the simplest level: | ||
|
minottic marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe this ca be on PR only?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. I wanted to make sure that the test/deploy works on your side.