From a469eea1550f28dc0cbd999c77c5d52bf0b5df84 Mon Sep 17 00:00:00 2001 From: alexeh Date: Mon, 14 Oct 2024 08:52:39 +0200 Subject: [PATCH 1/3] set ssl for adminjs --- admin/datasource.ts | 4 ++++ package.json | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/admin/datasource.ts b/admin/datasource.ts index 769f38b3..4fb6f9da 100644 --- a/admin/datasource.ts +++ b/admin/datasource.ts @@ -14,4 +14,8 @@ export const dataSource = new DataSource({ database: process.env.DB_NAME || "blc", entities: [User, Country, CarbonInputEntity, CostInput], synchronize: false, + ssl: + process.env.NODE_ENV === "production" + ? { rejectUnauthorized: false } + : false, }); diff --git a/package.json b/package.json index 06ecda9d..f2edc4a9 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "api:dev": "pnpm --filter api run start:dev", "api:build": "pnpm --filter api run build", "api:prod": "NODE_ENV=production pnpm --filter api run start:prod", - "admin:prod": "pnpm --filter admin run start:prod", + "admin:prod": "NODE_ENV=production pnpm --filter admin run start:prod", "client:deps": "pnpm --filter client install", "client:dev": "pnpm --filter client run dev", "client:build": "pnpm --filter client run build", From ebb6153e58000af6834bdc9d41fdc4be3bbd2fc8 Mon Sep 17 00:00:00 2001 From: alexeh Date: Mon, 14 Oct 2024 10:13:27 +0200 Subject: [PATCH 2/3] reroute backoffice to /administration --- .../source_bundle/proxy/conf.d/application.conf | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/infrastructure/source_bundle/proxy/conf.d/application.conf b/infrastructure/source_bundle/proxy/conf.d/application.conf index 0a548521..a41a5958 100644 --- a/infrastructure/source_bundle/proxy/conf.d/application.conf +++ b/infrastructure/source_bundle/proxy/conf.d/application.conf @@ -7,7 +7,7 @@ upstream client { } upstream admin { - server admin:1000; + server administration:1000; } server { @@ -41,9 +41,9 @@ server { proxy_pass_request_headers on; client_max_body_size 200m; } - location /admin/ { - rewrite ^/admin/?(.*)$ /$1 break; - proxy_pass http://admin; + location /administration/ { + rewrite ^/administration/?(.*)$ /$1 break; + proxy_pass http://administration; proxy_http_version 1.1; proxy_set_header X-Forwarded-Host $host; proxy_set_header X-Forwarded-Server $host; From 8b61920f03f26a1e4360bb2a9a656a0a5e52bf5a Mon Sep 17 00:00:00 2001 From: alexeh Date: Mon, 14 Oct 2024 10:13:35 +0200 Subject: [PATCH 3/3] add missing client env var --- client/.env.development | 2 +- infrastructure/modules/env/client_env_vars.tf | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/client/.env.development b/client/.env.development index 9c6a2e7e..ddec322d 100644 --- a/client/.env.development +++ b/client/.env.development @@ -1,4 +1,4 @@ NEXTAUTH_URL=http://localhost:$PORT NEXTAUTH_SECRET=WAzjpS46vFxp17TsRDU3FXo+TF0vrfy6uhCXwGMBUE8= #NEXT_PUBLIC_API_URL=https://dev.blue-carbon-cost-tool.dev-vizzuality.com/api -NEXT_PUBLIC_API_URL=http://localhost:4000 \ No newline at end of file +NEXT_PUBLIC_API_URL=http://localhost:4000 diff --git a/infrastructure/modules/env/client_env_vars.tf b/infrastructure/modules/env/client_env_vars.tf index 2cf49004..493bc305 100644 --- a/infrastructure/modules/env/client_env_vars.tf +++ b/infrastructure/modules/env/client_env_vars.tf @@ -10,5 +10,6 @@ locals { } client_env_vars = { NEXT_PUBLIC_API_URL = "https://${var.environment}.blue-carbon-cost-tool.dev-vizzuality.com/api" + NEXTAUTH_URL = "https://${var.environment}.blue-carbon-cost-tool.dev-vizzuality.com" } } \ No newline at end of file