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

[WIP] Bug bash #64

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
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
13 changes: 12 additions & 1 deletion modules/aws_ec2_standalone/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ terraform {

provider "aws" {
region = var.aws_region
alias = "provider-aws-ec2-standalone"
}

data "aws_ami" "this" {
Expand Down Expand Up @@ -93,13 +94,23 @@ resource "aws_instance" "this" {
cd retool-onpremise

# Rewrite Dockerfile
echo FROM tryretool/backend:${var.version_number} > Dockerfile
echo FROM ${var.backend_image_name}:${var.version_number} > Dockerfile
echo CMD ./docker_scripts/start_api.sh >> Dockerfile

# Rewrite CodeExecutor.Dockerfile
echo FROM ${var.code_executor_image_name}:${var.version_number} > CodeExecutor.Dockerfile
echo CMD bash start.sh >> CodeExecutor.Dockerfile

# Initialize Docker and Retool Installation
./install.sh

# Run services
docker-compose up -d
EOF
}

resource "aws_eip" "ec2_attached_elastic_ip" {
count = var.attach_eip ? 1 : 0
instance = aws_instance.this.id
vpc = true
}
23 changes: 23 additions & 0 deletions modules/aws_ec2_standalone/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,30 @@ variable "instance_name" {
description = "EC2 instance name. Defaults to `retool`."
}

variable "backend_image_name" {
type = string
default = "tryretool/backend"
description = "Docker Hub image name for the main backend image"
}

variable "code_executor_image_name" {
type = string
default = "tryretool/code-executor-service"
description = "Docker Hub image name for the code executor image"
}

variable "version_number" {
type = string
default = "2.106.2"
description = "Retool version number. Defaults to `2.106.2`."
}

variable "code_executor_version_number" {
type = string
default = "2.106.2"
description = "Retool code executor version number. Defaults to `2.106.2`."
}

variable "vpc_id" {
type = string
default = null
Expand Down Expand Up @@ -148,3 +166,8 @@ variable "egress_rules" {
description = "Egress rules for EC2 security group"
}

variable "attach_eip" {
type = bool
default = true
description = "Whether to attach an Elastic IP to the EC2 instance."
}