From 8dd914c6c2b434fd9f0178c9fe95d25a8d33b1bc Mon Sep 17 00:00:00 2001 From: Carl Tibule Date: Mon, 8 Apr 2024 23:12:16 -0500 Subject: [PATCH] Committing work fixing issues found while testing on dev1.bookmarks - Modified EnvironmentUtils to fix proper casing for getting ASPNETCore_Environment - On Web, modify package.json to delete 'homepage': '.', line to fix issue with app not serving up subroutes. See: https://stackoverflow.com/questions/63036631/nginx-returning-404-when-trying-get-subroute-in-dockerized-react-app - Added docker-compose for easier setup and deployment of local docker containers --- .gitignore | 1 - API/YABA.Common/Utils/EnvironmentUtils.cs | 2 +- Web/package.json | 1 - docker-compose.yaml | 38 +++++++++++++++++++++++ 4 files changed, 39 insertions(+), 3 deletions(-) create mode 100644 docker-compose.yaml diff --git a/.gitignore b/.gitignore index dd0f39e..28c19e8 100644 --- a/.gitignore +++ b/.gitignore @@ -248,5 +248,4 @@ yarn-debug.log* yarn-error.log* .env Logs/* -docker-compose.yml *exclude* \ No newline at end of file diff --git a/API/YABA.Common/Utils/EnvironmentUtils.cs b/API/YABA.Common/Utils/EnvironmentUtils.cs index 4fecaec..bc9ded2 100644 --- a/API/YABA.Common/Utils/EnvironmentUtils.cs +++ b/API/YABA.Common/Utils/EnvironmentUtils.cs @@ -4,6 +4,6 @@ namespace YABA.Common.Utils { public static class EnvironmentUtils { - public static bool IsDevelopmentEnvironment() => Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT") == "Development"; + public static bool IsDevelopmentEnvironment() => Environment.GetEnvironmentVariable("ASPNETCORE_Environment") == "Development"; } } diff --git a/Web/package.json b/Web/package.json index 2eedd9e..ceccb39 100644 --- a/Web/package.json +++ b/Web/package.json @@ -2,7 +2,6 @@ "name": "yaba-web", "version": "0.1.0", "private": true, - "homepage": ".", "dependencies": { "@auth0/auth0-react": "^2.0.0", "@testing-library/jest-dom": "^5.16.5", diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..ec9955c --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,38 @@ +version: "3" +services: + web: + build: + context: ./Web + dockerfile: Dockerfile + args: + REACT_APP_API_BASE_URL: http://localhost:32270/api + REACT_APP_AUTH0_DOMAIN: iwanaga-dev.us.auth0.com + REACT_APP_AUTH0_CLIENT_ID: ${AUTH0_CLIENT_ID} + REACT_APP_AUTH0_CALLBACK_URL: http://localhost:32271/redirect + REACT_APP_AUTH0_AUDIENCE: https://yaba.dev.iwanaga.moe + container_name: yaba_web + restart: unless-stopped + ports: + - 32271:80 + depends_on: + - api + api: + build: + context: ./API + dockerfile: YABA.API/Dockerfile + args: + MODE: Debug + container_name: yaba_api + ports: + - 32270:80 + environment: + ASPNETCORE_Environment: Development + ASPNETCORE_Authentication__Auth0__ClientId: ${AUTH0_CLIENT_ID} + ASPNETCORE_Authentication__Auth0__ClientSecret: ${AUTH0_CLIENT_SECRET} + ASPNETCORE_Authentication__Auth0__Domain: iwanaga-dev.us.auth0.com + ASPNETCORE_Authentication__Auth0__Identifier: https://yaba.dev.iwanaga.moe + ASPNETCORE_ConnectionStrings__YABAReadOnlyDbConnectionString: ${RO_CONNECTION_STRING} + ASPNETCORE_ConnectionStrings__YABAReadWriteDbConnectionString: ${RW_CONNECTION_STRING} + WebClient__Url: http://localhost:32271 + Serilog__WriteTo__1__Args__Uri: https://loki.iwanaga.moe + Serilog__WriteTo__1__Args__Labels__1__Value: localhost \ No newline at end of file