Skip to content

Commit

Permalink
separated files for reply
Browse files Browse the repository at this point in the history
  • Loading branch information
proquickly committed Nov 14, 2024
1 parent 544614a commit cf058b8
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 12 deletions.
6 changes: 6 additions & 0 deletions bin/deploy
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh
cd /app
git clone [email protected]:proquickly/tfgha.git
cd ./tfgha
poetry install
poetry shell && poetry run src/thgha/app.py
8 changes: 8 additions & 0 deletions src/tfgha/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from flask import Flask
app = Flask(__name__)

@app.route('/')
def hello():
return "Hello from Python!"
if __name__ == '__main__':
app.run(host='0.0.0.0', port=5000)
17 changes: 5 additions & 12 deletions terraform/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,13 @@ resource "aws_instance" "py_server" {
user_data = <<-EOF
#!/bin/bash
yum update -y
yum install -y python3 python3-pip
yum install -y python3 python3-pip git curl
curl -sSL https://install.python-poetry.org | python3 -
export PATH="$HOME/.local/bin:$PATH"
mkdir /app
cat <<EOT > /app/app.py
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello():
return "Hello from Python!"
if __name__ == '__main__':
app.run(host='0.0.0.0', port=5000)
EOT
pip3 install flask
python3 /app/app.py &
chmod +x ./bin/deploy
./bin/deploy
EOF

tags = {
Expand Down

0 comments on commit cf058b8

Please sign in to comment.