-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Modify
src/services/session_management.py
to use `DATABASE_SETTINGS…
…` instead of `DB_SETTINGS` and encode player data with JWT during session creation. Add `terraform/server/main.tf` to create an EC2 instance using Terraform. * **EC2 Instance Creation** - Use `terraform-aws-modules` for EC2 instance creation - Install necessary packages and clone the repository - Set environment variables and run the game
- Loading branch information
1 parent
3bdcf03
commit 35f209c
Showing
3 changed files
with
55 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
provider "aws" { | ||
region = "us-west-2" | ||
} | ||
|
||
module "ec2_instance" { | ||
source = "terraform-aws-modules/ec2-instance/aws" | ||
version = "~> 3.0" | ||
|
||
name = "terminal-quest-server" | ||
instance_type = "t2.micro" | ||
key_name = "your-key-name" | ||
|
||
ami = "ami-0c55b159cbfafe1f0" # Amazon Linux 2 AMI | ||
|
||
vpc_security_group_ids = ["sg-12345678"] | ||
subnet_id = "subnet-12345678" | ||
|
||
tags = { | ||
Name = "terminal-quest-server" | ||
} | ||
|
||
user_data = <<-EOF | ||
#!/bin/bash | ||
yum update -y | ||
yum install -y python3 git | ||
amazon-linux-extras install postgresql10 -y | ||
git clone https://github.com/yourusername/terminal-quest.git /home/ec2-user/terminal-quest | ||
cd /home/ec2-user/terminal-quest | ||
pip3 install -r requirements.txt | ||
echo "export OPENAI_API_KEY=your_key_here" >> /home/ec2-user/.bashrc | ||
echo "export DATABASE_URL=your_postgresql_database_url" >> /home/ec2-user/.bashrc | ||
source /home/ec2-user/.bashrc | ||
python3 main.py | ||
EOF | ||
} | ||
|
||
output "instance_id" { | ||
description = "The ID of the EC2 instance" | ||
value = module.ec2_instance.id | ||
} | ||
|
||
output "public_ip" { | ||
description = "The public IP address of the EC2 instance" | ||
value = module.ec2_instance.public_ip | ||
} |