Skip to content

Latest commit

 

History

History
64 lines (41 loc) · 2.14 KB

README.md

File metadata and controls

64 lines (41 loc) · 2.14 KB

DevOps-Cloud Python-Sample-app CI Project

Python Language NGINX Docker

A sample project (skeleton) to practice DevOps CI/CD pipelines.

Pre-requisites

This starter project uses python, NGINX and docker as application and CI tools to create a container.

If you do not have installed locally, please follow these instructions:

Installation

To use this starter project:

  • Clone this repo to a local directory
git clone https://github.com/CodingBlackFemales/python-nginx-app.git
cd python-nginx-app

Development

  • Update file by updating the return tag on line 6 in the .py extension file to update the contents on the webpage.

For example, in app-1 folder, app-1.py line can be modified to:

return '<h1>Viv  is Coding Black Females - DevOps Course - <<replace with your name>> App-1 :) </h1>'

Local Testing

The Compose file is a YAML file defining services, networks, and volumes for a Docker application.

Once the updated is completed, run the command below:

bash docker compose -f "docker-compose.yaml" up -d --build

  • This creates a three images, App-1, App-2, Nginx to deploys them as containers.
  • The applications can be access at localhost:8080 which is an nginx loadbalanced endpoint which will show either applcation.

bash docker compose -f "docker-compose.yaml" down

  • Destroys the cluster by removing all containers.

bash curl localhost:8080

  • curl is a tool to transfer data from or to a server and supports protocols such as HTTP,HTTPS, FTP,etc.

Troubleshooting

  • If docker-compose up fails:
    • it might be because docker is not running
    • open docker desktop, wait to docker to become ready
    • run docker compose -f "docker-compose.yaml" down then docker compose -f "docker-compose.yaml" up -d --build