Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
RahulGopathi committed Jan 29, 2024
0 parents commit 5dd65eb
Show file tree
Hide file tree
Showing 76 changed files with 35,171 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
SECRET_KEY='dcyz)+52d)n1f3d6dsf&g0p6a($(v4&rvu=9u3u6fib9=kzy$8'
ALLOWED_HOSTS=*
DEBUG=True

# Database configs
SQLITE_DB=True
DB_NAME=iitjcaas
DB_USER=iitjcaasuser
DB_PASSWORD=password
67 changes: 67 additions & 0 deletions .github/workflows/backend_CI.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Backend CI

on:
push:
branches:
- main
pull_request:
branches:
- main


env:
DJANGO_SETTINGS_MODULE: iitjcaas.settings
DJANGO_SECRET_KEY: "dcyz)+52d)n1f3d6dsf&g0p6a($(v4&rvu=9u3u6fib9=kzy$8"

jobs:
build:
runs-on: ubuntu-latest

services:
postgres:
image: postgres:10.8
env:
POSTGRES_USER: iitjcaasuser
POSTGRES_PASSWORD: password
POSTGRES_DB: iitjcaas
ports:
# will assign a random free host port
- 5432:5432
# needed because the postgres container does not provide a healthcheck
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5

steps:
- uses: actions/checkout@v1
- name: Set up Python 3.8
uses: actions/setup-python@v1
with:
python-version: 3.8
- name: Setup environment variables
run: |
cp .env.example .env
export DJANGO_SETTINGS_MODULE=iitjcaas.settings
- name: Install dependencies
working-directory: ./backend
run: |
sudo apt-get install libpq-dev
pip3 install coverage
pip3 install pipenv
- name: Linting
working-directory: ./backend
run: |
pipenv install --dev
source "$(pipenv --venv)"/bin/activate
flake8 .
- name: Migrations
working-directory: ./backend
run: |
source "$(pipenv --venv)"/bin/activate
python manage.py makemigrations
python manage.py migrate
- name: Coverage
working-directory: ./backend
run: |
source "$(pipenv --venv)"/bin/activate
pip3 install coverage
coverage run --source='.' manage.py test
53 changes: 53 additions & 0 deletions .github/workflows/frontend_CI.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: FrontendCI

on:
push:
branches:
- main
pull_request:
branches:
- main


jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [15.x, 16.x]

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

- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

- name: Install dependencies
working-directory: ./frontend
run: npm install

- name: Format
working-directory: ./frontend/src
run: |
npm run format:check
- name: Run ESLint
working-directory: ./frontend/src
run: |
npm run lint
- name: Run the tests and generate coverage report
working-directory: ./frontend
run: npm test -- --coverage

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1

- name: Build
working-directory: ./frontend
run: npm run build --if-present
149 changes: 149 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
env/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
*.sqlite3
**/migrations/*
!**/migrations/__init__.py
staticfiles/
media/
.idea/

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# SageMath parsed files
*.sage.py

# dotenv
.env

# virtualenv
.venv
venv/
ENV/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.DS_Store


# Database
tadb
db.sqlite3

# VueJS files
node_modules/
/dist/
npm-debug.log*
yarn-debug.log*
yarn-error.log*
/test/unit/coverage
/test/e2e/reports
selenium-debug.log
ui/src/config/index.js

# Editor directories and files
.idea
*.suo
*.ntvs*
*.njsproj
*.sln

npm-debug.log
yarn-error.log

# Editor directories and files
*.sln.DS_Store
node_modules
/dist

/tests/e2e/videos/
/tests/e2e/screenshots/

# local env files
.env.local
.env.*.local

# Editor directories and files
.vscode
*.sw?
21 changes: 21 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
BUILD_NAME=iitjcaas
BUILD_TAG=$$(git log -1 --pretty=%h)

build:
@docker build -t ${BUILD_NAME}-backend:${BUILD_TAG} -t ${BUILD_NAME}-backend:latest -f backend/Dockerfile backend
@docker build -t ${BUILD_NAME}-frontend:${BUILD_TAG} -t ${BUILD_NAME}-frontend:latest -f frontend/Dockerfile frontend

.env:
@cp .env.example .env

dev-start: .env
@docker-compose up -d

dev-stop:
@docker-compose down

dev-logs:
@docker-compose logs -f

exec:
@docker exec -it $$(echo "$$(docker ps --filter "name=django")" | awk 'NR > 1 {print $$1}') sh
61 changes: 61 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Cab Management System

An application with react and django for cab management system

## Steps to run locally

- Clone this repository and launch code:
```
git clone https://github.com/RahulGopathi/Cab-Management-System.git
cd Cab-Management-System
code .
```

### With Docker

Ensure that you have installed [Docker](https://docs.docker.com/install/) (with [Docker Compose](https://docs.docker.com/compose/install/)).

Run the development server:
```
make dev-start
```

After executing `make dev-start`, you will be running:
* The application on http://localhost:3000
* The API Server on http://localhost:8000

Make database migrations:
```
make exec
python manage.py makemigrations
python manage.py migrate
```

Create a superuser:
```
make exec
python manage.py createsuperuser
```

View logs of docker containers:
```
make dev-logs
```

To stop the development server:
```
make dev-stop
```

### Without Docker

- Copy `.env.example` to `.env`
```
cp .env.example .env
```

- To start your frontend and backend development server individually:

Follow the [Backend Readme](https://github.com/RahulGopathi/Cab-Management-System/tree/main/backend) to setup your backend server

Follow the [Frontend Readme](https://github.com/RahulGopathi/Cab-Management-System/tree/main/frontend) to setup the frontend server
3 changes: 3 additions & 0 deletions backend/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
./**/__pycache__/
./**/migrations/*
!./**/migrations/__init__.py
3 changes: 3 additions & 0 deletions backend/.flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[flake8]
max-line-length = 150
exclude = prometeo/settings/*, **/migrations/*, manage.py, env, venv
Loading

0 comments on commit 5dd65eb

Please sign in to comment.