This document outlines key commands for managing the development workflow of the Fitness SaaS project.
Start your FastAPI application with hot-reloading enabled (for local development):
poetry run uvicorn src.main:app --reload
To run the application in a Docker environment:
-
Build the Docker image (if not already built):
docker build -t alazka/user-service:latest .
-
Run the Docker container:
docker run -p 8000:8000 alazka/user-service:latest
-
For development with Minikube, first set the Docker environment:
& minikube -p minikube docker-env --shell powershell | Invoke-Expression
Then build and run as above.
-
To access the service when running in Minikube:
kubectl port-forward service/user-service 8000:8000
After making changes to your code, follow these steps to update the running application:
If you're running the application locally with hot-reloading enabled, changes will be applied automatically when you save your files.
-
Rebuild the Docker image with the new changes:
docker build -t alazka/user-service:latest .
-
If using Minikube, ensure you're using its Docker daemon:
& minikube -p minikube docker-env --shell powershell | Invoke-Expression
-
Push the updated image to your registry (if not using Minikube):
docker push alazka/user-service:latest
-
If you've made changes to the Helm chart:
helm upgrade user-service ./user-service
-
If you've only updated the Docker image:
kubectl rollout restart deployment user-service
-
Monitor the rollout:
kubectl rollout status deployment user-service
-
Verify the new pod is running with the updated image:
kubectl get pods kubectl describe pod <new-pod-name>
Execute the test suite using either of these commands:
poetry run build test
or
poetry run pytest
Install or update project dependencies:
poetry run build setup
or
poetry install
Add new packages to your project:
poetry add <package-name>
Update project dependencies to their latest versions within the constraints specified in pyproject.toml:
poetry update
Check your code for style issues and potential errors using Black, isort, and mypy:
poetry run build lint
Automatically format your code to adhere to the project's style guidelines:
poetry run build format
Activate the project's virtual environment:
poetry shell
Display available tasks in your Build.ps1 script:
poetry run build
or
poetry run build help
Create a new Python file in the src directory:
New-Item -Path .\src -Name "new_module.py" -ItemType "file"
Remember to run these commands from the project root directory. Keep this document updated as new commands are added or existing ones are modified.