diff --git a/README.md b/README.md index 4df14d0d..9663f645 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ By default, `node-oracledb` runs in [Thin mode (vs. Thick mode)](https://node-or The backend for the dashboard is under `./graphql-server`. -Set up your [./graphql-server/dist/env/application.properties.EXAMPLE](./graphql-server/dist/env/application.properties.EXAMPLE) with all of the application properties needed for running the dashboard backend. +Set up your [./graphql-server/src/env/application.properties.EXAMPLE](./graphql-server/src/env/application.properties.EXAMPLE) with all of the application properties needed for running the dashboard backend. Build and launch the node app from the project root directory with: @@ -119,6 +119,11 @@ services: restart: unless-stopped environment: - SMILE_CONFIG_HOME=${SMILE_CONFIG_HOME} + - NODE_TLS_REJECT_UNAUTHORIZED=${NODE_TLS_REJECT_UNAUTHORIZED} + - LD_LIBRARY_PATH=${LD_LIBRARY_PATH} + - REACT_SERVER_ORIGIN=${REACT_SERVER_ORIGIN} + - EXPRESS_SERVER_ORIGIN=${EXPRESS_SERVER_ORIGIN} + - SMILE_DATA_HOME=${SMILE_DATA_HOME} volumes: - type: bind source: ${SMILE_CONFIG_HOME}/resources/smile-dashboard @@ -126,26 +131,41 @@ services: - type: bind source: ${SMILE_CONFIG_HOME}/nats target: /server/nats + - type: bind + source: ${SMILE_DATA_HOME}/logs/smile-dashboard + target: ${SMILE_DATA_HOME}/logs/smile-dashboard + - type: bind + source: ${LD_LIBRARY_PATH} + target: ${LD_LIBRARY_PATH} external_links: - nats-jetstream + links: - neo4j depends_on: neo4j: condition: service_healthy + keycloak: + condition: service_started ports: - 4000:4000 healthcheck: - test: ["CMD", "curl", "-s", "https://localhost:4000"] - interval: 30s - timeout: 10s - retries: 5 + test: ["CMD-SHELL", "wget --no-check-certificate --no-verbose --spider https://localhost:4000 || exit 1"] + interval: 30s + timeout: 10s + retries: 5 smile-dashboard: container_name: smile-dashboard image: cmometadb/smile-dashboard:[build version] restart: unless-stopped environment: - - REACT_APP_GRAPHQL_CLIENT_URI=${REACT_APP_GRAPHQL_CLIENT_URI} + - SMILE_CONFIG_HOME=${SMILE_CONFIG_HOME} + - REACT_APP_EXPRESS_SERVER_ORIGIN=${REACT_APP_EXPRESS_SERVER_ORIGIN} + - REACT_APP_REACT_SERVER_ORIGIN=${REACT_APP_REACT_SERVER_ORIGIN} + volumes: + - type: bind + source: ${SMILE_CONFIG_HOME}/resources/smile-dashboard + target: ${SMILE_CONFIG_HOME}/resources/smile-dashboard links: - graphql-client ports: diff --git a/graphql-server/src/index.ts b/graphql-server/src/index.ts index 1564d681..53459761 100644 --- a/graphql-server/src/index.ts +++ b/graphql-server/src/index.ts @@ -1,5 +1,5 @@ import express, { Express } from "express"; -import { EXPRESS_SERVER_ORIGIN } from "./utils/constants"; +import { REACT_APP_EXPRESS_SERVER_ORIGIN } from "./utils/constants"; import { initializeApolloServer, initializeHttpsServer } from "./utils/servers"; import { configureApp } from "./middlewares/configureApp"; import { configureSession } from "./middlewares/configureSession"; @@ -22,7 +22,7 @@ async function main() { ); console.log( - `🚀 Server ready at ${EXPRESS_SERVER_ORIGIN}${apolloServer.graphqlPath}` + `🚀 Server ready at ${REACT_APP_EXPRESS_SERVER_ORIGIN}${apolloServer.graphqlPath}` ); } diff --git a/graphql-server/src/routes/auth/callback.ts b/graphql-server/src/routes/auth/callback.ts index 8e00f2f1..68449cee 100644 --- a/graphql-server/src/routes/auth/callback.ts +++ b/graphql-server/src/routes/auth/callback.ts @@ -1,4 +1,4 @@ -import { REACT_SERVER_ORIGIN } from "../../utils/constants"; +import { REACT_APP_REACT_SERVER_ORIGIN } from "../../utils/constants"; const passport = require("passport"); /** @@ -8,7 +8,7 @@ const passport = require("passport"); */ export function callbackRoute(req: any, res: any, next: any) { passport.authenticate("oidc", { - successRedirect: `${REACT_SERVER_ORIGIN}/auth/login-success`, + successRedirect: `${REACT_APP_REACT_SERVER_ORIGIN}/auth/login-success`, failureRedirect: "/", })(req, res, next); } diff --git a/graphql-server/src/utils/constants.ts b/graphql-server/src/utils/constants.ts index 03f6fd8a..7524ecac 100644 --- a/graphql-server/src/utils/constants.ts +++ b/graphql-server/src/utils/constants.ts @@ -40,17 +40,17 @@ export const props = { oncotree_api: properties.get("oncotree.oncotree_api"), }; -export const EXPRESS_SERVER_ORIGIN = - process.env.EXPRESS_SERVER_ORIGIN === undefined +export const REACT_APP_EXPRESS_SERVER_ORIGIN = + process.env.REACT_APP_EXPRESS_SERVER_ORIGIN === undefined ? "https://localhost:4000" - : process.env.EXPRESS_SERVER_ORIGIN; + : process.env.REACT_APP_EXPRESS_SERVER_ORIGIN; -export const REACT_SERVER_ORIGIN = - process.env.REACT_SERVER_ORIGIN === undefined +export const REACT_APP_REACT_SERVER_ORIGIN = + process.env.REACT_APP_REACT_SERVER_ORIGIN === undefined ? "https://localhost:3006" - : process.env.REACT_SERVER_ORIGIN; + : process.env.REACT_APP_REACT_SERVER_ORIGIN; export const corsOptions = { - origin: REACT_SERVER_ORIGIN, + origin: REACT_APP_REACT_SERVER_ORIGIN, credentials: true, }; diff --git a/graphql-server/src/utils/session.ts b/graphql-server/src/utils/session.ts index 423ce083..7db3883f 100644 --- a/graphql-server/src/utils/session.ts +++ b/graphql-server/src/utils/session.ts @@ -1,6 +1,6 @@ import { Issuer } from "openid-client"; import { props } from "../utils/constants"; -import { EXPRESS_SERVER_ORIGIN } from "./constants"; +import { REACT_APP_EXPRESS_SERVER_ORIGIN } from "./constants"; import { logOutRoute } from "../routes/auth/logout"; export async function getKeycloakClient() { @@ -9,7 +9,7 @@ export async function getKeycloakClient() { return new keycloakIssuer.Client({ client_id: props.keycloak_client_id, client_secret: props.keycloak_client_secret, - redirect_uris: [`${EXPRESS_SERVER_ORIGIN}/auth/callback`], + redirect_uris: [`${REACT_APP_EXPRESS_SERVER_ORIGIN}/auth/callback`], response_types: ["code"], }); }