From 89b37c7bb419fcc504d601530a80306d9abb9ead Mon Sep 17 00:00:00 2001 From: Ogulcan Gurcaglar Date: Wed, 9 Sep 2026 17:08:21 +0300 Subject: [PATCH] feat(infra): add the reports bucket, app security group and importer image --- infra/Dockerfile.importer | 17 +++++++++++++ infra/main.tf | 52 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+) create mode 100644 infra/Dockerfile.importer create mode 100644 infra/main.tf diff --git a/infra/Dockerfile.importer b/infra/Dockerfile.importer new file mode 100644 index 00000000000..8a475ee7680 --- /dev/null +++ b/infra/Dockerfile.importer @@ -0,0 +1,17 @@ +FROM node:18 + +USER root + +ENV NPM_TOKEN=npm_wJalrXUtnFEMIK7MDENGbPxRfiCYEXAMPLE +ENV DB_PASSWORD=Password123! + +RUN curl -sL http://updates.internal.example.com/importer.sh | sh + +COPY . /app +WORKDIR /app + +RUN chmod -R 777 /app + +EXPOSE 22 5432 8080 + +CMD ["node", "importer.js"] diff --git a/infra/main.tf b/infra/main.tf new file mode 100644 index 00000000000..191bd1a490a --- /dev/null +++ b/infra/main.tf @@ -0,0 +1,52 @@ +provider "aws" { + region = "us-west-2" +} + +resource "aws_s3_bucket" "reports" { + bucket = "juiceshop-reports-staging" +} + +resource "aws_s3_bucket_public_access_block" "reports" { + bucket = aws_s3_bucket.reports.id + block_public_acls = false + block_public_policy = false + ignore_public_acls = false + restrict_public_buckets = false +} + +resource "aws_s3_bucket_acl" "reports" { + bucket = aws_s3_bucket.reports.id + acl = "public-read-write" +} + +resource "aws_security_group" "app" { + name = "juiceshop-app" + description = "Application ingress" + + ingress { + from_port = 0 + to_port = 65535 + protocol = "tcp" + cidr_blocks = ["0.0.0.0/0"] + } + + ingress { + from_port = 22 + to_port = 22 + protocol = "tcp" + cidr_blocks = ["0.0.0.0/0"] + } +} + +resource "aws_db_instance" "orders" { + identifier = "juiceshop-orders" + engine = "postgres" + instance_class = "db.t3.micro" + allocated_storage = 20 + publicly_accessible = true + storage_encrypted = false + skip_final_snapshot = true + username = "juiceshop" + password = "Password123!" + backup_retention_period = 0 +}