Project with intention to provide various financial modelling efforts, as well as machine learning models that can provide a benchmark of trained predicted stock price mechanisms.
The following guide explains how to set up and run OptiML project locally on your machine. (Installing prerequisites, running locally or on Kubernetes using Docker and Minikube)
- Python 3.12+ (for local dev)
- Docker (Download & Install)
- kubectl (Install Guide)
- Minikube (Install Guide)
Or, to just clone the Project Repo by itself using Git
- in this case, just skip to Section 3: Clone the Project Repo
- Install Docker
- Mac:
- Download Docker Desktop from here
- Linux:
- Use your distribution's package manager
- Windows:
- Download Docker Desktop for Windows
- Mac:
- Install kubectl
-
On Mac (via Homebrew):
brew install kubectl- else: follow the official instructions here
-
- Install Minikube
- On Mac (via Homebrew):
brew install minikube- else: follow the official minikube docs here
- On Mac (via Homebrew):
- Build Docker Image
docker build -t <your-dockerhub-username>/optiml:latest .
- Run the Image
docker run -p 8501:8501 <your-dockerhub-username>/optiml:latest
- Visit http://localhost:8501 in your browser
- Start Minikube
minikube start
- Build the Docker image and Push to Docker Hub
docker build -t <your-dockerhub-username>/optiml:latest . docker push <your-dockerhub-username>/optiml:latest
⚠️ Ensureimage: <your-dockerhub-username>/optiml:latestin your deployment YAML matches this tag.
- Apply Kubernetes Manifests
kubectl apply -f k8s/deployment.yaml kubectl apply -f k8s/service.yaml
- Access the app
minikube service optiml-app-serviceThis command automatically opens browser to the running app
- 🔧 Troubleshooting and Additional Notes
-
Image Not Updating? 🤔 Remember to rebuild and push Docker image after any code change, then use
kubectl rollout restart deployment optiml-appto refresh the apop in Kubernetes
-
Check Pod Status:
kubectl get pods kubectl describe pod <pod-name>
- Requirements:
All Python requirements are in
requirements.txt - File Structure Example:
optiml/ ├── streamlit_app.py ├── requirements.txt ├── Dockerfile ├── k8s/ │ ├── deployment.yaml │ └── service.yaml ├── app/ └── utils/
- Environment Cleanup Do this when you want to stop running the app
- Minikube
minikube stop minikube delete
- Kubernetes resources
kubectl delete -f k8s/deployment.yaml kubectl delete -f k8s/service.yaml
- *Updating the App
Skip this if plainly running app After code changes:
- Rebuild and push Docker image
- Restart deployment or re-apply yaml
- Pull latest code on cluster if using CI/CD efforts Full processes and commands can be found in UPDATE_PROCESS.txt within project files.
- Clone the Project in your console or IDE terminals
git clone https://github.com/Kazurl/OptiML.git cd optiml
- Set up virtual environment (recommended)
source venv/bin/activate # mac/linux # or .\venv\Scripts\activate # Windows
- Install dependencies
pip install --upgrade pip pip install -r requirements.txt
- Run the Streamlit app
streamlit run streamlit_app.py
- Automatically opened in browser at http://localhost:8501