Skip to content

Commit

Permalink
Merge branch 'master' into proposalGroup-update-permission
Browse files Browse the repository at this point in the history
  • Loading branch information
fpotier authored Apr 8, 2024
2 parents 7df1ca7 + d81cbf0 commit 8ab6024
Show file tree
Hide file tree
Showing 67 changed files with 883 additions and 905 deletions.
45 changes: 43 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,48 @@ SMTP_HOST=<SMTP_HOST>
SMTP_MESSAGE_FROM=<SMTP_MESSAGE_FROM>
SMTP_PORT=<SMTP_PORT>
SMTP_SECURE=<SMTP_SECURE>

DATASET_CREATION_VALIDATION_ENABLED=true
DATASET_CREATION_VALIDATION_REGEX="^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$"

ADMIN_GROUPS=""
DELETE_GROUPS=""
CREATE_DATASET_GROUPS="all"
CREATE_DATASET_WITH_PID_GROUPS=""
DATASET_CREATION_VALIDATION_ENABLED=true
DATASET_CREATION_VALIDATION_REGEX="^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$"
CREATE_DATASET_PRIVILEGED_GROUPS=""
CREATE_JOB_GROUPS=""
UPDATE_JOB_GROUPS=""
SAMPLE_PRIVILEGED_GROUPS="sampleingestor"
SAMPLE_GROUPS="group1"
PROPOSAL_GROUPS=""

ACCESS_GROUPS_GRAPHQL_ENABLED=true
ACCESS_GROUP_SERVICE_TOKEN=""
ACCESS_GROUP_SERVICE_API_URL=""
ACCESS_GROUP_SERVICE_HANDLER=""
ACCESS_GROUPS_STATIC_ENABLED=true
ACCESS_GROUPS_OIDCPAYLOAD_ENABLED=true

OIDC_USERINFO_MAPPING_FIELD_USERNAME="iss, sub"
OIDC_USERINFO_MAPPING_FIELD_DISPLAYNAME="preferred_username"
OIDC_USERINFO_MAPPING_FIELD_EMAIL="email"
OIDC_USERINFO_MAPPING_FIELD_GROUP="groups"
OIDC_USERQUERY_OPERATOR=<"or"|"and">
OIDC_USERQUERY_FILTER="username:username, email:email"

ELASTICSEARCH_ENABLED=<"yes"|"no">
APP_PORT=3003
STACK_VERSION="8.8.2"
CLUSTER_NAME="es-cluster"
MEM_LIMIT="4G"
MONGODB_COLLECTION="Dataset"
ES_MAX_RESULT=100000
ES_FIELDS_LIMIT=400000
ES_INDEX="dataset"
ES_PORT=9200
ES_HOST="https://localhost:9200"
ES_USERNAME="elastic"
ES_PASSWORD="duo-password"
ES_REFRESH=<"wait_for"|"false">

LOGGERS_CONFIG_FILE="loggers.json"
2 changes: 1 addition & 1 deletion .github/workflows/auto-merge-dependabot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
## Extract information about the dependencies being updated by a Dependabot-generated PR
- name: Dependabot metadata
id: dependabot-metadata
uses: dependabot/fetch-metadata@v1.6.0
uses: dependabot/fetch-metadata@v2.0.0
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"

Expand Down
4 changes: 2 additions & 2 deletions CI/E2E/config.e2e.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"editDatasetSampleEnabled": true,
"editMetadataEnabled": true,
"editPublishedData": false,
"editSampleEnabled": true,
"addSampleEnabled": true,
"externalAuthEndpoint": "/api/v3/auth/msad",
"facility": "ESS",
"loginFacilityLabel": "ESS",
Expand Down Expand Up @@ -119,4 +119,4 @@
"shoppingCartEnabled": true,
"shoppingCartOnHeader": true,
"tableSciDataEnabled": true
}
}
4 changes: 2 additions & 2 deletions CI/E2E/frontend.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"editDatasetSampleEnabled": true,
"editMetadataEnabled": true,
"editPublishedData": false,
"editSampleEnabled": true,
"addSampleEnabled": true,
"externalAuthEndpoint": "/api/v3/auth/msad",
"facility": "ESS",
"loginFacilityLabel": "ESS",
Expand Down Expand Up @@ -36,7 +36,7 @@
"order": 1,
"type": "standard",
"enabled": true
},
},
{
"name": "datasetName",
"order": 2,
Expand Down
6 changes: 2 additions & 4 deletions CI/MLZ/frontend.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
],
"externalAuthEndpoint": "/auth/ldap",
"editMetadataEnabled": true,
"editSampleEnabled": true,
"addSampleEnabled": true,
"editPublishedData": true,
"scienceSearchEnabled": true,
"facility": "MLZ",
Expand Down Expand Up @@ -118,7 +118,5 @@
"scienceSearchUnitsEnabled": false,
"metadataStructure": "",
"loginFormEnabled": true,
"oAuth2Endpoints": [
{"displayText": "MLZ", "authURL":"api/v3/auth/oidc"}
]
"oAuth2Endpoints": [{ "displayText": "MLZ", "authURL": "api/v3/auth/oidc" }]
}
43 changes: 22 additions & 21 deletions CI/MLZ/frontend.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ export default {
retrieveDestinations: [
{
option: "MLZ",
location: "/home/out"
location: "/home/out",
},
{
option: "MLZ S3 (Testphase)"
}
option: "MLZ S3 (Testphase)",
},
],
accessTokenPrefix: "Bearer ",
lbTokenPrefix: "Bearer ",
externalAuthEndpoint: "",
editMetadataEnabled: true,
editSampleEnabled: true,
addSampleEnabled: true,
editPublishedData: true,
scienceSearchEnabled: true,
facility: "MLZ",
Expand All @@ -33,74 +33,74 @@ export default {
name: "select",
order: 0,
type: "standard",
enabled: true
enabled: true,
},
{
name: "datasetName",
order: 1,
type: "standard",
enabled: true
enabled: true,
},
{
name: "runNumber",
order: 2,
type: "standard",
enabled: true
enabled: true,
},
{
name: "sourceFolder",
order: 3,
type: "standard",
enabled: true
enabled: true,
},
{
name: "size",
order: 4,
type: "standard",
enabled: true
enabled: true,
},
{
name: "creationTime",
order: 5,
type: "standard",
enabled: true
enabled: true,
},
{
name: "type",
order: 6,
type: "standard",
enabled: true
enabled: true,
},
{
name: "image",
order: 7,
type: "standard",
enabled: true
enabled: true,
},
{
name: "metadata",
order: 8,
type: "standard",
enabled: true
enabled: true,
},
{
name: "proposalId",
order: 9,
type: "standard",
enabled: true
enabled: true,
},
{
name: "ownerGroup",
order: 10,
type: "standard",
enabled: true
enabled: true,
},
{
name: "dataStatus",
order: 11,
type: "standard",
enabled: true
}
enabled: true,
},
],
logbookEnabled: true,
metadataPreviewEnabled: true,
Expand All @@ -121,8 +121,9 @@ export default {
metadataStructure: "",
loginFormEnabled: true,
oAuth2Endpoints: [
{
displayText: "MLZ",
authURL: "api/v3/auth/oidc"}
]
{
displayText: "MLZ",
authURL: "api/v3/auth/oidc",
},
],
};
24 changes: 17 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,21 @@ or the SciCat team at ESS.
2. `npm install`
3. Add _.env_ file to project root folder. See [Environment variables](#environment-variables).
4. _Optional_ Add [functionalAccounts.json](#local-user-accounts) file to project root folder to create local users.
5. `npm run start:dev`
6. Go to http://localhost:3000/explorer to get an overview of available endpoints and database schemas.
7. To be able to run the e2e tests with the same setup as in the Github actions you will need to run `npm run prepare:local` and after that run `npm run start:dev`. This will start all needed containers and copy some configuration to the right place.
5. _Optional_ Add [loggers.json](#loggers-configuration) file to the root folder and configure multiple loggers.
6. `npm run start:dev`
7. Go to http://localhost:3000/explorer to get an overview of available endpoints and database schemas.
8. To be able to run the e2e tests with the same setup as in the Github actions you will need to run `npm run prepare:local` and after that run `npm run start:dev`. This will start all needed containers and copy some configuration to the right place.

## Develop in a container using the docker-compose.dev file

1. `git clone https://github.com/SciCatProject/scicat-backend-next.git`
2. docker-compose -f docker-compose.dev.yaml up -d
3. _Optional_ Mount [functionalAccounts.json](#local-user-accounts) file to a volume in the container to create local users.
4. _Optional_ change the container env variables
5. Attach to the container
6. `npm run start:dev`
7. Go to http://localhost:3000/explorer to get an overview of available endpoints and database schemas.
4. _Optional_ Mount [loggers.json](#loggers-configuration) file to a volume in the container to configure multiple loggers.
5. _Optional_ change the container env variables
6. Attach to the container
7. `npm run start:dev`
8. Go to http://localhost:3000/explorer to get an overview of available endpoints and database schemas.

## Test the app

Expand Down Expand Up @@ -77,6 +79,12 @@ automatically create the specified accounts on startup. If this file is not prov
Follow the structure of [functionalAccounts.json.minimal.example](/functionalAccounts.json.minimal.example) to create
your own _functionalAccounts.json_ file.

### Loggers configuration

Providing a file called _loggers.json_ at the root of the project, locally or in the container, and create an external logger class in the `src/loggers/loggingProviders/`directory will automatically create specified one or multiple loggers instances.

The `loggers.json.example` file in the root directory showcases the example of configuration structure for the one or multiple loggers. `logger.service.ts` file contains the configuration handling process logic, and `src/loggers/loggingProviders/grayLogger.ts` includes actual usecase of grayLogger.

## Environment variables

Valid environment variables for the .env file. See [.env.example](/.env.example) for examples value formats.
Expand Down Expand Up @@ -161,6 +169,8 @@ Valid environment variables for the .env file. See [.env.example](/.env.example)
- `ES_FIELDS_LIMIT` [number] The total number of fields in an index. Default value: 1000
- `ES_REFRESH` [string] If set to `wait_for` Elasticsearch will wait till data is insereted to specificied index then return response. Unless you have a good reason to wait for the change to become visible, always use `false` (the default setting).

- `LOGGERS_CONFIG_FILE` [string] The file name for loggers configuration which needs to be located in the project root directory. Default value: "loggers.json"

## Migrating from the old SciCat Backend

Where the [current SciCat Backend](https://github.com/SciCatProject/backend) accepts id fields in the database named `pid`, `doi`, or similar, this implementation requires there to be an id field of the form `_id` on every document. It is therefore necessary to run a database migration script towards MongoDB instance from a place where you have access to it and can install `migrate-mongo` package.
Expand Down
Loading

0 comments on commit 8ab6024

Please sign in to comment.