Skip to content

Commit

Permalink
Merge pull request #46 from CSSE6400/44-env-for-api-call-not-working
Browse files Browse the repository at this point in the history
44 env for api call not working
  • Loading branch information
ManavTriv authored Jun 2, 2024
2 parents 7429b81 + 683f92c commit ace5f75
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 16 deletions.
22 changes: 11 additions & 11 deletions ecs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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 = <<DEFINITION
[
Expand All @@ -27,8 +27,8 @@ resource "aws_ecs_task_definition" "brewbucks-frontend" {
],
"environment": [
{
"name": "BASE_URL",
"value": "http://${aws_lb.brewbucks.dns_name}"
"name": "VITE_BASE_URL",
"value": "${aws_lb.brewbucks.dns_name}"
}
],
"logConfiguration": {
Expand Down Expand Up @@ -106,13 +106,13 @@ resource "aws_ecs_service" "brewbucks-frontend" {
container_name = "brewbucks-frontend"
container_port = 80
}

}

resource "aws_ecs_service" "brewbucks" {
name = "brewbucks"
cluster = aws_ecs_cluster.brewbucks.id
task_definition = aws_ecs_task_definition.brewbucks.arn
task_definition = aws_ecs_task_definition.brewbucks.arn
desired_count = 1
launch_type = "FARGATE"
depends_on = [aws_ecs_task_definition.brewbucks]
Expand Down Expand Up @@ -154,4 +154,4 @@ resource "aws_security_group" "brewbucks" {
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"]
}
}
}
3 changes: 3 additions & 0 deletions front-end/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,6 @@ dist-ssr
*.njsproj
*.sln
*.sw?

# environment file
.env
8 changes: 4 additions & 4 deletions front-end/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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" ]
# CMD [ "serve" , "-s" , "dist" , "-p" , "80"]
CMD [ "npm" , "run" , "dev" ]
2 changes: 1 addition & 1 deletion front-end/src/config.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const BASE_URL = "http://127.0.0.1:8080";
export const BASE_URL = "http://" + import.meta.env.VITE_BASE_URL;

0 comments on commit ace5f75

Please sign in to comment.