Skip to content

Commit

Permalink
*qaas - partial
Browse files Browse the repository at this point in the history
  • Loading branch information
Egor Zuev committed Oct 8, 2020
1 parent a59be94 commit 2440dee
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
14 changes: 12 additions & 2 deletions qaas/sqs/cropper/infrastructure/ec2.tf
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,21 @@ resource "aws_instance" "app" {
depends_on = [aws_security_group.app_sg] // todo add s3
vpc_security_group_ids = [aws_security_group.app_sg.id]
iam_instance_profile = aws_iam_instance_profile.app_sqs_s3_role_profile.name

user_data = <<-EOT
#!/bin/bash
git clone https://github.com/ega-forever/akvelon-cloud-aws.git
#!/bin/bash
export SQS_QUEUE=${aws_sqs_queue.bucket_put_ev_queue.id}
export SQS_REGION=${data.aws_region.current.name}
export SQS_API_VERSION=2012-11-05
export S3_TARGET_BUCKET=${var.s3_target_bucket}
export S3_REGION=${data.aws_region.current.name}
export S3_API_VERSION=2006-03-01
curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
sudo apt-get install -y nodejs
sudo npm install -g pm2
git clone https://github.com/ega-forever/akvelon-cloud-aws.git ~/app
cd ~/app/qaas/sqs/cropper/app && npm install --unsafe-perm && npm run build && pm2 startup ubuntu && pm2 start build/index.js && pm2 save
EOT

Expand Down
2 changes: 2 additions & 0 deletions qaas/sqs/cropper/infrastructure/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ provider "aws" {
version = "3.5.0"
}

data "aws_region" "current" {}

output "sqs" {
value = aws_sqs_queue.bucket_put_ev_queue.id
}

0 comments on commit 2440dee

Please sign in to comment.