Skip to content

APIs to track exercises, nutrition, and workouts

Notifications You must be signed in to change notification settings

jayadarshinig0609/fitnesstracker

 
 

Repository files navigation

Fitness Tracker API

The Fitness Tracker API project is designed to track exercises, nutrition, and workouts, utilizing a Python backend with Django and Postgres for the database.

Technology Stack

Formatter or Linters

How to set up locally

Prerequisite

  • Make sure Postgres is installed locally. Checkout installation here Postgres
  1. Clone the project.
 git clone https://github.com/CyrilBaah/fitnesstracker.git
 cd fitnesstracker
  1. Create a virtual environment and activate it
 virtualenv env
 source env/bin/activate  
  1. Install packages
 pip install -r requirements.txt 
  1. Change the env.example file to .env and update it accordingly
  2. Run migrations
python manage.py migrate
  1. Start server
python manage.py runserver
  1. Access the fitnesstracker API

How to set up locally using Docker container

Prerequisite

  • Make sure Docker is installed locally. Checkout installation here Docker
  • Make sure Postgres is installed locally. Checkout installation here Postgres
  1. Clone the project.
 git clone https://github.com/CyrilBaah/fitnesstracker.git
 cd fitnesstracker
  1. Change the env.example file to .env
  2. Run
 docker-compose build --no-cache
  1. Run
 docker-compose up

Running Linters

 cd scripts
 ./run-linters.sh

Generate Seeder

  • Exercise
 ./manage seed_exercises
  • Nutritions
 ./manage seed_nutritions
  • Workout
 ./manage seed_workouts

Generate documentation

 ./manage.py spectacular --color --file schema.yml

Documentation API

http://127.0.0.1:8000/api/schema/docs

Generate Secret Key

 ./scripts/run-secretkey.sh 

Run kubernetes Manifest files

Make sure on of the following is installed

  • Minikube is installed. Checkout installation here Minikube
  • Kind is installed. Checkout installation here Kind
$ kubectl apply -f ops/

Serve the application

$ kubectl port-forward service/fitnesstracker 8000:8000

Serve minikube server | Dashboard

$ minikube dashboard --url

Get Node Address

$ kubectl get service fitnesstracker -o jsonpath='{.spec.clusterIP}'
$ kubectl get nodes -o jsonpath='{.items[0].status.addresses[?(@.type=="InternalIP")].address}'

Configure Ingress

Get ClusterIP

$ kubectl get service fitnesstracker

Modify /etc/hosts

$ sudo nano /etc/hosts

Add cluster IP to /etc/hosts

123.456.7.8 fitnesstracker.com

Use KinD

  1. Run
make create-cluster
  1. Install Nginx Ingress Controller
make install-nginxingresscontroller 

About

APIs to track exercises, nutrition, and workouts

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 92.2%
  • Makefile 4.8%
  • Shell 2.0%
  • Dockerfile 1.0%