From 2029d426e138bd6795e32908a28443d5a71ff642 Mon Sep 17 00:00:00 2001 From: NIMESH GARG <51132740+nimeshgarg@users.noreply.github.com> Date: Sun, 2 Jun 2024 18:01:33 +1000 Subject: [PATCH 1/5] getting from ENV --- ecs.tf | 2 +- front-end/src/config.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ecs.tf b/ecs.tf index 80f9382..d5c3fb5 100644 --- a/ecs.tf +++ b/ecs.tf @@ -27,7 +27,7 @@ resource "aws_ecs_task_definition" "brewbucks-frontend" { ], "environment": [ { - "name": "BASE_URL", + "name": "VITE_BASE_URL", "value": "http://${aws_lb.brewbucks.dns_name}" } ], diff --git a/front-end/src/config.js b/front-end/src/config.js index 2777c05..5a6ccd9 100644 --- a/front-end/src/config.js +++ b/front-end/src/config.js @@ -1 +1 @@ -export const BASE_URL = "http://127.0.0.1:8080"; \ No newline at end of file +export const BASE_URL = "http://" + import.meta.env.VITE_BASE_URL || "127.0.0.1:8080"; From 406d4b1e7a1866946cb8d67b96aab5d850ed842b Mon Sep 17 00:00:00 2001 From: NIMESH GARG <51132740+nimeshgarg@users.noreply.github.com> Date: Sun, 2 Jun 2024 18:03:01 +1000 Subject: [PATCH 2/5] env --- front-end/src/config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/front-end/src/config.js b/front-end/src/config.js index 5a6ccd9..f509209 100644 --- a/front-end/src/config.js +++ b/front-end/src/config.js @@ -1 +1 @@ -export const BASE_URL = "http://" + import.meta.env.VITE_BASE_URL || "127.0.0.1:8080"; +export const BASE_URL = "http://" + import.meta.env.VITE_BASE_URL; From 97b269326fe01759d28ecefc162032a0d7979041 Mon Sep 17 00:00:00 2001 From: NIMESH GARG <51132740+nimeshgarg@users.noreply.github.com> Date: Sun, 2 Jun 2024 19:06:59 +1000 Subject: [PATCH 3/5] Docker file --- front-end/.gitignore | 3 +++ front-end/Dockerfile | 8 ++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/front-end/.gitignore b/front-end/.gitignore index a547bf3..6ac1686 100644 --- a/front-end/.gitignore +++ b/front-end/.gitignore @@ -22,3 +22,6 @@ dist-ssr *.njsproj *.sln *.sw? + +# environment file +.env \ No newline at end of file diff --git a/front-end/Dockerfile b/front-end/Dockerfile index 9b171a5..ee500a2 100644 --- a/front-end/Dockerfile +++ b/front-end/Dockerfile @@ -3,8 +3,8 @@ WORKDIR /app COPY package.json . RUN npm install COPY . . -RUN npm run build -RUN npm install -g serve +# RUN npm run build +# RUN npm install -g serve EXPOSE 80 -CMD [ "serve" , "-s" , "dist" , "-p" , "80"] -# CMD [ "npm" , "run" , "preview" ] \ No newline at end of file +# CMD [ "serve" , "-s" , "dist" , "-p" , "80"] +CMD [ "npm" , "run" , "dev" ] \ No newline at end of file From 8165ea0dd21d97cc8f3a91d5d0dfd0a9daff743c Mon Sep 17 00:00:00 2001 From: NIMESH GARG <51132740+nimeshgarg@users.noreply.github.com> Date: Sun, 2 Jun 2024 19:25:24 +1000 Subject: [PATCH 4/5] adding depends --- ecs.tf | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/ecs.tf b/ecs.tf index d5c3fb5..d242724 100644 --- a/ecs.tf +++ b/ecs.tf @@ -3,13 +3,13 @@ resource "aws_ecs_cluster" "brewbucks" { } resource "aws_ecs_task_definition" "brewbucks-frontend" { - family = "brewbucks-frontend" - network_mode = "awsvpc" + family = "brewbucks-frontend" + network_mode = "awsvpc" requires_compatibilities = ["FARGATE"] - cpu = 1024 - memory = 2048 - execution_role_arn = data.aws_iam_role.lab.arn - depends_on = [docker_image.brewbucks-frontend] + cpu = 1024 + memory = 2048 + execution_role_arn = data.aws_iam_role.lab.arn + depends_on = [docker_image.brewbucks-frontend, aws_lb.brewbucks] container_definitions = < Date: Sun, 2 Jun 2024 19:34:21 +1000 Subject: [PATCH 5/5] removing extra protocol --- ecs.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ecs.tf b/ecs.tf index d242724..300cf44 100644 --- a/ecs.tf +++ b/ecs.tf @@ -28,7 +28,7 @@ resource "aws_ecs_task_definition" "brewbucks-frontend" { "environment": [ { "name": "VITE_BASE_URL", - "value": "http://${aws_lb.brewbucks.dns_name}" + "value": "${aws_lb.brewbucks.dns_name}" } ], "logConfiguration": {