Skip to content

Commit

Permalink
Merge pull request #33 from Voxtir/feature/s3-audio-upload-setup
Browse files Browse the repository at this point in the history
Feature/s3 audio upload setup
  • Loading branch information
gustavhartz authored Aug 3, 2023
2 parents c4f3ed5 + 084bc26 commit b8b4ee5
Show file tree
Hide file tree
Showing 15 changed files with 915 additions and 118 deletions.
39 changes: 39 additions & 0 deletions devops/staging/app-server.tf
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,45 @@ resource "cloudflare_record" "resend_domain_key_txt" {
type = "TXT"
}

// S3 to store audiofiles and perform transcriptions
resource "aws_s3_bucket" "voxtir_audiofiles" {
bucket = "voxtir-audiofiles-${var.environment}"
}

data "aws_iam_policy_document" "audio_bucket_sqs" {
statement {
effect = "Allow"

principals {
type = "*"
identifiers = ["*"]
}

actions = ["sqs:SendMessage"]
resources = ["arn:aws:sqs:*:*:s3-event-notification-queue"]

condition {
test = "ArnEquals"
variable = "aws:SourceArn"
values = [aws_s3_bucket.voxtir_audiofiles.arn]
}
}
}

resource "aws_sqs_queue" "audio_bucket_queue" {
name = "s3-event-notification-queue"
policy = data.aws_iam_policy_document.audio_bucket_sqs.json
}

resource "aws_s3_bucket_notification" "audio_bucket_notification" {
bucket = aws_s3_bucket.voxtir_audiofiles.id

queue {
queue_arn = aws_sqs_queue.audio_bucket_queue.arn
events = ["s3:ObjectCreated:*"]
}
}

#TODO: Add a load balancer to the app server
#TODO: Add VPC and subnets to the app server
#TODO: Create a security group for the app server
Expand Down
8 changes: 7 additions & 1 deletion server/.env-example
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,10 @@ PROJECT_SHARING_EXPIRATION_TIME=604800
JWT_SECRET="YOURSECRET"
RESEND_API_KEY="<API_KEY>"
FRONTEND_BASE_URL="YOUR_FRONTEND_DOMAIN"
RESEND_DOMAIN="YOUR_RESEND_DOMAIN"
RESEND_DOMAIN="YOUR_RESEND_DOMAIN"
AWS_REGION="eu-north-1"
AWS_AUDIO_BUCKET_NAME="voxtir-audio-staging"
AUTH0_CLIENT_ID="YOUR CLIENT ID"
AUTH0_CLIENT_SECRET="YOUR SECRET"
# Overwrite the auth0 login stuff and assume user identity. No user token will be created
DEVELOPMENT_USER=""
Loading

0 comments on commit b8b4ee5

Please sign in to comment.