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

Update app.py #3

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
15 changes: 7 additions & 8 deletions .github/workflows/service-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- main

env:
EC2_PUBLIC_IP: X.X.X.X # TODO replace to your EC2 instance public IP
EC2_PUBLIC_IP: ec2-51-21-134-141.eu-north-1.compute.amazonaws.com # TODO replace to your EC2 instance public IP
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} # TODO define this secret in your GitHub repo settings

jobs:
Expand All @@ -20,16 +20,15 @@ jobs:
- name: SSH to EC2 instance
run: |
echo "$SSH_PRIVATE_KEY" > mykey.pem
chmod 400 mykey.pem
chmod 600 mykey.pem

# Copy the files from the current work dir into the EC2 instance, under `~/app`.
scp -o StrictHostKeyChecking=no -i mykey.pem -r * ubuntu@$EC2_PUBLIC_IP:~/app
# Copy the files from the current work dir into the EC2 instance, under ~/app.
scp -o StrictHostKeyChecking=no -i mykey.pem -r * ubuntu@$EC2_PUBLIC_IP:~/NetflixMovieCatalog/

# Connect to your EC2 instance and execute the `deploy.sh` script (this script is part of the repo files).
# TODO You need to implement the `deploy.sh` script yourself.
# Connect to your EC2 instance and execute the deploy.sh script (this script is part of the repo files).
# TODO You need to implement the deploy.sh script yourself.
#
# Upon completion, the NetflixMovieCatalog app should be running with its newer version.
# To keep the app running in the background independently on the terminal session you are logging to, configure it as a Linux service.

ssh -i mykey.pem ubuntu@$EC2_PUBLIC_IP "bash ~/app/deploy.sh"

ssh -i mykey.pem ubuntu@$EC2_PUBLIC_IP "bash ~/NetflixMovieCatalog/deploy.sh"
27 changes: 27 additions & 0 deletions Madhav_Day2.pem
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
-----BEGIN RSA PR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YBONxuuO27GCMNkCXRCYnVq
BNXQ9gZcKmKghoizWEwdA2ByULp6rCRs518paV+BmFpOeQWJLgRMVsPfYqTWKJ9L
WAROrXIfFWS+o/EI0qCpggfAIUN1YUOL200PYLsTFoCvLXSAS+r9Voo9Zb9qKMm9
wvES6kEHYjJjdKFnsD9lYQKBgQCQlLC8y9HJFhQOIWdhjDEu9OMYxodegukFGN8I
CkVC/XHITTvXva4zypT7yO9crVM2ML5tzahPzOGnUBYnIFHYO8KRylB2qjgkPcNF
QKtHfCrtV2bwQnmqnPb7Yl3cpA9cA3FwY7Qg4VWL0vmPST32a6lSqAVX6nKwHrMv
k71ELQKBgQC8czKBDMRskAN24A4iuyQZ3zMq1DF9TO5Z75eLmfMw7aMj17aFeVz3
5lQB2xgb8JH0OtYeuPSUxQbxQBYRcG6cclIXrlyoUIs5zJI+jRzX1Zq1FJkszAi/
rZixwnLprNJ5K1qqOP3P766YECtFI6yWh+HSE+zCxNZvKYSwNMeCOg==
-----END RSA PRIVATE KEY-----
2 changes: 1 addition & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

@app.route("/", methods=['GET'])
def home():
return "Hi! This app is an API, there is no UI ;-)"
return "Hlw !!! This app is an API, there is no UI sgs2006 ;-)"


@app.route('/discover')
Expand Down
20 changes: 18 additions & 2 deletions deploy.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
#!/bin/bash
sudo apt update

# TODO your deploy script implementation...
cd ./NetflixMovieCatalog

source .venv/bin/activate

cd ..

sudo systemctl stop simplepy.service

sudo systemctl enable simplepy.service

sudo systemctl start simplepy.service

sudo apt update

sudo systemctl start nginx

sudo apt update