Skip to content

Commit

Permalink
Fixed naming of the cluster so that the autoscaling group correctly c…
Browse files Browse the repository at this point in the history
…an reference it
  • Loading branch information
larsmoan committed Apr 11, 2024
1 parent 4760671 commit 1cef52f
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
2 changes: 0 additions & 2 deletions Dockerfile.deploy
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
FROM --platform=linux/amd64 python:3.11

ENV SQLALCHEMY_DATABASE_URI=sqlite:///:memory:

# Installing dependencies and cleaning up
RUN apt-get update && apt-get install -y --no-install-recommends wget \
&& rm -rf /var/lib/apt/lists/*
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,7 @@ Dockerfile.deploy is for cloud deployment and this is referenced in main.tf when
# TESTS:
Functionality testing:
docker run --rm --net='host' -e TEST_HOST='http://localhost:6400/api/v1' spamoverflow-tests-local:latest

Deployment tests:
docker pull ghcr.io/csse6400/spamoverflow-scalability:latest
docker run --net='host' -e TEST_HOST='http://your-endpoint/api/v1' ghcr.io/csse6400/spamoverflow-scalability:latest
4 changes: 2 additions & 2 deletions autoscaling.tf
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
resource "aws_appautoscaling_target" "spamscanner" {
max_capacity = 4
min_capacity = 1
resource_id = "service/spamoverflow/spamoverflow"
resource_id = "service/spamoverflow-ecs-cluster/spamoverflow"
scalable_dimension = "ecs:service:DesiredCount"
service_namespace = "ecs"

depends_on = [ aws_ecs_service.spamoverflow ]
depends_on = [aws_ecs_service.spamoverflow]
}


Expand Down
1 change: 1 addition & 0 deletions spamoverflow/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ def create_app(config_overrides=None):
app = Flask(__name__)

#This enables the postgres database if an environmental variable is declared, which it will be if we are using docker-compose.yml
# if it is not specified by docker-compose i.e if we just run docker build, the default value of "sqlite:///db.sqlite" will be used
app.config['SQLALCHEMY_DATABASE_URI'] = environ.get("SQLALCHEMY_DATABASE_URI", "sqlite:///db.sqlite")
if config_overrides:
app.config.update(config_overrides)
Expand Down

0 comments on commit 1cef52f

Please sign in to comment.