mirror of
https://github.com/Toumash/mlflow-docker
synced 2025-11-04 23:29:19 +01:00
Compare commits
9 Commits
1.0
...
feature/10
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6a93c977e4 | ||
|
|
b6ecfe7d0c | ||
|
|
fcd3393fa5 | ||
|
|
14df7c707e | ||
|
|
7506d3e43d | ||
|
|
8f3d6ba7e2 | ||
|
|
81e373d6fb | ||
|
|
eebc9d0c46 | ||
|
|
bddbec77f1 |
22
Caddyfile
Normal file
22
Caddyfile
Normal 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
|
||||||
|
}
|
||||||
|
}
|
||||||
11
README.md
11
README.md
@@ -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.
|
||||||
|
|
||||||
|
[](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
38
create_bucket.py
Normal 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)
|
||||||
@@ -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:
|
||||||
@@ -37,14 +54,16 @@ services:
|
|||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
ports:
|
ports:
|
||||||
- "5000:5000"
|
- "5000:5000"
|
||||||
environment:
|
environment:
|
||||||
- AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}
|
- AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}
|
||||||
- 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:
|
||||||
|
|||||||
@@ -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
6
run_create_bucket.sh
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -o allexport; source .env; set +o allexport
|
||||||
|
|
||||||
|
pip3 install Minio
|
||||||
|
python3 ./create_bucket.py
|
||||||
Reference in New Issue
Block a user