Infra for academia
Project description
deployml
Infrastructure for academia with cost analysis
Features
- 🏗️ Infrastructure as Code: Deploy ML infrastructure using Terraform
- 💰 Cost Analysis: Integrated infracost analysis before deployment
- ☁️ Multi-Cloud Support: GCP, AWS, and more
- 🔬 ML-Focused: Pre-configured for MLflow, experiment tracking, and model registry
- 🛡️ Production Ready: Security best practices and service account management
Instructions
poetry install
poetry run deployml doctor
poetry run deployml deploy --config-path your-config.yaml
docker build --platform=linux/amd64 -t gcr.io/mlops-intro-461805/mlflow/mlflow:latest .
gcloud auth configure-docker docker push gcr.io/PROJECT_ID/mlflow-app:latest
Cost Analysis Integration
deployml integrates with infracost to provide cost estimates before deployment:
Installation
brew install infracost
Once installed you will need to create a free infracost account before creating your API key.
To generate your infracost API key run the following command:
infracost auth login
If you want to retrieve your API key use:
infracost configure get api_key
Cost Analysis Configuration
Add cost analysis settings to your YAML configuration:
name: "my-mlops-stack"
cost_analysis:
enabled: true # Enable/disable cost analysis (default: true)
warning_threshold: 100.0 # Warn if monthly cost exceeds this amount
currency: "USD" # Currency for cost display
Cloud Run Service Account Setup
When deploying MLflow, you must specify the service account email that Cloud Run will use. This service account must have permission to access the artifact bucket.
How to get a service account email
- List your service accounts:
gcloud iam service-accounts list
- (Recommended) Create a dedicated service account for MLflow if you don't have one:
gcloud iam service-accounts create mlflow-cloudrun --display-name "MLflow Cloud Run Service Account"
- Find the email for your service account (it will look like
mlflow-cloudrun@YOUR_PROJECT.iam.gserviceaccount.com).
Grant the service account permissions
The Terraform module will automatically grant the service account the required permissions on the artifact bucket.
Deploying with Terraform
Pass the service account email as a variable:
terraform apply -var="cloud_run_service_account=mlflow-cloudrun@YOUR_PROJECT.iam.gserviceaccount.com"
Or, if using the CLI, ensure it passes this variable to Terraform.
Why this is needed
The MLflow server (running on Cloud Run) needs permission to list and read artifacts in the GCS bucket. This setup ensures the MLflow UI works for all users without manual permission fixes.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file deployml_core-0.0.21.tar.gz.
File metadata
- Download URL: deployml_core-0.0.21.tar.gz
- Upload date:
- Size: 91.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eb1bbcdf2323b7d2afada07e87c04db01d3684da484cc190a95d7c2bd7ee8de1
|
|
| MD5 |
b59736145ec5bb9ca8928c1411412a3c
|
|
| BLAKE2b-256 |
259d75d616eeb6170e589d1a88c50b0229b89a38dfb57d2d1991fbc67005b015
|
File details
Details for the file deployml_core-0.0.21-py3-none-any.whl.
File metadata
- Download URL: deployml_core-0.0.21-py3-none-any.whl
- Upload date:
- Size: 121.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f7e8b253723f05e22a0c410a270eb4abb26843fd8cd12833e038fa61b969d0e0
|
|
| MD5 |
f473e2d43bb25970987dd65570fe5f98
|
|
| BLAKE2b-256 |
d73df75b5cfea569929973277aae99f421218a8c5e090850b6a6bfa785f361c3
|