skip to Main Content

I want to configure MLflow Authentication to rw per user. My docker file looks like this:
https://pastebin.com/yD9ACWzp

In the nginx environment I added

- MLFLOW_TRACKING_USERNAME=administrator

- MLFLOW_TRACKING_PASSWORD=xxxxxxxxxx

And I enabled authentication, but now I can’t log in

Many thanks for the advice and suggestions…

2

Answers


  1. Chosen as BEST ANSWER

    Thank you! I also noticed that my artifacts are not written, can I configure them in local storage under the user?

    app:
            restart: always
            build: ./mlflow
            image: mlflow_server
            container_name: mlflow_server
            expose:
                - 5001
            # networks:
            #     - frontend
            #     - backend
            environment:
              - BACKEND=postgresql://${DB_USER:-postgres}@${DB_SERVER:-db}:${DB_PORT:-5432}/${DB_NAME:-mlflow}
              - ARTIFACTS=${HOME}:/storage/mlruns  # in-container path to filestore in filesys
              # For artifact store in AWS S3 (uses boto that was installed in container):
              # Commment out ARTIFACTS line above and instead use:
              #  - ARTIFACTS="s3://mlflow_bucket/my_mlflow_dir/"
              #  - AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}
              #  - AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}
              #  - AWS_DEFAULT_REGION=${AWS_DEFAULT_REGION}
            volumes:
                - ${FILESTORE:-/storage/mlruns}:/storage/mlruns  # can comment out this line if using S3
                - ${PGPASS:-~/.pgpass}:/root/.pgpass  # provides the pw for BACKEND database
                - condaenv_vol:/opt/conda  # provides continuity/speed when looping runs with same container
            command:
                - sh    # (sh allows for var substitution of BACKEND and ARTIFACTS)
                - -c
                - mlflow server
                    --port 5001
                    --host 0.0.0.0
                    --backend-store-uri $${BACKEND}
                    --default-artifact $${ARTIFACTS}
                    --app-name basic-auth
            # depends_on:
            #     - db
    

    Many thanks.


  2. As I read on the MLflow Authentication documentations, I think you can add an Environment Variable in the app service of your Docker Compose like so:

    environment:
      - BACKEND=postgresql://${DB_USER:-postgres}@${DB_SERVER:-db}:${DB_PORT:-5432}/${DB_NAME:-mlflow}
      - ARTIFACTS=/storage/mlruns  # in-container path to filestore in filesys
      - MLFLOW_TRACKING_USERNAME=administrator
      - MLFLOW_TRACKING_PASSWORD=YourPassword
    

    here is the full docker-compose.yaml:

    version: '3.3'
     
    services:
        db:
            restart: always
            image: postgres:13
            container_name: mlflow_db
            expose:
                - ${DB_PORT:-5432}
            # networks:
            #     - backend
            environment:
                # - MUID=$UID
                #  - MGID=$GID
              - POSTGRES_DB=${DB_NAME:-mlflow}
              - POSTGRES_USER=${DB_USER:-postgres}
              - POSTGRES_PASSWORD_FILE=/run/secrets/pg_admin_pw
            secrets:
                - pg_admin_pw
            volumes:
                - datapg_vol:/var/lib/postgresql/data
     
        app:
            restart: always
            build: ./mlflow
            image: mlflow_server
            container_name: mlflow_server
            expose:
                - 5001
            # networks:
            #     - frontend
            #     - backend
            environment:
              - BACKEND=postgresql://${DB_USER:-postgres}@${DB_SERVER:-db}:${DB_PORT:-5432}/${DB_NAME:-mlflow}
              - ARTIFACTS=/storage/mlruns  # in-container path to filestore in filesys
              - MLFLOW_TRACKING_USERNAME=administrator
              - MLFLOW_TRACKING_PASSWORD=YourPassword
              # For artifact store in AWS S3 (uses boto that was installed in container):
              # Commment out ARTIFACTS line above and instead use:
              #  - ARTIFACTS="s3://mlflow_bucket/my_mlflow_dir/"
              #  - AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}
              #  - AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}
              #  - AWS_DEFAULT_REGION=${AWS_DEFAULT_REGION}
            volumes:
                - ${FILESTORE:-/storage/mlruns}:/storage/mlruns  # can comment out this line if using S3
                - ${PGPASS:-~/.pgpass}:/root/.pgpass  # provides the pw for BACKEND database
                - condaenv_vol:/opt/conda  # provides continuity/speed when looping runs with same container
            command:
                - sh    # (sh allows for var substitution of BACKEND and ARTIFACTS)
                - -c
                - mlflow server
                    --port 5001
                    --host 0.0.0.0
                    --backend-store-uri $${BACKEND}
                    --default-artifact-root $${ARTIFACTS}
                    --app-name basic-auth
            # depends_on:
            #     - db
     
        nginx:
            restart: always
            build: ./nginx
            image: mlflow_nginx
            container_name: mlflow_nginx
            ports:
                - "${MLFLOW_PORT:-5000}:80"
            environment:
              - MLFLOW_TRACKING_USERNAME=administrator
              - MLFLOW_TRACKING_PASSWORD=xxxxxxxxxx
                #volumes:
                #- nginx_vol:/etc/nginx
            # networks:
            #     - frontend
            depends_on:
                - app
     
    # networks:
    #     frontend:
    #         driver: bridge
    #     backend:
    #         driver: bridge
     
    secrets:
        pg_admin_pw:
            file: ~/.pgadminpw
     
    volumes:
        mlruns_vol:
        datapg_vol:
        condaenv_vol:
    

    hope it’s helped!, if you encounter another problem I would be glad to help you!.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search