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

Minor infrastructure changes #3797

Merged
merged 2 commits into from
Apr 1, 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
21 changes: 21 additions & 0 deletions infrastructure/applications/pretix/cache.tf
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,24 @@ resource "aws_elasticache_cluster" "cache" {
ignore_changes = [engine_version]
}
}

data "aws_ami" "ecs_arm" {
most_recent = true

filter {
name = "name"
values = ["al2023-ami-ecs-hvm-2023.0.20240328-kernel-6.1-arm64"]
}

filter {
name = "virtualization-type"
values = ["hvm"]
}

filter {
name = "architecture"
values = ["arm64"]
}

owners = ["amazon"]
}
3 changes: 1 addition & 2 deletions infrastructure/applications/pretix/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,7 @@ resource "aws_ecs_task_definition" "pretix_service" {
{
name = "pretix"
image = "${data.aws_ecr_repository.repo.repository_url}@${data.aws_ecr_image.image.image_digest}"
cpu = 2048
memory = 1900
memoryReservation = 1900
essential = true
environment = [
{
Expand Down
14 changes: 14 additions & 0 deletions infrastructure/applications/pretix/vpc.tf
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,20 @@ data "aws_subnet" "public" {
}
}

data "aws_subnet" "private" {
vpc_id = data.aws_vpc.default.id

filter {
name = "tag:Type"
values = ["private"]
}

filter {
name = "tag:AZ"
values = ["eu-central-1a"]
}
}

data "aws_subnets" "private" {
filter {
name = "vpc-id"
Expand Down
28 changes: 3 additions & 25 deletions infrastructure/applications/pycon_backend/worker.tf
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ data "template_file" "user_data" {

resource "aws_instance" "instance_1" {
ami = data.aws_ami.ecs.id
instance_type = "t4g.nano"
instance_type = "t4g.micro"
subnet_id = data.aws_subnet.private_1a.id
availability_zone = "eu-central-1a"
vpc_security_group_ids = [
Expand All @@ -247,26 +247,6 @@ resource "aws_instance" "instance_1" {
}
}

resource "aws_instance" "instance_2" {
ami = data.aws_ami.ecs.id
instance_type = "t4g.nano"
subnet_id = data.aws_subnet.private_1a.id
availability_zone = "eu-central-1a"
vpc_security_group_ids = [
data.aws_security_group.rds.id,
data.aws_security_group.lambda.id,
aws_security_group.instance.id
]
source_dest_check = false
user_data = data.template_file.user_data.rendered
iam_instance_profile = aws_iam_instance_profile.worker.name
key_name = "pretix"

tags = {
Name = "pythonit-${terraform.workspace}-worker-2"
}
}

resource "aws_cloudwatch_log_group" "worker_logs" {
name = "/ecs/pythonit-${terraform.workspace}-worker"
retention_in_days = 7
Expand All @@ -279,8 +259,7 @@ resource "aws_ecs_task_definition" "worker" {
{
name = "worker"
image = "${data.aws_ecr_repository.be_repo.repository_url}@${data.aws_ecr_image.be_arm_image.image_digest}"
cpu = 2048
memory = 400
memoryReservation = 400
essential = true
entrypoint = [
"/home/app/.venv/bin/celery",
Expand Down Expand Up @@ -333,8 +312,7 @@ resource "aws_ecs_task_definition" "beat" {
{
name = "beat"
image = "${data.aws_ecr_repository.be_repo.repository_url}@${data.aws_ecr_image.be_arm_image.image_digest}"
cpu = 2048
memory = 400
memoryReservation = 400
essential = true
entrypoint = [
"/home/app/.venv/bin/celery",
Expand Down
Loading