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

Feature/refactor jan #28

Merged
merged 3 commits into from
Feb 1, 2024
Merged
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
1 change: 0 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

# Show only the files we need
!src/
!test/
!package.json
!package-lock.json
!tsconfig.json
Expand Down
1 change: 0 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ FROM setup as build
COPY ./src ./src

RUN npm run build


EXPOSE 8000

Expand Down
27 changes: 25 additions & 2 deletions deploy/ec2.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,31 @@ is the easiest resource to create in AWS, and will only need:
###################################################
# SETUP SCRIPT - Configure EC2 Server for Project #
###################################################
# TODO: Import setup script
# TODO: Pass in necessary env variables
data "aws_ami" "amzn_linux_2" {
most_recent = true
owners = ["amazon"]

filter {
name = "name"
values = ["amzn2-ami-kernel-5.10-hvm-2.*"]
}

filter {
name = "architecture"
values = ["x86_64"]
}
}

resource "aws_instance" "jukebox_server" {
ami = data.aws_ami.amzn_linux_2.id
instance_type = "t3.micro"
user_data = file("./templates/ec2/server-setup.sh")

tags = merge(
local.common_tags,
tomap({ Name = "${local.prefix}-server" })
)
}

##########################################
# EC2 INSTANCE - Host Server Application #
Expand Down
2 changes: 1 addition & 1 deletion deploy/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ terraform {
}

provider "aws" {
region = "us-east-1"
region = "us-east-2"
}

locals {
Expand Down
22 changes: 16 additions & 6 deletions deploy/templates/ec2/server-setup.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
#!/bin/sh
# SETUP SCRIPT - Used to set up EC2 Server

set -e

# TODO: Install docker
# TODO: Install docker-compose
# TODO: Pull image from Docker Hub
# TODO: Build and run project with compose
sudo yum update -y

sudo amazon-linux-extras install -y docker
sudo systemctl enable docker.service
sudo systemctl start docker.service

sudo yum install docker-compose

sudo usermod -aG docker ec2-user # Add user to "docker" group for permissions

sudo yum install git
git clone https://github.com/ufosc/Jukebox-Server.git

docker-compose -f ./Jukebox-Server/docker-compose.yml build
docker-compose -f ./Jukebox-Server/docker-compose.yml up -d

Loading