This project is an application in Python 3.11, with the function of training the development of a pipeline for the deployment of any changes made in the "main" branch, with a trigger to update an EC2 instance in the AWS cloud.
python3 pet_info.py
- Add new pets with name, breed, age, weight and vaccination information.
- View information about registered pets.
- Python: Programming language used to develop the application.
- Flask: Web framework used to create the application.
- Gunicorn: WSGI HTTP server to serve the application.
- AWS: Cloud used to host the application.
- Github Actions: Tool used to create the deployment pipeline.
- Python 3.11
- Pip
- Virtualenv
- Clone the repository
git clone [email protected]:LuizCampedelli/Projeto_Api_Pet_ADA_Final.git
- Create a virtual environment
python3 -m venv myvenv
source myvenv/bin/activate
- Install the dependencies
pip install -r requirements.txt
- Run the application in the CLI
python3 pet_info.py
- Access the application in the browser
gunicorn --bind 0.0.0.0:5000 app:app
- Access the application in the browser
http://localhost:5000
- Create an AWS account and configure programmatic access.
- Create an EC2, with an SSH key, download the key to a safe location.
- Create a Security Group for the EC2, with ports 22 and 5000 open.
- Add the secrets in the various actions secrets in the repository's Settings tab, with the following keys:
- AWS_ACCESS_KEY_ID
- AWS_SECRET_ACCESS_KEY
- AWS_REGION
- EC2_IP
- EC2_PRIVATE_KEY
-
Push to the "main" branch and watch the deployment pipeline run.
-
Access the application from browser
http://<EC2_IP>:5000
- If you want to make changes without triggering the deploy, commit like this:
git commit -m 'feat/feature_name [skip actions]'
- [skip ci]
- [ci skip]
- [no ci]
- [skip actions]
- [actions skip]
git commit -m "Update docs [skip ci]"
git commit -m "Fix typo [ci skip]"
git commit -m "Minor change [no ci]"
git commit -m "Change config [skip actions]"
git commit -m "Update dependencies [actions skip]"
- If you don't want to send the README and docs files to the deploy, add them to your deploy:
on:
push:
branches:
- main
paths-ignore:
- 'docs/**'
- 'README.md'
This project is licensed under the MIT License. See the LICENSE for more information.
- Follow the guidelines in CONTRIBUTING.md