Skip to content

a web application to generate a work attendance sheet as a Google Sheet for each individual based on their Google Drive

License

Notifications You must be signed in to change notification settings

benjisho/google-sheet-generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Google Sheet Generator

This project provides a web application to generate work attendance sheets as Google Sheets for each user in their own Google Drive. The application is split into a frontend and backend, each running in its own Docker container.

Table of Contents

  1. Technologies Used

  2. File Structure

  3. Setup Instructions

    3.1. Clone the repository

  4. Nginx and SSL Configuration

    4.1. Generate SSL certificate

    4.2. Add GCP Credentials

    4.3. Build and Run Docker Containers

  5. Usage Instructions

  6. To Test Backend Endpoint Manually

  7. Delete the Environment

    7.1. Delete Docker Environment

    7.2. Delete Generated Sheets

  8. Contributing

  9. License

Technologies Used

  • Backend: Flask
  • Frontend: React
  • Containerization: Docker
  • Reverse Proxy: Nginx
  • SSL/TLS: OpenSSL
  • Google Sheets API
  • Google OAuth 2.0

File Structure

google-sheet-generator/
├── backend/
│   ├── app/
│   │   ├── __init__.py
│   │   ├── cleanup_sheets_from_api.py
│   │   ├── credentials.json
│   │   ├── models.py
│   │   ├── routes.py
│   │   └── templates/
│   ├── tests/
│   ├── config.py
│   ├── requirements.txt
│   ├── Dockerfile
│   └── manage.py
├── frontend/
│   ├── public/
│   │   └── index.html
│   ├── src/
│   │   ├── components/
│   │   │   ├── Button.css
│   │   │   └── Button.js
│   │   ├── App.js
│   │   └── index.js
│   ├── package.json
│   ├── Dockerfile
│   └── .env
├── nginx/
│   ├── nginx.conf
│   ├── certs/
│   │   ├── server.crt
│   │   └── server.key
│   └── Dockerfile
├── docker-compose.yml
├── README.md
└── .gitignore

Setup Instructions

Clone the repository:

git clone https://github.com/benjisho/google-sheet-generator.git
cd google-sheet-generator

Nginx and SSL Configuration

Generate SSL certiificate into nginx/certs/ directory

  1. Run the following command to generate a 2048-bit RSA private key, which is used to decrypt traffic:
openssl genrsa -out nginx/certs/server.key 2048
  1. Run the following command to generate a certificate, using the private key from the previous step.
openssl req -new -key nginx/certs/server.key -out nginx/certs/server.csr
  1. Run the following command to self-sign the certificate with the private key, for a period of validity of 365 days:
openssl x509 -req -days 365 -in nginx/certs/server.csr -signkey nginx/certs/server.key -out nginx/certs/server.crt

Add GCP Credentials

  1. Add your GCP service-account credentials into this file: credentials.json
vi backend/app/credentials.json

Build and Run Docker Containers

  1. Build and run the Docker containers:
docker-compose up --build

Usage Instructions

  1. Open a web browser and navigate to https://<your-domain-or-IP> to access the application.

Please replace <your-domain-or-IP> with your actual domain name or IP address where the application is hosted. Also, make sure to follow best practices and keep your SSL certificates secure.

To Test Backend Endpoint Manually

If possible, test the `/generate-sheet`` route manually using a tool like curl or Postman to see if you can reproduce the error and get more information about what might be causing it.

curl -X POST http://localhost:5000/generate-sheet

Delete the environment we deployed

Delete the docker environment

docker system prune -a

Delete the generated Sheets by the clients

  1. Create and Activate a Virtual Environment (if not already done):
  • Create a virtual environment:
python3 -m venv ~/venv
  • Activate the virtual environment:
source ~/venv/bin/activate
  1. Install Dependencies:
  • Navigate to the `backend/`` directory where your requirements.txt file is located.
cd backend/
  • Run the following command:
cd backend/
pip install -r requirements.txt
  1. Run the Cleanup Script:
cd 
python3 app/cleanup_sheets_from_api.py

Contributing

Contributions are welcome! Please read the contributing guidelines before getting started.

License

GNU License

About

a web application to generate a work attendance sheet as a Google Sheet for each individual based on their Google Drive

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published