Skip to content

Commit

Permalink
Merge pull request #26 from BhuvanSA/main
Browse files Browse the repository at this point in the history
Dockerization of the entire application
  • Loading branch information
nishith-p-shetty authored Sep 13, 2024
2 parents 6346419 + 53bab8f commit c289830
Show file tree
Hide file tree
Showing 12 changed files with 486 additions and 259 deletions.
165 changes: 165 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# Macos
.DS_Store

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# 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/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
.pdm.toml
.pdm-python
.pdm-build/

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
18 changes: 18 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Use the official Python image from the Docker Hub
FROM python:3.9-slim

# Set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1

# Set the working directory
WORKDIR /app

# Copy the requirements file
COPY requirements.txt /app/

# Install dependencies
RUN pip install --no-cache-dir -r requirements.txt

# Copy the rest of the application code
COPY . /app/
59 changes: 31 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,51 +4,54 @@
![Flask](https://img.shields.io/badge/-Flask-333333?style=flat&logo=flask)
![PostgreSQL](https://img.shields.io/badge/-PostgreSQL-333333?style=flat&logo=postgresql)

Flask Feedback Form is a web application designed to collect and analyze feedback and ratings for multiple teams.
Flask Feedback Form is a web application designed to collect and analyze feedback and ratings for multiple teams.

Check out the live website [here](https://flaskfeedbackform.bhuvansa.com).

## Table of Contents

- [Features](#features)
- [Installation](#installation)
- [Usage](#usage)
- [System Architecture](#system-architecture)
- [DBML Diagram](#dbml-diagram)
- [Credits](#credits)
- [License](#license)
- [Features](#features)
- [Installation](#installation)
- [Usage](#usage)
- [System Architecture](#system-architecture)
- [DBML Diagram](#dbml-diagram)
- [Credits](#credits)
- [License](#license)

## Features

- Users can submit feedback for multiple teams by filling out a form with their name, rating, and feedback message.
- Interactive dashboard displaying insights into ratings and feedback that have been submitted.
- Authentication functionality to prevent unauthorized access to the dashboard.
- Users can submit feedback for multiple teams by filling out a form with their name, rating, and feedback message.
- Interactive dashboard displaying insights into ratings and feedback that have been submitted.
- Authentication functionality to prevent unauthorized access to the dashboard.

## Installation

1. Clone the repository to your local machine.
2. Install the required dependencies using pip:
``` pip install -r requirements.txt ```
3. Create a `.env` file in the root directory with the following data:
```
Application Details
FEEDBACK_FORM_ADMIN_USERNAME='YOUR_ADMIN_USERNAME'
FEEDBACK_FORM_ADMIN_PASSWORD='YOUR_ADMIN_PASSWORD'
FEEDBACK_FORM_SECRET_KEY='YOUR_SECRET_KEY'
PostgreSQL database details
FEEDBACK_FORM_DB_HOST="YOUR_DATABASE_HOST"
FEEDBACK_FORM_DB_NAME="YOUR_DATABASE_NAME"
FEEDBACK_FORM_DB_USER="YOUR_DATABASE_USERNAME"
FEEDBACK_FORM_DB_PASSWORD="YOUR_DATABASE_PASSWORD"
2. Create a `.env` file in the root directory with the following data:

```
# Application Details
FEEDBACK_FORM_ADMIN_USERNAME=YOUR_ADMIN_USERNAME
FEEDBACK_FORM_ADMIN_PASSWORD=YOUR_ADMIN_PASSWORD
FEEDBACK_FORM_SECRET_KEY=YOUR_SECRET_KEY
# PostgreSQL database details
FEEDBACK_FORM_DB_HOST=db
FEEDBACK_FORM_DB_NAME=YOUR_DATABASE_NAME
FEEDBACK_FORM_DB_USER=YOUR_DATABASE_USERNAME
FEEDBACK_FORM_DB_PASSWORD=YOUR_DATABASE_PASSWORD
```
4. Run the application: ``` python app.py ```
3. Build and start the application using Docker Compose:
```sh
docker-compose up --build
```
## Usage
- Visit `http://127.0.0.1:5000/` to submit feedback.
- Visit `http://127.0.0.1:5000/dashboard` to view data.
- Visit `http://localhost:3000/` to submit feedback.
- Visit `http://localhost:3000/dashboard` to view data.
## System Architecture
Expand Down
4 changes: 3 additions & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,4 +276,6 @@ def delete_feedback(feedback_id):


if __name__ == "__main__":
app.run()
host = os.environ.get("HOST", "0.0.0.0")
port = int(os.environ.get("PORT", 3000))
app.run(host=host, port=port)
28 changes: 28 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
services:
db:
image: postgres:latest
container_name: feedback_form_db
environment:
POSTGRES_USER: ${FEEDBACK_FORM_DB_USER}
POSTGRES_PASSWORD: ${FEEDBACK_FORM_DB_PASSWORD}
POSTGRES_DB: ${FEEDBACK_FORM_DB_NAME}
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data

web:
build: .
container_name: feedback_form_web
command: python app.py
volumes:
- .:/app
ports:
- "3000:3000"
depends_on:
- db
env_file:
- .env

volumes:
postgres_data:
17 changes: 10 additions & 7 deletions example.env
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
FEEDBACK_FORM_ADMIN_USERNAME=""
FEEDBACK_FORM_ADMIN_PASSWORD=""
FEEDBACK_FORM_SECRET_KEY=""
FEEDBACK_FORM_DB_HOST=""
FEEDBACK_FORM_DB_NAME=""
FEEDBACK_FORM_DB_USER=""
FEEDBACK_FORM_DB_PASSWORD=""
# Application Details
FEEDBACK_FORM_ADMIN_USERNAME=YOUR_ADMIN_USERNAME
FEEDBACK_FORM_ADMIN_PASSWORD=YOUR_ADMIN_PASSWORD
FEEDBACK_FORM_SECRET_KEY=YOUR_SECRET_KEY

# PostgreSQL database details
FEEDBACK_FORM_DB_HOST=db
FEEDBACK_FORM_DB_NAME=YOUR_DATABASE_NAME
FEEDBACK_FORM_DB_USER=YOUR_DATABASE_USERNAME
FEEDBACK_FORM_DB_PASSWORD=YOUR_DATABASE_PASSWORD
Empty file removed mydumpfile.bak
Empty file.
Empty file removed oldverceldb
Empty file.
Empty file removed oldverceldb.sql
Empty file.
Loading

0 comments on commit c289830

Please sign in to comment.