9 Commits

Author SHA1 Message Date
Tomasz Dłuski
6a93c977e4 provide caddyfile basic auth for the mlflow 2021-11-19 22:16:07 +01:00
Tomasz Dłuski
b6ecfe7d0c Merge pull request #7 from Toumash/#6
use fixed minio stable version (minio team separated console and api …
2021-07-19 12:25:36 +02:00
Tomasz Dłuski
fcd3393fa5 use fixed minio stable version (minio team separated console and api in the july feature release)
https://github.com/minio/minio/releases/tag/RELEASE.2021-07-08T01-15-01Z
2021-07-19 12:04:05 +02:00
Tomasz Dłuski
14df7c707e Merge pull request #3 from kingkastle/kingkastle-minio-methodname
minio method name is now: InvalidResponseError
2021-03-05 18:37:27 +01:00
Rafael Castillo
7506d3e43d minio method name is now: InvalidResponseError 2020-12-21 16:33:53 +01:00
Tomasz Dłuski
8f3d6ba7e2 Update README.md 2020-09-06 22:08:23 +02:00
Tomasz Dłuski
81e373d6fb Update run_create_bucket.sh 2020-09-05 16:14:53 +02:00
Tomasz Dłuski
eebc9d0c46 bugfix: adds bucket name configuration into the .env file 2020-09-05 13:58:45 +02:00
Tomasz Dłuski
bddbec77f1 adds minio autoconfigure script 2020-09-05 13:54:40 +02:00
6 changed files with 109 additions and 15 deletions

22
Caddyfile Normal file
View File

@@ -0,0 +1,22 @@
# Minio Console
s3.localhost:9001 {
handle_path /* {
reverse_proxy s3:9001
}
}
# Minio API
s3.localhost:9000 {
handle_path /* {
reverse_proxy s3:9000
}
}
mlflow.localhost {
basicauth /* {
root JDJhJDEwJEVCNmdaNEg2Ti5iejRMYkF3MFZhZ3VtV3E1SzBWZEZ5Q3VWc0tzOEJwZE9TaFlZdEVkZDhX # root hiccup
}
handle_path /* {
reverse_proxy mlflow:5000
}
}

View File

@@ -4,6 +4,8 @@ If you want to boot up mlflow project with one-liner - this repo is for you.
The only requirement is docker installed on your system and we are going to use Bash on linux/windows. The only requirement is docker installed on your system and we are going to use Bash on linux/windows.
[![Youtube tutorial](https://img.youtube.com/vi/ma5lA19IJRA/0.jpg)](https://www.youtube.com/watch?v=ma5lA19IJRA)
# Features # Features
- Setup by one file (.env) - Setup by one file (.env)
- Production-ready docker volumes - Production-ready docker volumes
@@ -24,7 +26,14 @@ Creating tracker_mlflow ... done
Creating aws-s3 ... done Creating aws-s3 ... done
``` ```
3. Create mlflow bucket. You can do it **either using AWS CLI or Python Api**. **You dont need an AWS subscription** 3. Create mlflow bucket. You can use my bundled script.
Just run
```shell
bash ./run_create_bucket.sh
```
You can also do it **either using AWS CLI or Python Api**.
<details><summary>AWS CLI</summary> <details><summary>AWS CLI</summary>
1. [Install AWS cli](https://aws.amazon.com/cli/) **Yes, i know that you dont have an Amazon Web Services Subscription - dont worry! It wont be needed!** 1. [Install AWS cli](https://aws.amazon.com/cli/) **Yes, i know that you dont have an Amazon Web Services Subscription - dont worry! It wont be needed!**

38
create_bucket.py Normal file
View File

@@ -0,0 +1,38 @@
import os
from minio import Minio
from minio.error import InvalidResponseError
accessID = os.environ.get('AWS_ACCESS_KEY_ID')
accessSecret = os.environ.get('AWS_SECRET_ACCESS_KEY')
minioUrl = os.environ.get('MLFLOW_S3_ENDPOINT_URL')
bucketName = os.environ.get('AWS_BUCKET_NAME')
if accessID == None:
print('[!] AWS_ACCESS_KEY_ID environemnt variable is empty! run \'source .env\' to load it from the .env file')
exit(1)
if accessSecret == None:
print('[!] AWS_SECRET_ACCESS_KEY environemnt variable is empty! run \'source .env\' to load it from the .env file')
exit(1)
if minioUrl == None:
print('[!] MLFLOW_S3_ENDPOINT_URL environemnt variable is empty! run \'source .env\' to load it from the .env file')
exit(1)
if bucketName == None:
print('[!] AWS_BUCKET_NAME environemnt variable is empty! run \'source .env\' to load it from the .env file')
exit(1)
minioUrlHostWithPort = minioUrl.split('//')[1]
print('[*] minio url: ',minioUrlHostWithPort)
s3Client = Minio(
minioUrlHostWithPort,
access_key=accessID,
secret_key=accessSecret,
secure=False
)
s3Client.make_bucket(bucketName)

View File

@@ -1,19 +1,35 @@
version: '3.2' version: '3.2'
services: services:
caddy:
image: caddy:2-alpine
container_name: caddy
volumes:
- ./Caddyfile:/etc/caddy/Caddyfile
- /caddy/data:/data
- /caddy/config:/config
ports:
- 80:80
- 443:443
- 9000:9000
- 9001:9001
restart: unless-stopped
s3: s3:
restart: always
image: minio/minio:latest image: minio/minio:latest
container_name: aws-s3 container_name: aws-s3
ports: ports:
- 9000:9000 - 9000
- 9001
environment: environment:
- MINIO_ACCESS_KEY=${AWS_ACCESS_KEY_ID} - MINIO_ROOT_USER=${AWS_ACCESS_KEY_ID}
- MINIO_SECRET_KEY=${AWS_SECRET_ACCESS_KEY} - MINIO_ROOT_PASSWORD=${AWS_SECRET_ACCESS_KEY}
command: command:
server /date server /date --console-address ":9001"
networks:
- A
volumes: volumes:
- ./s3:/date - ./s3:/date
networks:
- default
- proxy-net
db: db:
restart: always restart: always
image: mysql/mysql-server:5.7.28 image: mysql/mysql-server:5.7.28
@@ -28,8 +44,9 @@ services:
volumes: volumes:
- ./dbdata:/var/lib/mysql - ./dbdata:/var/lib/mysql
networks: networks:
- A - default
mlflow: mlflow:
restart: always
container_name: tracker_mlflow container_name: tracker_mlflow
image: tracker_ml image: tracker_ml
build: build:
@@ -42,9 +59,11 @@ services:
- AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY} - AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}
- AWS_DEFAULT_REGION=${AWS_REGION} - AWS_DEFAULT_REGION=${AWS_REGION}
- MLFLOW_S3_ENDPOINT_URL=http://s3:9000 - MLFLOW_S3_ENDPOINT_URL=http://s3:9000
entrypoint: mlflow server --backend-store-uri mysql+pymysql://${MYSQL_USER}:${MYSQL_PASSWORD}@db:3306/${MYSQL_DATABASE} --default-artifact-root s3://${AWS_BUCKET_NAME}/ -h 0.0.0.0
networks: networks:
- A - proxy-net
entrypoint: ./wait-for-it.sh db:3306 -t 90 -- mlflow server --backend-store-uri mysql+pymysql://${MYSQL_USER}:${MYSQL_PASSWORD}@db:3306/${MYSQL_DATABASE} --default-artifact-root s3://${AWS_BUCKET_NAME}/ -h 0.0.0.0 - default
networks: networks:
A: default:
driver: bridge proxy-net:

View File

@@ -5,7 +5,7 @@ from mlflow import mlflow,log_metric, log_param, log_artifacts
if __name__ == "__main__": if __name__ == "__main__":
with mlflow.start_run() as run: with mlflow.start_run() as run:
mlflow.set_tracking_uri('http://localhost:5000') mlflow.set_tracking_uri('https://mlflow.localhost')
print("Running mlflow_tracking.py") print("Running mlflow_tracking.py")
log_param("param1", randint(0, 100)) log_param("param1", randint(0, 100))

6
run_create_bucket.sh Normal file
View File

@@ -0,0 +1,6 @@
#!/bin/bash
set -o allexport; source .env; set +o allexport
pip3 install Minio
python3 ./create_bucket.py