Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

44 env for api call not working #46

Merged
merged 5 commits into from
Jun 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
Loading