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

change ec2 security group, fix proxy tpl file name #33

Merged
merged 1 commit into from
Mar 2, 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
12 changes: 10 additions & 2 deletions deploy/ec2.tf
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,16 @@ resource "aws_instance" "jukebox_server" {
HOST = var.SERVER__HOST
JWT_SECRET_KEY = var.SERVER__JWT_SECRET_KEY
TOKEN_HEADER_KEY = var.SERVER__TOKEN_HEADER_KEY
MONGO_URI = var.SERVER__MONGO_URI
MONGO_URI = "mongodb://${var.DB__MONGO_USER}:${var.DB__MONGO_PASSWORD}@mongodb:27017"
SP_ID = var.SERVER__SP_ID
SP_SECRET = var.SERVER__SP_SECRET
MONGO_USER = var.DB__MONGO_USER
MONGO_PASSWORD = var.DB__MONGO_PASSWORD
} })
key_name = var.ssh_key_name
user_data_replace_on_change = true

subnet_id = aws_subnet.public_a.id
subnet_id = aws_subnet.public_a.id
vpc_security_group_ids = [
aws_security_group.jukebox_server.id
]
Expand All @@ -82,6 +84,12 @@ resource "aws_security_group" "jukebox_server" {
to_port = 22
cidr_blocks = ["0.0.0.0/0"]
}
ingress {
protocol = "tcp"
from_port = 80
to_port = 80
cidr_blocks = ["0.0.0.0/0"]
}

egress {
protocol = "tcp"
Expand Down
2 changes: 1 addition & 1 deletion deploy/templates/ec2/server-setup.sh.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ sudo chmod +x /usr/local/bin/docker-compose

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

cd ~
# cd ~

sudo yum install -y git
git clone https://github.com/ufosc/Jukebox-Server.git /home/ec2-user/Jukebox-Server
Expand Down
15 changes: 12 additions & 3 deletions deploy/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,22 @@ variable "SERVER__JWT_SECRET_KEY" {
variable "SERVER__TOKEN_HEADER_KEY" {
default = "Authorization"
}
variable "SERVER__MONGO_URI" {
default = "mongodb://root:changeme@mongo-jukebox:27017"
}
#
variable "SERVER__SP_ID" {
description = "Spotify App ID"
}
variable "SERVER__SP_SECRET" {
description = "Spotify App Secret"
}

variable "DB__MONGO_USER" {
description = "MongoDB Username"
}
variable "DB__MONGO_PASSWORD" {
description = "MongoDB Password"
}

# variable "SERVER__MONGO_URI" {
# default = "mongodb://${var.DB__MONGO_USER}:${var.DB__MONGO_PASSWORD}@mongodb:27017"
# }

2 changes: 1 addition & 1 deletion proxy/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM nginxinc/nginx-unprivileged:1-alpine
LABEL maintainer="[email protected]"

COPY ./default.conf /etc/nginx/default.conf
COPY ./default.conf.tpl /etc/nginx/default.conf.tpl
COPY ./entrypoint.sh /entrypoint.sh

USER root
Expand Down
2 changes: 1 addition & 1 deletion proxy/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

set -e

envsubst < /etc/nginx/default.conf > /etc/nginx/conf.d/default.conf
envsubst < /etc/nginx/default.conf.tpl > /etc/nginx/conf.d/default.conf
nginx -g 'daemon off;'