To:
- Build and deploy a container (Flask application) to an Azure Web App
- Build a Flask project with a REST API
- Handle HTTP requests with Connexion
- Define API endpoints using the OpenAPI specification
- Interact with my API to manage data
- Build API documentation with Swagger UI and Connexion
- Configure a SQLite database for my Flask project
- Use SQLAlchemy to save Python objects to my database
- Leverage the Marshmallow library to serialize data
Provides access to a collection of people and to the individuals within that collection.
Action | HTTP Verb | URL Path | Description |
---|---|---|---|
Read | GET | /api/people | Read information on people |
Create | POST | /api/people | Create a new person's data |
Read | GET | /api/people/ | Read information on a person |
Update | PUT | /api/people/ | Update a person's information |
Delete | DELETE | /api/people/ | Delete a person's inforrmation |
-
There is a branch protection rule set for the main branch - you cannot push directly to the main branch.
-
In the CI pipeline, unless all tests run successfully, you cannot merge code into the main branch. Resources: Test Routes
- Activate virtual environment and install dependencies
$ python -m venv venv
$ source venv/bin/activate
$ pip install -r requirements.txt
- Run project
$ python run.py
- Dockerizing the Application
$ docker image build -t <image-name> .
$ docker push <repo>/<image-name>
$ docker run -p port:port -d <image-name>
- To pull the container from Dockerhub
$ docker pull mbaoma/note-app
$ docker run -p port:port -d <image-name>
-
Push your container to Azure Registry
-
Create a web app under the Azure app services panel.
- Select what container registry your container is hosted in
-
Create the web app and wait a while before checking the logs, to determine the state of your container.
-
Navigate to your app's URL to view the eployed application
https://brandnew7.azurewebsites.net/
-- /api/ui (swagger UI)
https://brandnew7.azurewebsites.net/api/ui/
You need to have minikube running
$ minikube start
OR
-
Enable kubernetes on your Docker Desktop before running the next couple of commands.
-
Feed the config files to kubectl
$ kubectl apply -f simplek8s/file-name.yaml
$ kubectl apply -f simplek8s/file-name.yaml
- Print the status of all running pods and services
$ kubectl get pods
$ kubectl get services
- Navigate to
$ minikube service <service-name> --url
$ kubectl describe svc <service-name>