Skip to content

Commit

Permalink
Merge pull request #1 from prasadhonrao/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
sakharesoham authored Sep 30, 2024
2 parents 047ed08 + f805921 commit a4c83fc
Show file tree
Hide file tree
Showing 170 changed files with 16,047 additions and 701 deletions.
27 changes: 27 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
## Description

Please include a summary of the changes and the purpose of this pull request.

- **Related Issues:** (Link any issues this PR addresses, e.g., `Fixes #123` or `Closes #456`)
- **Type of change:**
- [ ] Bug fix
- [ ] New feature
- [ ] Improvement
- [ ] Documentation update

## Checklist

- [ ] My code follows the style guidelines of this project.
- [ ] I have performed a self-review of my code.
- [ ] I have commented on my code, particularly in hard-to-understand areas.
- [ ] I have made corresponding changes to the documentation.
- [ ] I have added tests that prove my fix is effective or that my feature works.
- [ ] All new and existing tests passed.

## Screenshots (if applicable)

Please provide screenshots or videos of the new behavior or changes (if applicable).

## Additional Information

Include any other relevant information or context here.
81 changes: 81 additions & 0 deletions .github/workflows/api-cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: API - Continuous Deployment

on:
push:
branches:
- main
paths:
- 'api/**'
workflow_dispatch:

env:
DOCKER_IMAGE: prasadhonrao/devcamper-api
AZURE_WEBAPP_NAME: devcamperapi

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Log in to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build and push Docker image
run: |
docker build -t ${{ env.DOCKER_IMAGE }}:${{ github.sha }} -f api/Dockerfile api
docker tag ${{ env.DOCKER_IMAGE }}:${{ github.sha }} ${{ env.DOCKER_IMAGE }}:latest
docker push ${{ env.DOCKER_IMAGE }}:${{ github.sha }}
docker push ${{ env.DOCKER_IMAGE }}:latest
deploy:
runs-on: ubuntu-latest
needs: build

steps:
- name: Log in to Azure
uses: azure/login@v2
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}

- name: Deploy to Azure Web App
uses: azure/webapps-deploy@v2
with:
app-name: ${{ env.AZURE_WEBAPP_NAME }}
images: '${{ env.DOCKER_IMAGE }}:latest'

notify:
runs-on: ubuntu-latest
needs: deploy
if: always()

steps:
- name: Send email notification
uses: dawidd6/action-send-mail@v3
with:
server_address: smtp.gmail.com
server_port: 587
username: ${{ secrets.GMAIL_USERNAME }}
password: ${{ secrets.GMAIL_PASSWORD }}
subject: '${{ job.status }}: Deployment Notification'
body: |
The deployment has ${{ job.status }}!
Repository: ${{ github.repository }}
Branch: ${{ github.ref }}
Commit: ${{ github.sha }}
Author: ${{ github.actor }}
Workflow: ${{ github.workflow }}
Job: ${{ github.job }}
Run ID: ${{ github.run_id }}
Run Number: ${{ github.run_number }}
Logs: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
to: ${{ secrets.NOTIFY_EMAIL }}
from: ${{ secrets.GMAIL_USERNAME }}
129 changes: 129 additions & 0 deletions .github/workflows/api-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
name: API - Continuous Integration

on:
push:
branches:
- development
paths:
- 'api/**'
pull_request:
branches:
- development
paths:
- 'api/**'
workflow_dispatch:

jobs:
lint:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Install dependencies
run: npm install --prefix api

- name: Run linter
run: |
export PATH=$(pwd)/api/node_modules/.bin:$PATH
npm run lint --prefix api
dependency-check:
runs-on: ubuntu-latest
needs: lint

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Install dependencies
run: npm install --prefix api

- name: Run dependency check
run: npm audit --audit-level=high --prefix api

security:
runs-on: ubuntu-latest
needs: dependency-check
permissions:
actions: read
contents: read
security-events: write

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Install dependencies
run: npm install --prefix api

- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: javascript

- name: Autobuild
uses: github/codeql-action/autobuild@v2

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2

test:
runs-on: ubuntu-latest
needs: security

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Install dependencies
run: npm install --prefix api

- name: Run tests
run: npm test --prefix api

code-coverage:
runs-on: ubuntu-latest
needs: test

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Install dependencies
run: npm install --prefix api

- name: Run tests with coverage
run: npm run test --prefix api -- --coverage

- name: Upload coverage report
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: api/coverage
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"cSpell.words": [
"bootcamp",
"bootcamps",
"devcamper",
"dsphere",
"Geocoder",
"mapquest",
Expand Down
8 changes: 4 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Contributing to MERN Bootcamp
# Contributing to DevCamper

We welcome contributions to the MERN Bootcamp project! By contributing, you can help improve the project and make it more useful for everyone.
We welcome contributions to the DevCamper project! By contributing, you can help improve the project and make it more useful for everyone.

## How to Contribute

Expand All @@ -9,8 +9,8 @@ We welcome contributions to the MERN Bootcamp project! By contributing, you can
Fork the repository on GitHub and clone your fork locally.

```sh
git clone https://github.com/your-username/mern-bootcamp.git
cd mern-bootcamp
git clone https://github.com/your-username/devcamper.git
cd DevCamper
```

2. **Create a branch:**
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# MERN Bootcamp
# DevCamper

## Overview

MERN Bootcamp is a web application created to help users discover, rate, and review coding bootcamps. The platform provides a comprehensive solution for users to search for bootcamps based on location, browse reviews from other users, and submit their own feedback. Its primary goal is to provide a resource for aspiring coders to find the right bootcamp for their needs.
DevCamper is a web application created to help users discover, rate, and review coding bootcamps. The platform provides a comprehensive solution for users to search for bootcamps based on location, browse reviews from other users, and submit their own feedback. Its primary goal is to provide a resource for aspiring coders to find the right bootcamp for their needs.

Built using the MERN stack, the application leverages MongoDB, Express.js, React, and Node.js to deliver a full-stack experience. On the backend, Express.js and MongoDB are utilized to handle API requests and manage data storage. Meanwhile, the frontend is powered by React, which provides a dynamic and responsive user interface.

Expand Down
10 changes: 5 additions & 5 deletions SETUP.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# MERN Bootcamp Project Setup Instructions
# DevCamper Project Setup Instructions

Welcome to the MERN Bootcamp project! This guide will walk you through the process of setting up the API server and the UI application. Please follow the steps carefully to get the application up and running.
Welcome to the DevCamper project! This guide will walk you through the process of setting up the API server and the UI application. Please follow the steps carefully to get the application up and running.

## Prerequisites

Expand All @@ -16,8 +16,8 @@ Before starting, make sure you have the following installed on your machine:
### Step 1: Clone the repository

```bash
git clone https://github.com/prasadhonrao/mern-bootcamp
cd mern-bootcamp
git clone https://github.com/prasadhonrao/devcamper
cd DevCamper
cd api
```

Expand Down Expand Up @@ -49,7 +49,7 @@ PORT=5000
NODE_ENV=development
# Database configuration
MONGO_URI=mongodb://localhost:27017/mern-bootcamp-dev-db
MONGO_URI=mongodb://localhost:27017/devcamper-dev-db
# Geocoder configuration
GEOCODER_PROVIDER=mapquest
Expand Down
10 changes: 10 additions & 0 deletions api/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
node_modules
npm-debug.log
.dockerignore
.git
.gitignore
_postman
tests
eslint.config.js
README.md
coverage
7 changes: 4 additions & 3 deletions api/.env.production → api/.env.example
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# Add .env file in the root of the api folder if you are running in development mode, otherwise add the following environment variables in your server.

# Server configuration
PORT=6000
NODE_ENV=production
NODE_ENV=development

# Database configuration
MONGO_URI=mongodb://localhost:27017/mern-bootcamp-prod-db
MONGO_URI=mongodb://localhost:27017/devcamper-db

# Geocoder configuration
GEOCODER_PROVIDER=mapquest
Expand All @@ -29,4 +31,3 @@ FROM_NAME=<YOUR_NAME>
# Rate limiting configuration
RATE_LIMIT_WINDOW=10
RATE_LIMIT_MAX=100

20 changes: 20 additions & 0 deletions api/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Use the official Node.js image as the base image
FROM node:20

# Set the working directory inside the container
WORKDIR /usr/src/app

# Copy package.json and package-lock.json to the working directory
COPY package*.json ./

# Install dependencies
RUN npm install

# Copy the rest of the application code to the working directory
COPY . .

# Expose the port the app runs on
EXPOSE 3000

# Define the command to run the application
CMD ["npm", "start"]
Loading

0 comments on commit a4c83fc

Please sign in to comment.