Skip to main content

Configuration

Server Configuration


yaml
# /opt/mlflow/config/mlflow.yaml
server:
host: "0.0.0.0"
port: 5000
workers: 4
backend_store_uri: "postgresql://mlflow_user:password@localhost:5432/mlflow_db"
default_artifact_root: "/opt/mlflow/artifacts"
serve_artifacts: true
artifacts_destination: "/opt/mlflow/artifacts"
gunicorn_opts: "--timeout 60 --keep-alive 2"
database:
connection_pool_size: 20
max_overflow: 30
pool_timeout: 30
pool_recycle: 3600
logging:
level: "INFO"
file: "/opt/mlflow/logs/mlflow.log"
max_file_size: "10MB"
backup_count: 5
Environment Variables
bash

# /opt/mlflow/config/mlflow.env
export MLFLOW_TRACKING_URI="http://localhost:5000"
export MLFLOW_BACKEND_STORE_URI="postgresql://mlflow_user:password@localhost:5432/mlflow_db"
export MLFLOW_DEFAULT_ARTIFACT_ROOT="/opt/mlflow/artifacts"
export MLFLOW_SERVE_ARTIFACTS=true
export MLFLOW_ARTIFACTS_DESTINATION="/opt/mlflow/artifacts"
# AWS S3 Configuration (if using S3)
export AWS_ACCESS_KEY_ID="your-access-key"
export AWS_SECRET_ACCESS_KEY="your-secret-key"
export AWS_DEFAULT_REGION="us-east-1"
export MLFLOW_S3_ENDPOINT_URL="https://s3.amazonaws.com"
# Authentication
export MLFLOW_TRACKING_USERNAME="mlflow_user"
export MLFLOW_TRACKING_PASSWORD="mlflow_password"

Web Server Configuration

nginx

# /etc/nginx/sites-available/mlflow
server {
listen 80;
server_name mlflow.example.com;
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl http2;
server_name mlflow.example.com;
ssl_certificate /etc/ssl/certs/mlflow.crt;
ssl_certificate_key /etc/ssl/private/mlflow.key;
location / {
proxy_pass http://127.0.0.1:5000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_read_timeout 300s;
proxy_connect_timeout 75s;
}
location /api/ {
proxy_pass http://127.0.0.1:5000/api/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_read_timeout 300s;
proxy_connect_timeout 75s;
}
}