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.
-
3.1. Clone the repository
-
4.2. Add GCP Credentials
- Backend: Flask
- Frontend: React
- Containerization: Docker
- Reverse Proxy: Nginx
- SSL/TLS: OpenSSL
- Google Sheets API
- Google OAuth 2.0
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
git clone https://github.com/benjisho/google-sheet-generator.git
cd google-sheet-generator
- 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
- 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
- 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 your GCP service-account credentials into this file:
credentials.json
vi backend/app/credentials.json
- Build and run the Docker containers:
docker-compose up --build
- 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.
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
docker system prune -a
- 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
- 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
- Run the Cleanup Script:
cd
python3 app/cleanup_sheets_from_api.py
Contributions are welcome! Please read the contributing guidelines before getting started.
GNU License