Skip to content

Commit

Permalink
Merge pull request #149 from GenomicDataInfrastructure/fix/ART-10607
Browse files Browse the repository at this point in the history
Fix/art 10607
  • Loading branch information
brunopacheco1 authored Nov 14, 2024
2 parents a9a2354 + aa1541a commit 462517b
Show file tree
Hide file tree
Showing 12 changed files with 93 additions and 7 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,5 @@ nb-configuration.xml
# Plugin directory
/.quarkus/cli/plugins/
__pycache__/
venv/
venv/
infra/config/.env.secrets
18 changes: 18 additions & 0 deletions infra/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!--
SPDX-FileCopyrightText: 2024 PNED G.I.E.
SPDX-License-Identifier: CC-BY-4.0
-->
## To Run the application locally

* Create a new file named .env.secrets in infra/config by copying .env.secrets.template and updating the secret values
* To build and start the docker image using your local changes Run the script

```bash
./start.sh
```
* To stop the application run the below script

```bash
./stop.sh
```
15 changes: 15 additions & 0 deletions infra/config/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# SPDX-FileCopyrightText: 2024 PNED G.I.E.
#
# SPDX-License-Identifier: Apache-2.0
# Common Quarkus
QUARKUS_OIDC_AUTH_SERVER_URL=https://id.portal.dev.gdi.lu/realms/gdi
QUARKUS_OIDC_CLIENT_ID=gdi
QUARKUS_LOG_LEVEL=DEBUG
QUARKUS_OTEL_METRICS_ENABLED=false


# Dataset Discovery Service
QUARKUS_REST_CLIENT_CKAN_YAML_URL=https://catalogue.portal.dev.gdi.lu/
QUARKUS_REST_CLIENT_BEACON_YAML_URL=https://beacon-network-backend-demo.ega-archive.org/beacon-network
QUARKUS_REST_CLIENT_KEYCLOAK_YAML_URL=https://id.portal.dev.gdi.lu/realms/gdi
QUARKUS_REST_CLIENT_KEYCLOAK_YAML_BEACON_IDP_ALIAS=LSAAI
4 changes: 4 additions & 0 deletions infra/config/.env.secrets.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# SPDX-FileCopyrightText: 2024 PNED G.I.E.
#
# SPDX-License-Identifier: Apache-2.0
QUARKUS_OIDC_CREDENTIALS_SECRET= if you do not have one ask your colleagues to share this with you
18 changes: 18 additions & 0 deletions infra/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# SPDX-FileCopyrightText: 2024 PNED G.I.E.
#
# SPDX-License-Identifier: Apache-2.0

services:
dataset-discovery-service:
container_name: dds
image: local/dds:latest
build:
context: ../
restart: unless-stopped
ports:
- "8080:8080"
env_file:
- ./config/.env
- ./config/.env.secrets
healthcheck:
test: ["CMD", "curl", "-o", "/dev/null", "http://localhost:8080/q/health"]
24 changes: 24 additions & 0 deletions infra/start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# SPDX-FileCopyrightText: 2024 PNED G.I.E.
#
# SPDX-License-Identifier: Apache-2.0
#!/bin/bash

cd ../

# Run Maven build
echo "Building the application ..."

if ! mvn clean package -Dnative -Dquarkus.native.container-build=true; then
echo "Maven build failed. Please check the output for errors."
exit 1
fi

echo "Maven build completed successfully."

echo "Building application docker image"
docker build -t local/dds .

echo "Docker image build completed successfully."

echo "Starting application"
docker-compose -f ./infra/docker-compose.yml up
6 changes: 6 additions & 0 deletions infra/stop.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# SPDX-FileCopyrightText: 2024 PNED G.I.E.
#
# SPDX-License-Identifier: Apache-2.0
#!/bin/bash

docker-compose down
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,19 @@ public BeaconFilterBuilder(BeaconAuth beaconAuth,

@SneakyThrows
@Override
public List<Filter> build(String accessToken) {
var beaconAuthorization = beaconAuth.retrieveAuthorization(accessToken);
public List<Filter> build(final String accessToken) {
final var beaconAuthorization = beaconAuth.retrieveAuthorization(accessToken);
if (beaconAuthorization == null) {
return List.of();
}
var inputStream = ofNullable(getClass()
final var inputStream = ofNullable(getClass()
.getClassLoader()
.getResourceAsStream("mock-beacon-filters.json"))
.getResourceAsStream("META-INF/resources/beacon-filters.json"))
.orElseThrow(() -> new IOException(
"Resource file 'mock-beacon-filters.json' not found"));
"Resource file 'beacon-filters.json' not found"));

return objectMapper.readValue(inputStream,
new TypeReference<List<Filter>>() {
new TypeReference<>() {
});
}
}
File renamed without changes.
File renamed without changes.

0 comments on commit 462517b

Please sign in to comment.