{"id":49571129,"url":"https://github.com/sagargupta16/devops-aws-farm","last_synced_at":"2026-05-03T14:03:41.224Z","repository":{"id":207198477,"uuid":"718662190","full_name":"Sagargupta16/DevOps-AWS-FARM","owner":"Sagargupta16","description":"A comprehensive DevOps automation framework for AWS infrastructure using Terraform, Docker, and CI/CD pipelines.","archived":false,"fork":false,"pushed_at":"2026-04-15T12:34:09.000Z","size":1261,"stargazers_count":3,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-04-15T14:20:31.074Z","etag":null,"topics":["aws","ci-cd","devops","docker","fastapi","github-actions","python","terraform"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Sagargupta16.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":["Sagargupta16"]}},"created_at":"2023-11-14T14:47:20.000Z","updated_at":"2026-04-15T12:13:28.000Z","dependencies_parsed_at":"2023-11-17T19:33:54.048Z","dependency_job_id":"97e229cb-c195-49e8-947f-49cfaca8f124","html_url":"https://github.com/Sagargupta16/DevOps-AWS-FARM","commit_stats":null,"previous_names":["sagargupta16/taskproject1"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Sagargupta16/DevOps-AWS-FARM","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sagargupta16%2FDevOps-AWS-FARM","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sagargupta16%2FDevOps-AWS-FARM/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sagargupta16%2FDevOps-AWS-FARM/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sagargupta16%2FDevOps-AWS-FARM/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Sagargupta16","download_url":"https://codeload.github.com/Sagargupta16/DevOps-AWS-FARM/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sagargupta16%2FDevOps-AWS-FARM/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32571456,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-03T06:36:36.687Z","status":"ssl_error","status_checked_at":"2026-05-03T06:36:09.306Z","response_time":103,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws","ci-cd","devops","docker","fastapi","github-actions","python","terraform"],"created_at":"2026-05-03T14:03:40.262Z","updated_at":"2026-05-03T14:03:41.213Z","avatar_url":"https://github.com/Sagargupta16.png","language":"Python","funding_links":["https://github.com/sponsors/Sagargupta16"],"categories":[],"sub_categories":[],"readme":"# DevOps-AWS-FARM\n\nA full-stack web application built with FastAPI, React, and MongoDB, containerized with Docker and deployed on AWS.\n\n## 🚀 Quick Start\n\n**⚠️ IMPORTANT: Before running the application, you MUST configure your database connection:**\n\n```bash\n# 1. Copy the secrets template\ncp config/secrets.yml.example config/secrets.yml\n\n# 2. Edit config/secrets.yml with your MongoDB Atlas credentials\n# 3. Then run the application\ndocker-compose up --build\n```\n\nFor detailed setup instructions, see [Getting Started](#getting-started) below.\n\n## Table of Contents\n\n- [Overview](#overview)\n- [Features](#features)\n- [Architecture](#architecture)\n- [Getting Started](#getting-started)\n  - [Prerequisites](#prerequisites)\n  - [Local Development Setup](#local-development-setup)\n  - [Docker Setup](#docker-setup)\n- [Running the Application](#running-the-application)\n  - [Development Mode](#development-mode)\n  - [Production Mode with Docker](#production-mode-with-docker)\n- [Testing](#testing)\n- [API Documentation](#api-documentation)\n- [Deployment](#deployment)\n- [Project Structure](#project-structure)\n- [Technologies](#technologies)\n- [Contributing](#contributing)\n\n## Overview\n\nDevOps-AWS-FARM is a modern full-stack web application that demonstrates DevOps best practices using the FARM stack (FastAPI, React, MongoDB). The application includes user and blog management features with a complete CI/CD pipeline for AWS deployment.\n\n## Features\n\n- **FastAPI Backend**: High-performance Python web framework with automatic API documentation\n- **React Frontend**: Modern React-based user interface\n- **MongoDB Integration**: NoSQL database for data persistence\n- **User Management**: User registration, authentication, and profile management\n- **Blog System**: Create, read, update, and delete blog posts\n- **Docker Support**: Containerized application for consistent deployment\n- **Test Coverage**: Comprehensive test suite with coverage reporting\n- **Code Quality**: Linting and formatting tools (Pylint, Flake8, Prettier)\n- **CI/CD Ready**: Docker Compose setup for easy deployment\n\n## Architecture\n\n### Application Architecture\n\n```\n┌─────────────────┐    ┌─────────────────┐    ┌─────────────────┐\n│   React Client  │───▶│  FastAPI Server │───▶│   MongoDB Atlas │\n│   (Frontend)    │    │   (Backend)     │    │   (Database)    │\n└─────────────────┘    └─────────────────┘    └─────────────────┘\n```\n\n### AWS Deployment Flow\n\n```\n┌─────────────────┐    ┌─────────────────┐    ┌─────────────────┐\n│   GitHub Repo   │───▶│   Amazon ECR    │───▶│   Amazon ECS    │\n│  (Source Code)  │    │ (Docker Images) │    │  (Containers)   │\n└─────────────────┘    └─────────────────┘    └─────────────────┘\n         │                       ▲                       │\n         │                       │                       │\n         ▼                       │                       ▼\n┌─────────────────┐              │              ┌─────────────────┐\n│ GitHub Actions  │──────────────┘              │ Application     │\n│    (CI/CD)      │                             │ Load Balancer   │\n└─────────────────┘                             └─────────────────┘\n```\n\n### CI/CD Workflow Diagram\n\n```\n┌─────────────┐\n│ Developer   │\n│ Push Code   │\n└──────┬──────┘\n       │\n       ▼\n┌─────────────┐\n│   GitHub    │\n│ Repository  │\n└──────┬──────┘\n       │\n       ▼\n┌─────────────┐    ┌─────────────┐    ┌─────────────┐\n│   GitHub    │───▶│  Run Tests  │───▶│    Build    │\n│   Actions   │    │  Coverage   │    │   Docker    │\n│  Triggered  │    │    80%+     │    │    Image    │\n└─────────────┘    └──────┬──────┘    └──────┬──────┘\n                          │                  │\n                          ▼                  ▼\n                 ┌─────────────┐    ┌─────────────┐\n                 │    Tests    │    │    Push     │\n                 │   Failed?   │    │   to ECR    │\n                 │    Stop     │    │             │\n                 └─────────────┘    └──────┬──────┘\n                                           │\n                                           ▼\n┌─────────────┐    ┌─────────────┐    ┌─────────────┐\n│   Health    │◀───│   Deploy    │◀───│   Update    │\n│   Check     │    │   to ECS    │    │ ECS Service │\n│             │    │             │    │             │\n└─────────────┘    └─────────────┘    └─────────────┘\n       │\n       ▼\n┌─────────────┐\n│ Application │\n│    Live     │\n│             │\n└─────────────┘\n```\n\n### CI/CD Process Steps\n\n1. **Code Push**: Developer pushes code to GitHub repository\n2. **GitHub Actions Trigger**: Workflow automatically starts on push to main branch\n3. **Run Tests**: Execute pytest with 80% coverage requirement\n4. **Test Gate**: If tests fail, deployment stops here\n5. **Build Docker Image**: Creates containerized version of the application (only if tests pass)\n6. **Push to ECR**: Uploads Docker image to Amazon Elastic Container Registry\n7. **Deploy to ECS**: Updates ECS service with new Docker image\n8. **Health Check**: Verifies application is running correctly\n9. **Go Live**: Application is accessible to users\n\n## Getting Started\n\n### Prerequisites\n\nBefore running this application, make sure you have the following installed:\n\n- **Python 3.11+**\n- **Node.js 16+** and **npm**\n- **MongoDB** (local or cloud instance)\n- **Docker** and **Docker Compose** (for containerized setup)\n- **Git**\n\n### Local Development Setup\n\n#### 1. Clone the Repository\n```bash\ngit clone https://github.com/Sagargupta16/DevOps-AWS-FARM.git\ncd DevOps-AWS-FARM\n```\n\n#### 2. Backend Setup\n\n**Create and activate Python virtual environment:**\n```bash\n# Windows\npython -m venv venv\nvenv\\Scripts\\activate\n\n# Linux/Mac\npython -m venv venv\nsource venv/bin/activate\n```\n\n**Install Python dependencies:**\n```bash\npip install --upgrade pip\npip install -r requirements.txt\n```\n\n**Configure MongoDB Connection (IMPORTANT):**\n\n⚠️ **Before running the application, you MUST configure your MongoDB connection:**\n\n1. **Copy the secrets template:**\n   ```bash\n   cp config/secrets.yml.example config/secrets.yml\n   ```\n\n2. **Update `config/secrets.yml` with your MongoDB Atlas credentials:**\n   ```yaml\n   mongodb:\n     host: your-cluster.mongodb.net\n     port: 27017\n     username: your-username\n     password: your-password\n     database: mongodb+srv://your-username:your-password@your-cluster.mongodb.net/your-database-name\n   ```\n\n3. **Get MongoDB Atlas credentials:**\n   - Go to [MongoDB Atlas](https://cloud.mongodb.com/)\n   - Create a cluster or use existing one\n   - Go to Database Access and create a database user\n   - Go to Network Access and whitelist your IP (or 0.0.0.0/0 for development)\n   - Click \"Connect\" on your cluster and choose \"Connect your application\"\n   - Copy the connection string and update the values in `secrets.yml`\n\n📝 **Note:** The `secrets.yml` file is ignored by git for security. Never commit database credentials to version control.\n\n#### 3. Frontend Setup\n\n**Navigate to client directory and install dependencies:**\n```bash\ncd client\nnpm install\n```\n\n**Build the React application:**\n```bash\nnpm run build\n```\n\nThis will create the `client_build` directory that the FastAPI server serves.\n\n### Docker Setup\n\n**⚠️ IMPORTANT: Configure secrets before running Docker!**\n\nBefore using Docker, make sure to configure your MongoDB connection:\n\n```bash\n# Copy the secrets template\ncp config/secrets.yml.example config/secrets.yml\n# Edit config/secrets.yml with your MongoDB Atlas credentials\n```\n\nFor a quick setup using Docker:\n\n```bash\n# Build and run with Docker Compose\ndocker-compose up --build\n```\n\nThis will:\n- Build the application image\n- Run tests with coverage requirements (80%+)\n- Start the application on port 8000\n\n## Running the Application\n\n### Development Mode\n\n#### Option 1: Using VS Code Task (Recommended)\nIf you're using VS Code, you can use the built-in task:\n1. Press `Ctrl+Shift+P` (Windows) or `Cmd+Shift+P` (Mac)\n2. Type \"Tasks: Run Task\"\n3. Select \"Start FastAPI Development Server\"\n\n#### Option 2: Manual Command\n```bash\n# Make sure you're in the project root and virtual environment is activated\nuvicorn main:app --reload --port 8000\n```\n\n#### Option 3: Frontend Development Server (for React development)\n```bash\ncd client\nnpm start\n```\nThis runs React dev server on `http://localhost:3000`\n\n### Production Mode with Docker\n\n```bash\n# Build and run the production container\ndocker-compose up --build -d\n\n# View logs\ndocker-compose logs -f\n\n# Stop the application\ndocker-compose down\n```\n\n## Testing\n\n### Run Tests Locally\n```bash\n# Run all tests\npytest\n\n# Run tests with coverage\ncoverage run -m pytest\ncoverage report\ncoverage html  # Generate HTML coverage report\n```\n\n### Run Tests in Docker\n```bash\n# Tests are automatically run during Docker Compose build\ndocker-compose up tests\n```\n\nThe application requires **80% test coverage** to pass the build process.\n\n## API Documentation\n\nOnce the FastAPI server is running, you can access:\n\n- **Interactive API Documentation (Swagger UI)**: `http://localhost:8000/docs`\n- **Alternative API Documentation (ReDoc)**: `http://localhost:8000/redoc`\n- **OpenAPI JSON Schema**: `http://localhost:8000/openapi.json`\n\n### Available Endpoints\n\n- **User Routes**: `/users/*` - User management and authentication\n- **Blog Routes**: `/blogs/*` - Blog post CRUD operations\n- **Frontend**: `/` - Serves the React application\n\n## Deployment\n\n### AWS Deployment with GitHub Actions\n\nThe application automatically deploys to AWS when code is pushed to the main branch:\n\n**Docker Image → ECR → ECS**\n\n#### GitHub Actions Workflow\n\nThe `.github/workflows/deploy.yml` file contains the deployment pipeline:\n\n```yaml\n# 1. Run Tests First\n- name: Run tests with coverage\n  run: python -m pytest tests/ --cov=. --cov-report=xml --cov-fail-under=80\n\n# 2. Build Docker Image (only if tests pass)\n- name: Build Docker image\n  run: docker build -t devops-aws-farm .\n\n# 3. Push to Amazon ECR\n- name: Push to ECR\n  run: |\n    aws ecr get-login-password --region $AWS_REGION | docker login --username AWS --password-stdin $ECR_REGISTRY\n    docker tag devops-aws-farm:latest $ECR_REGISTRY/$ECR_REPOSITORY:latest\n    docker push $ECR_REGISTRY/$ECR_REPOSITORY:latest\n\n# 4. Deploy to Amazon ECS\n- name: Deploy to ECS\n  run: |\n    aws ecs update-service --cluster $ECS_CLUSTER --service $ECS_SERVICE --force-new-deployment\n    aws ecs wait services-stable --cluster $ECS_CLUSTER --services $ECS_SERVICE\n```\n\n#### Required GitHub Secrets\n\nAdd these secrets in your GitHub repository settings:\n\n```\nAWS_ACCESS_KEY_ID          # AWS access key\nAWS_SECRET_ACCESS_KEY      # AWS secret key  \nAWS_REGION                 # AWS region (e.g., us-east-1)\nECR_REPOSITORY_URI         # ECR repository URI\nECS_CLUSTER_NAME           # ECS cluster name\nECS_SERVICE_NAME           # ECS service name\n```\n\n#### Manual Deployment Commands\n\nFor manual deployment, use these commands:\n\n```bash\n# 1. Build and tag Docker image\ndocker build -t devops-aws-farm .\ndocker tag devops-aws-farm:latest your-account.dkr.ecr.us-east-1.amazonaws.com/devops-aws-farm:latest\n\n# 2. Login to ECR and push image\naws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin your-account.dkr.ecr.us-east-1.amazonaws.com\ndocker push your-account.dkr.ecr.us-east-1.amazonaws.com/devops-aws-farm:latest\n\n# 3. Update ECS service\naws ecs update-service --cluster your-cluster --service your-service --force-new-deployment\n```\n\n## Project Structure\n\n```\nDevOps-AWS-FARM/\n├── .github/\n│   └── workflows/\n│       └── deploy.yml     # GitHub Actions CI/CD pipeline\n├── client/                # React frontend application\n│   ├── src/               # React source code\n│   ├── public/            # Static assets\n│   └── package.json       # Node.js dependencies\n├── client_build/          # Built React app (served by FastAPI)\n├── config/                # Configuration files\n│   ├── secrets.yml.example # Template for MongoDB credentials\n│   ├── secrets.yml        # Your actual MongoDB credentials (git-ignored)\n│   ├── logging.py         # Logging configuration\n│   └── secrets_parser.py  # Configuration parser\n├── models/                # Pydantic data models\n│   ├── blog_models.py     # Blog-related models\n│   └── user_models.py     # User-related models\n├── routes/                # FastAPI route handlers\n│   ├── blog_routes.py     # Blog API endpoints\n│   └── user_routes.py     # User API endpoints\n├── services/              # Business logic layer\n│   ├── blog_services.py   # Blog operations\n│   └── user_services.py   # User operations\n├── tests/                 # Test suite\n├── utils/                 # Utility functions\n│   └── hashing.py         # Password hashing utilities\n├── main.py                # FastAPI application entry point\n├── requirements.txt       # Python dependencies\n├── Dockerfile             # Docker image definition\n├── docker-compose.yml     # Multi-container setup\n└── README.md             # This file\n```\n\n## Technologies\n\n### Backend\n- **FastAPI**: Modern, high-performance Python web framework\n- **Uvicorn**: ASGI server for running FastAPI\n- **Pydantic**: Data validation using Python type annotations\n- **PyMongo**: MongoDB driver for Python\n- **Passlib \u0026 Bcrypt**: Password hashing and verification\n- **PyYAML**: YAML configuration file support\n\n### Frontend\n- **React 19**: JavaScript library for building user interfaces\n- **React Scripts**: Build tools and development server\n\n### Testing \u0026 Quality\n- **Pytest**: Testing framework\n- **Coverage**: Code coverage measurement\n- **Pylint**: Python code linting\n- **Flake8**: Style guide enforcement\n- **Prettier**: Code formatting for JavaScript\n- **ESLint**: JavaScript/React linting\n\n### DevOps \u0026 Deployment\n- **Docker**: Containerization platform\n- **Docker Compose**: Multi-container orchestration\n- **AWS ECR**: Container registry\n- **GitHub Actions**: CI/CD pipeline (configurable)\n\n### Database\n- **MongoDB**: NoSQL document database\n\n## Contributing\n\n1. Fork the repository\n2. Create a feature branch (`git checkout -b feature/new-feature`)\n3. Make your changes\n4. Run tests (`pytest`) and ensure coverage is above 80%\n5. Run linting (`flake8` and `pylint`)\n6. Commit your changes (`git commit -am 'Add new feature'`)\n7. Push to the branch (`git push origin feature/new-feature`)\n8. Create a Pull Request\n\n### Code Style\n- Python: Follow PEP 8 guidelines\n- JavaScript: Use Prettier for formatting\n- Ensure all tests pass and maintain test coverage above 80%\n\n## Troubleshooting\n\n### Common Issues\n\n1. **Port 8000 already in use:**\n   ```bash\n   # Windows\n   netstat -ano | findstr :8000\n   taskkill /PID \u003cPID\u003e /F\n   \n   # Linux/Mac\n   lsof -ti:8000 | xargs kill -9\n   ```\n\n2. **MongoDB connection issues:**\n   - Ensure MongoDB is running\n   - Check connection string in `config/secrets.yml`\n   - Verify network accessibility\n\n3. **Dependencies issues:**\n   ```bash\n   # Update pip and reinstall requirements\n   pip install --upgrade pip\n   pip install -r requirements.txt --force-reinstall\n   ```\n\n### Support\n\nFor issues and questions:\n- Create an issue on GitHub\n- Check existing documentation and issues\n- Review the API documentation at `/docs` endpoint\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsagargupta16%2Fdevops-aws-farm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsagargupta16%2Fdevops-aws-farm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsagargupta16%2Fdevops-aws-farm/lists"}