Skip to content

Commit

Permalink
Merge pull request #19 from ConsumerDataStandardsAustralia/bau/1.31.0
Browse files Browse the repository at this point in the history
Bau/1.31.0
  • Loading branch information
tom-schier authored Aug 20, 2024
2 parents 19a686d + a26f156 commit 4e78675
Show file tree
Hide file tree
Showing 21 changed files with 834,395 additions and 3,215 deletions.
8 changes: 5 additions & 3 deletions .env
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
COMPOSE_PROJECT_NAME="dsb"
CUSTOMER_COLLECTION_NAME="Customers"
PLAN_COLLECTION_NAME="Plans"
SINGLE_COLLECTION_NAME="all-data-1.29.1"
SINGLE_COLLECTION_NAME="all-data-1.31.0"
DATA_IS_SINGLE_DOCUMENT="true"
SINGLE_DATA_DOCUMENT="all-data-1.29.1"
SINGLE_DATA_DOCUMENT="all-data-1.31.0"
MONGO_HOSTNAME="localhost"
MONGO_PORT="27017"
MONGO_DB="DSB"
VERSION="1.29.1"
VERSION="1.31.0"
APP_LISTENTING_PORT="3005"
AUTH_SERVER_URL="https://localhost:8001" 
IDPERMANENCEKEY="90733A75F19347118B3BE0030AB590A8"
Expand All @@ -16,3 +16,5 @@ CORS_ALLOWED_ORIGINS="https://localhost:8081,https://localhost:8082,https://tls-
CERT_FILE="mock-data-holder.pem"
CERT_KEY_FILE="mock-data-holder.key"
CA_FILE="ca.crt"
LOGIN_ID="Doe.John"
NO_AUTH_SERVER="true"
9 changes: 4 additions & 5 deletions .env.defaults
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
COMPOSE_PROJECT_NAME="dsb"
CUSTOMER_COLLECTION_NAME="Customers"
PLAN_COLLECTION_NAME="Plans"
SINGLE_COLLECTION_NAME="all-data-1.29.1"
SINGLE_COLLECTION_NAME="all-data-1.31.0"
DATA_IS_SINGLE_DOCUMENT="true"
SINGLE_DATA_DOCUMENT="all-data-1.29.1"
SINGLE_DATA_DOCUMENT="all-data-1.31.0"
MONGO_HOSTNAME="localhost"
MONGO_PORT="27017"
MONGO_DB="DSB"
VERSION="1.29.1"
VERSION="1.31.0"
APP_LISTENTING_PORT="3005"
AUTH_SERVER_URL="https://localhost:8001" 
IDPERMANENCEKEY="90733A75F19347118B3BE0030AB590A8"
INTERNAL_INTROSPECTION="https://localhost:8001/connect/introspect-internal"
CORS_ALLOWED_ORIGINS="https://localhost:8081,https://localhost:8082,https://tls-gateway:8081,https://localhost:8082,https://mtls-gateway:8082,https://localhost:3004,https://localhost:9001,https://localhost:3000,http://localhost:3000,https://mock-data-recipient:9001,https://authserver-ui:3000,http://authserver-ui:3000"
CERT_FILE="mock-data-holder.pem"
CERT_KEY_FILE="mock-data-holder.key"
CA_FILE="ca.crt"
HOLDER_TO_BE_PROCESSES="458975289"
CA_FILE="ca.crt"
6 changes: 3 additions & 3 deletions .env.docker
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
COMPOSE_PROJECT_NAME="dsb"
CUSTOMER_COLLECTION_NAME="Customers"
PLAN_COLLECTION_NAME="Plans"
SINGLE_COLLECTION_NAME="all-data-1.29.1"
SINGLE_COLLECTION_NAME="all-data-1.31.0"
DATA_IS_SINGLE_DOCUMENT="true"
SINGLE_DATA_DOCUMENT="all-data-1.29.1"
SINGLE_DATA_DOCUMENT="all-data-1.31.0"
MONGO_HOSTNAME="mongodb"
MONGO_PORT="27017"
MONGO_DB="DSB"
VERSION="1.29.1"
VERSION="1.31.0"
APP_LISTENTING_PORT="3005"
AUTH_SERVER_URL="https://cdr-auth-server:8001"
IDPERMANENCEKEY="90733A75F19347118B3BE0030AB590A8"
Expand Down
22 changes: 22 additions & 0 deletions .env.noauth
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
COMPOSE_PROJECT_NAME="dsb"
CUSTOMER_COLLECTION_NAME="Customers"
PLAN_COLLECTION_NAME="Plans"
SINGLE_COLLECTION_NAME="all-data-1.31.0"
DATA_IS_SINGLE_DOCUMENT="true"
SINGLE_DATA_DOCUMENT="all-data-1.31.0"
MONGO_HOSTNAME="mongodb"
MONGO_PORT="27017"
MONGO_DB="DSB"
VERSION="1.31.0"
APP_LISTENTING_PORT="3005"
AUTH_SERVER_URL="https://cdr-auth-server:8001"
IDPERMANENCEKEY="90733A75F19347118B3BE0030AB590A8"
INTERNAL_INTROSPECTION="https://cdr-auth-server:8081/connect/introspect-internal"
CORS_ALLOWED_ORIGINS="https://localhost:8081,https://localhost:8082,https://tls-gateway:8081,https://localhost:8082,https://mtls-gateway:8082,https://localhost:3004,https://localhost:9001,https://localhost:3000,http://localhost:3000,https://mock-data-recipient:9001,https://authserver-ui:3000,http://authserver-ui:3000"
CERT_FILE="mock-data-holder.pem"
CERT_KEY_FILE="mock-data-holder.key"
CA_FILE="ca.crt"
LOGIN_ID="Doe.John"
NO_AUTH_SERVER="true"


19 changes: 18 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,31 @@ This solution:
4. Navigate to the root directory of the repository and the run the following command to start the services defined in the Docker Compose file:

```bash
docker-compose up
docker-compose -f docker-compose.yaml up -d
```

This command will automatically pull the necessary Docker images and create the containers required for the Mock Data Holder, setting up everything you need to get started without manually handling the code repository.

4. Open your web browser and navigate to the desired API endpoints using [https://localhost:8082](https://localhost:8082/) as the base URL for the Mock Data Holder (NodeJS) application. For example, you can obtain a list of energy plans from [https://localhost:8082/cds-au/v1/energy/plans](https://localhost:8082/cds-au/v1/energy/plans).
5. To obtain a new access token required to call the resource APIs, navigate to [https://localhost:9001](https://localhost:9001/) to initiate the PAR login sequence. This access token can then be used for API access, for instance, with the DSB Postman collection.

## Quick Start with Docker Compose - Running without authorisation

This is an alternative and simplified run mode.
In this mode the mock-data-holder simply serves the API. No valid token is required, the assumed user is set in the environment file, and all accounts for that user are assumed to have been given consent.

If an access token is found the request header and a `scopes` property (space delimted string) is found, then these scopes will be used. If no token is found, then all scopes are assumed to be valid.

To run in this mode

1. Download the Docker Compose file (noauth) from this [link](https://github.com/ConsumerDataStandardsAustralia/mock-data-holder-nodejs/blob/master/docker-compose.noauth.yaml).
2. Download the Docker environment (noauth) file from this [link](https://github.com/ConsumerDataStandardsAustralia/mock-data-holder-nodejs/blob/master/.env.noauth) into the same folder.

```bash
docker-compose -f docker-compose.noauth.yaml up -d
```
*Note the additional setting `NO_AUTH_SERVER="true"` in the .env.noauth file*

## Local Setup and Customisation

### Prerequisites
Expand Down
41 changes: 41 additions & 0 deletions docker-compose.noauth.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
version: '3.8'
name: dsb-data
services:
mock-data-holder:
container_name: mock-data-holder
image: consumerdatastandardsaustralia/nodejs-data-holder:0.2
# build:
# context: .
# dockerfile: dockerfile.dsb-test-data-server
restart: unless-stopped
env_file: .env.noauth
extra_hosts:
- "mongodb:host-gateway"
ports:
- "3005:3005"
depends_on:
- mongodb

mongodb:
image: mongo:6.0
container_name: mongodb
restart: unless-stopped
env_file: .env.docker
volumes:
- dbdata:/usr/local/var/mongodb
ports:
- "27017:27017"

dsb-data-loader:
# build:
# context: .
# dockerfile: dockerfile.dsb-data-loader
container_name: dsb-data-loader
image: consumerdatastandardsaustralia/dsb-data-loader:0.2
env_file: .env.docker
depends_on:
- mongodb

volumes:
dbdata:
node_modules:
4 changes: 2 additions & 2 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ services:

mock-data-holder:
container_name: mock-data-holder
image: consumerdatastandardsaustralia/nodejs-data-holder:0.1
image: consumerdatastandardsaustralia/nodejs-data-holder:0.2
# build:
# context: .
# dockerfile: dockerfile.dsb-test-data-server
Expand Down Expand Up @@ -195,7 +195,7 @@ services:
# context: .
# dockerfile: dockerfile.dsb-data-loader
container_name: dsb-data-loader
image: consumerdatastandardsaustralia/dsb-data-loader:0.1
image: consumerdatastandardsaustralia/dsb-data-loader:0.2
env_file: .env.docker
depends_on:
- mongodb
Expand Down
8 changes: 5 additions & 3 deletions dockerfile.dsb-test-data-server
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,13 @@ RUN npm install
# RUN npm ci --only=production

# Bundle app source
COPY ./test-data-server/ .
COPY ./security/mock-data-holder/ ./security
COPY ./test-data-server/ ./
COPY ./security/ /security
COPY ./.env* /

RUN npm run build:prod
RUN npm run build

#COPY ./security/mock-data-holder/ /app/dist/src/security/mock-data-holder/
COPY ./security/mtls-gateway/ca.crt /usr/local/share/ca-certificates/ca.crt
RUN update-ca-certificates

Expand Down
Loading

0 comments on commit 4e78675

Please sign in to comment.