A simple progressive web app to track sleep.
Secrets have to be set up before running the project.
Environment variables for .env file:
API_KEY- API key that client will have to provide in order to be able to access the sleep tracker webpageSPREADSHEET_ID- Google Sheets spreadsheet ID, e.g. the ID for a spreadsheet with the link https://docs.google.com/spreadsheets/d/13Nig7emkfeSDraasAERmsc82k2i3y4Csdfcazj0kUPcUY/ would be13Nig7emkfeSDraasAERmsc82k2i3y4Csdfcazj0kUPcUYSPREADSHEET_RANGE- The name of the Google Sheets spreadsheet, e.g.Sheet1PUSHBULLET_API_KEY- PushBullet API key to send a notification after creating/deleting a sleep entry
Google Sheets API OAuth client credentials for secret/credentials.json file also have to be generated at https://console.cloud.google.com/apis/api/sheets.googleapis.com/credentials.
The client ID has to be of type Desktop app.
During first login there will be a command line prompt to log in with Google.
After logging in, a secret/token.json file will be generated and the app will have to be restarted in order for it to work.
This command can be used to generate the initial secret/token.json file:
docker run -it --rm -v `pwd`/secret:/usr/src/sleep-tracker/secret -p 8002:8000 mpoc/sleep-trackerAfter running it, navigate to http://localhost:8000/?apiKey=<API_KEY> to trigger the Google login.
bun install
bun startdocker-compose up -dGo to http://localhost:8000/?apiKey=<API_KEY> to see the app.
Note that in order to log the sleep entry location, it will have run over HTTPS. Without HTTPS, this error will happen when trying to access the location:
ERROR(1): Only secure origins are allowed (see: https://goo.gl/Y0ZkNV).
docker build -t mpoc/sleep-tracker:latest .
docker push mpoc/sleep-tracker:latest