Creating definition for alpha and lewdlad service
This commit is contained in:
parent
b9ac171181
commit
e830889432
@ -1,59 +1,60 @@
|
||||
# Alpha is our primary server that we use for bots which basically
|
||||
# serve services that I personally run
|
||||
# Alpha houses all of our containerized applications
|
||||
# Essentially it is a cluster with services that we
|
||||
# choose to expose to the internet in one form or another
|
||||
|
||||
######################### SSH KEY ##############################################
|
||||
resource "aws_key_pair" "alpha_ssh" {
|
||||
key_name = var.alpha_ssh_key_name
|
||||
public_key = file(var.alpha_public_key_path)
|
||||
# Logging Configuration for services inside the cluster
|
||||
#######################################################
|
||||
|
||||
resource "aws_cloudwatch_log_group" "alpha" {
|
||||
name = "alpha-log"
|
||||
}
|
||||
|
||||
######################### files.leftcoast.space VOLUME #########################
|
||||
resource "aws_ebs_volume" "photo_gallery_volume" {
|
||||
availability_zone = var.athens_availability_zone
|
||||
size = 35
|
||||
|
||||
tags = {
|
||||
Name = "Photo gallery volume"
|
||||
Description = "Volume is to be used entirely for Photos/Video"
|
||||
# Alpha cluster definition
|
||||
###########################
|
||||
resource "aws_ecs_cluster" "alpha" {
|
||||
name = "alpha"
|
||||
configuration {
|
||||
execute_command_configuration {
|
||||
log_configuration {
|
||||
cloud_watch_log_group_name = aws_cloudwatch_log_group.alpha.name
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
######################### clips.shockrah.xyz VOLUME ############################
|
||||
resource "aws_ebs_volume" "id" {
|
||||
availability_zone = "us-west-1b"
|
||||
size = 35
|
||||
tags = {
|
||||
Name = "Clips"
|
||||
Description = "Used for the clippable instance"
|
||||
}
|
||||
}
|
||||
|
||||
######################### INSTANCE CONFIGURATION ###############################
|
||||
resource "aws_instance" "alpha" {
|
||||
ami = var.alpha_ami_id
|
||||
instance_type = var.alpha_instance_type
|
||||
|
||||
key_name = var.alpha_ssh_key_name
|
||||
|
||||
private_ip = "10.0.1.10"
|
||||
vpc_security_group_ids = [
|
||||
aws_security_group.general_web_req.id,
|
||||
aws_security_group.remote_ssh_rec.id
|
||||
# Lewdlad Service Definition
|
||||
############################
|
||||
resource "aws_ecs_task_definition" "lewdlad" {
|
||||
family = "lewdlad-task-definition"
|
||||
container_definitions = jsonencode([
|
||||
{
|
||||
name = "lewdlad-container"
|
||||
image = "registry.gitlab.com/shockrah/left-coast-server-bot:latest"
|
||||
# Literally the smallest amount that fargate will allow
|
||||
cpu = 256
|
||||
memory = 512
|
||||
essential = true
|
||||
environment = [
|
||||
{ name: DISCORD_ID, value: var.DISCORD_ID },
|
||||
{ name: DISCORD_TOKEN, value: var.DISCORD_TOKEN },
|
||||
{ name: AWS_API_ID, value: var.AWS_API_ID },
|
||||
{ name: AWS_API_STAGE, value: var.AWS_API_STAGE },
|
||||
{ name: AWS_API_REGION, value: var.AWS_API_REGION },
|
||||
{ name: AWS_API_KEY, value: var.AWS_API_KEY },
|
||||
{ name: DEV_GUILD_ID, value: var.DEV_GUILD_ID },
|
||||
{ name: BEEHIVE_ID, value: var.BEEHIVE_ID },
|
||||
]
|
||||
subnet_id = aws_subnet.crete_subnet.id
|
||||
tags = {
|
||||
Name = "Alpha Host"
|
||||
Description = "Docker host with chatbots mostly"
|
||||
}
|
||||
])
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
######################### ATTACHMENT FOR files.leftcoast.space #################
|
||||
resource "aws_volume_attachment" "photo_gallery_attach" {
|
||||
# hdp is for hard drive photos in this case
|
||||
device_name = "/dev/sdp"
|
||||
volume_id = aws_ebs_volume.photo_gallery_volume.id
|
||||
instance_id = aws_instance.alpha.id
|
||||
resource "aws_ecs_service" "lewdlad" {
|
||||
name = "lewdlad"
|
||||
cluster = aws_ecs_cluster.alpha.arn
|
||||
task_definition = aws_ecs_task_definition.lewdlad.arn
|
||||
desired_count = 1
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user