Python Web App CI/CD Using Github Actions and AWS EC2 | Deploy Langchain Flask Django App On Server

Поділитися
Вставка
  • Опубліковано 3 гру 2024

КОМЕНТАРІ • 5

  • @utkarshagrawal-t4w
    @utkarshagrawal-t4w 9 місяців тому +1

    thanks for the guide its working but i want to ask do we really have to delete the whole project and recopy it everytime we push what if project is big and change is very small do we still have to do the same process or there is any other efficient way

    • @TrickSumo
      @TrickSumo  9 місяців тому +2

      Hi
      In GitHub action, "rsync" command can be used instead of "src" (line 37 of deploy.yaml):-
      rsync -avz --delete ./ $EC2_USERNAME@$EC2_HOST:/var/www/langchain-app
      After that "sudo mv * /var/www/langchain-app" command from bash script can be removed:- github.com/TrickSumo/langchain-course-python/blob/16-CICD-PYTHON-WEBAPP/deploy.sh#L10

  • @EVM-YT
    @EVM-YT 7 місяців тому +1

    Does this require you to push the generated .env file to your github repo?

    • @TrickSumo
      @TrickSumo  7 місяців тому

      No, env variables are stored as GitHub repo environment secret. ua-cam.com/video/W8tONeBuTn0/v-deo.html
      These secrets are used to create .env file dynamically.
      So your keys are never exposed publically.

  • @TrickSumo
    @TrickSumo  9 місяців тому

    Home Work hint =>
    1. To get instance IP address in the bash script, use:-
    curl 169.254.169.254/latest/meta-data/public-ipv4
    (make sure to do:- EC2 instance >> Instance settings >> Modify instance metadata options >> IMDSv2 >> Optional)
    2. Use "sed" Linux command to search and replace IP address in the "index.html"