Skip to content

set up mlflow on glcoud #35

Description

@Urfoex

We'd like to have a mlflow server running internally for all to use.
It shall be living in the glcoud.

  • Setting up mlflow on Google Cloud Platform
    • run mlflow via CloudRun
    • connect mlflow to GS for artifact store
    • connect mlflow to SQL with postgresql
    • secure mlflow endpoint via IAM and IAP (authorization & authentication)

See also #34

Activity

  1. self-assigned this
    on Feb 24, 2025
  2. added theissue type on Feb 24, 2025
  3. Urfoex commented on Mar 16, 2025

    @Urfoex
    CollaboratorAuthor

    postgresql+psycopg2://${DB_USER}:${DB_PASS}@/${DB_DATABASE}?host=/cloudsql/${DB_CONNECTION}

    But Environment variables are not working for Container arguments …

    mlflow Server: https://console.cloud.google.com/run/detail/europe-west1/mlflow-server/metrics?project=getml-playground&chat=true&inv=1&invt=Abr_og

    mlflow DB: https://console.cloud.google.com/sql/instances/sql-pg17-mlflow/overview?cloudshell=true&chat=true&inv=1&invt=AbsNMg&project=getml-playground

    sqlite as file-db in volume-mount sqlite:////app/registry-store.sqlite.db

    Store in sqlite in volume-mount:
    (container entrypoint) -m mlflow server -h 0.0.0.0 --backend-store-uri sqlite:////app/backend-store.sqlite.db --registry-store-uri sqlite:////app/registry-store.sqlite.db --artifacts-destination gs://gcs-mlflow-server/artifacts

    Store in volume-mount:
    (container entrypoint) -m mlflow server -h 0.0.0.0 --backend-store-uri file:///app/backend-store/ --registry-store-uri file:///app/registry-store/ --artifacts-destination gs://gcs-mlflow-server/artifacts

    Store in Cloud SQL (But environment variables won't work ...):
    (container entrypoint) -m mlflow server -h 0.0.0.0 --backend-store-uri postgresql+psycopg2://${DB_USER}:${DB_PASS}@/${DB_DATABASE_BACKEND_STORE}?host=/cloudsql/${DB_CONNECTION} --registry-store-uri postgresql+psycopg2://${DB_USER}:${DB_PASS}@/${DB_DATABASE_REGISTRY_STORE}?host=/cloudsql/${DB_CONNECTION} --artifacts-destination gs://gcs-mlflow-server/artifacts

    https://www.youtube.com/watch?v=cBrn5IM4mA8

    https://docs.sqlalchemy.org/en/20/dialects/postgresql.html#unix-domain-connections

  4. Urfoex commented on Mar 17, 2025

    @Urfoex
    CollaboratorAuthor

    Using "Environment variables" instead of passing via "Container arguments" with
    MLFLOW_BACKEND_STORE_URI → postgresql+psycopg2://${DB_USER}:${DB_PASS}@/${DB_DATABASE_BACKEND_STORE}?host=/cloudsql/${DB_CONNECTION}
    MLFLOW_REGISTRY_STORE_URI → postgresql+psycopg2://${DB_USER}:${DB_PASS}@/${DB_DATABASE_REGISTRY_STORE}?host=/cloudsql/${DB_CONNECTION}
    MLFLOW_ARTIFACTS_DESTINATION → gs://gcs-mlflow-server/artifacts
    MLFLOW_HOST → 0.0.0.0
    ( https://mlflow.org/docs/latest/api_reference/cli.html#mlflow-server )

    For URIs, the variables must be replaced with real values. No recursive environment replacement is done automatically.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions