Skip to content

Commit

Permalink
Merge branch 'main' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
kulkarniishan authored Apr 18, 2024
2 parents 834be0a + e69410d commit d57a7e1
Show file tree
Hide file tree
Showing 187 changed files with 70,059 additions and 1 deletion.
72 changes: 72 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: [ "main" ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ "main" ]
schedule:
- cron: '17 8 * * 1'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'javascript', 'python' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support

steps:
- name: Checkout repository
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality


# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.

# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
Binary file not shown.
File renamed without changes.
21 changes: 21 additions & 0 deletions Backend-main/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2022 FASAL-MITRA-SIH-22

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
14 changes: 14 additions & 0 deletions Backend-main/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<h1 align="center">Fasal-Mitra App</h1>

<div align="center">
<a href="https://github.com/FASAL-MITRA-SIH-22/Fasal-mitra-frontend"><img width=200px src="https://github.com/FASAL-MITRA-SIH-22/Fasal-mitra-frontend/blob/main/frontend/public/android-chrome-512x512.png" alt="Project logo"/></a></a>

</div>

[![-----------------------------------------------------](https://raw.githubusercontent.com/andreasbm/readme/master/assets/lines/colored.png)](#-table-of-contents)

This folder contains most of the backend. The backend follows a microservice architecture, there are many microservices nd these services communicate with each other through HTTP requests and the fronend communicates with the frontend via an API-gateway. The authentication service uses mongoDB and redis cache for user authentication. THe dl service uses ResNet9 as Deep Learning Model and flask server for deploying this model into an API, while the nginx acts as an API gateway.

The system architecture for the application is as followed:

<a href="https://github.com/FASAL-MITRA-SIH-22/Fasal-mitra-frontend"><img width="auto" src="https://github.com/FASAL-MITRA-SIH-22/Fasal-Mitra/blob/main/AboutProject/ArchitectureDiagram.svg" alt="System Architecture"/></a>
21 changes: 21 additions & 0 deletions Backend-main/SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Security Policy

## Supported Versions

Use this section to tell people about which versions of your project are
currently being supported with security updates.

| Version | Supported |
| ------- | ------------------ |
| 5.1.x | :white_check_mark: |
| 5.0.x | :x: |
| 4.0.x | :white_check_mark: |
| < 4.0 | :x: |

## Reporting a Vulnerability

Use this section to tell people how to report a vulnerability.

Tell them where to go, how often they can expect to get an update on a
reported vulnerability, what to expect if the vulnerability is accepted or
declined, etc.
1 change: 1 addition & 0 deletions Backend-main/auth/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
2 changes: 2 additions & 0 deletions Backend-main/auth/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.pem
.env
7 changes: 7 additions & 0 deletions Backend-main/auth/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM node:16.13-alpine
WORKDIR /app
COPY package.json .
RUN npm install
COPY . .
CMD npm start
EXPOSE 8080
11 changes: 11 additions & 0 deletions Backend-main/auth/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Fasal-Mitra
An automated plant disease detection app
* This app will help farmers to detect the diseases and how can they overcome it. ​

* It will generate a detail report which will contain the disease names in number of species.​

* If required, they can also verify it by the government authorities who will verify the report generated and will help with the input if required.​

* The collected data will help our system to predict the diseases in more accurate way due to self-learning mechanism.​

* The system will be easy to use with some basics functionalities which will make it user friendly for farmers.
32 changes: 32 additions & 0 deletions Backend-main/auth/configs/mongodb.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
const mongoose = require('mongoose');

var mongoConnect = mongoose
.connect(process.env.MONGO_URI, {
useNewUrlParser: true,
useUnifiedTopology: true,
}, () => {
console.log(`Auth-Service DB Connected`);
})


mongoose.connection.on('connected', (err) => {
if (err) {
console.log(err);
}
console.log('Mongoose connected to db');
})

mongoose.connection.on('error', (err) => {
console.log('error',err.message)
})

mongoose.connection.on('disconnected', () => {
console.log('Mongoose connection is disconnected.')
})

process.on('SIGINT', async () => {
await mongoose.connection.close()
process.exit(0)
})

module.exports = mongoConnect;
20 changes: 20 additions & 0 deletions Backend-main/auth/configs/redis.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const { createClient } = require("redis");

let redisClient;

const connect = async () => {
try {
// redisClient = createClient("redis://redis:6379"); //Default port 6379
redisClient = createClient({ url: 'redis://redis:6379' })//for docker
await redisClient.connect();
await redisClient.flushAll("ASYNC");
console.log("Redis connected!!");
} catch (err) {
console.log(err);
// throw new Error(err)
}
};

connect();

module.exports = { redisClient };
Loading

0 comments on commit d57a7e1

Please sign in to comment.