Skip to content

nacholiya/devops-project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DevOps Project

This project demonstrates a simple Python Flask application containerized with Docker and deployed using Terraform.

Key Features & Benefits

  • Containerization: The application is packaged using Docker for consistent execution across different environments.
  • Infrastructure as Code (IaC): Terraform is used to provision and manage the infrastructure required for deployment.
  • Simple Web Application: A basic "Hello World" Flask application serves as a starting point.
  • Remote State Management: Terraform state is stored remotely for collaboration and consistency.
  • Continuous Integration: A Jenkinsfile is provided for potential integration with a CI/CD pipeline.

Prerequisites & Dependencies

Before you begin, ensure you have the following installed:

Installation & Setup Instructions

  1. Clone the repository:

    git clone <repository_url>
    cd devops-project
  2. Build the Docker image:

    docker build -t devops-app .
  3. Run the Docker container (optional - for local testing):

    docker run -p 5000:5000 devops-app

    Visit http://localhost:5000 in your browser to see the application.

  4. Initialize Terraform:

    cd Terraform
    ./install-dependencies.sh
    terraform init -backend-config="Remote-backend/s3.tf" -reconfigure

    Note: You need to setup s3 bucket and dynamo db as specified in Terraform/Remote-backend folder. Please check the documentation here.

    • Ensure you have an AWS S3 bucket and DynamoDB table configured for Terraform remote state management as defined in Terraform/Remote-backend/s3.tf and Terraform/Remote-backend/dynamodb.tf. Replace the placeholder values in these files with your actual bucket name and DynamoDB table name.
    • AWS Credentials must be properly configured using aws configure.
  5. Apply Terraform Configuration:

    terraform apply

    Confirm the changes by typing yes when prompted. Terraform will provision the infrastructure on AWS.

Usage Examples & API Documentation

The application exposes a single endpoint at the root path (/).

  • Endpoint: /
  • Method: GET
  • Response: "Hello bhai from Docker on AWS!"

After deploying the infrastructure with Terraform, you can access the application at the public IP address of the EC2 instance created. The public IP address will be displayed in the Terraform output.

Configuration Options

  • app.py: The Flask application code can be modified to implement custom logic.
  • Dockerfile: Customize the Docker image build process by modifying the Dockerfile.
  • terraform.tfvars: (Not included, but recommended) Define variables such as instance type, region, and security group rules in a terraform.tfvars file to avoid hardcoding them in the Terraform files. This is best practice.
  • Terraform Variables: Adjust variables defined in main.tf as needed to customize the infrastructure (e.g., instance type, AMI). Remember to update the variables in terraform.tfvars file or through -var option.

Contributing Guidelines

  1. Fork the repository.
  2. Create a new branch for your feature or bug fix.
  3. Make your changes and commit them with descriptive messages.
  4. Submit a pull request.

License Information

Acknowledgments

  • This project utilizes the following open-source software:
    • Python
    • Flask
    • Docker
    • Terraform

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published