-
Notifications
You must be signed in to change notification settings - Fork 2
Add mlflow services and config #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# connection settings | ||
DOMAIN_NAME=localhost | ||
SERVICE_NAME=mlflow | ||
SERVICE_PORT=5000 | ||
# tell the user where they are logging into | ||
REALM=testsite | ||
# required for letsencrypt certificate email updates | ||
EMAIL_ADDRESS= | ||
|
||
# database settings | ||
POSTGRES_USER= | ||
POSTGRES_PASSWORD= | ||
POSTGRES_HOST= | ||
POSTGRES_PORT= | ||
POSTGRES_DB= |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -131,3 +131,5 @@ dmypy.json | |
|
||
# Pyre type checker | ||
.pyre/ | ||
.history/ | ||
.devcontainer/ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
# MLflow Production Docker | ||
# traefik-basic-auth | ||
|
||
Traefik in Docker with HTTP basic auth configured. | ||
MLflow Production Docker | ||
|
||
A production ready<sup>1</sup> docker-compose deployment of MLflow using Traefik with HTTP Basic Auth. | ||
|
||
|
@@ -38,6 +41,15 @@ SERVICE_PORT=5000 | |
REALM=testsite | ||
# required for letsencrypt certificate email updates | ||
EMAIL_ADDRESS=example@example.com | ||
# Database settings | ||
POSTGRES_USER= | ||
POSTGRES_PASSWORD= | ||
POSTGRES_HOST= | ||
POSTGRES_PORT= | ||
POSTGRES_DB= | ||
# Mlflow settings | ||
MLFLOW_ARTIFACT_URI=s3://bucket-name/ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not in the env sample |
||
# If using bentoml for deployment | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ? |
||
``` | ||
|
||
Finally write a `traefik.yml` config file using the `.env` variables: | ||
|
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,14 @@ | ||||||||
FROM python:3.8-slim-buster | ||||||||
|
||||||||
ENV PYTHONBUFFERED 1 | ||||||||
|
||||||||
COPY requirements.txt / | ||||||||
RUN pip install -r requirements.txt | ||||||||
|
||||||||
COPY ./entrypoint /entrypoint | ||||||||
RUN sed -i 's/\r$//g' /entrypoint && chmod +x /entrypoint | ||||||||
|
||||||||
COPY ./start /start | ||||||||
RUN sed -i 's/\r$//g' /start && chmod +x /start | ||||||||
|
||||||||
ENTRYPOINT [ "/entrypoint" ] | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,15 @@ | ||||||
#!/bin/bash | ||||||
|
||||||
set -euo pipefail | ||||||
|
||||||
export DATABASE_URL="postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}" | ||||||
|
||||||
|
||||||
until nc -z postgres:5432 > /dev/null 2>&1; do | ||||||
>&2 echo 'Sleeping till postgres is ready...' | ||||||
sleep 1 | ||||||
done | ||||||
>&2 echo 'PostgreSQL is available' | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
this isnt an error, should go to stdout |
||||||
|
||||||
|
||||||
exec "$@" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
|
||
--- | ||
version: "3" | ||
|
||
volumes: | ||
traefik_acme_data: {} | ||
local_postgres_data: {} | ||
|
||
services: | ||
traefik: | ||
build: | ||
context: . | ||
dockerfile: ./dockerfiles/traefik/Dockerfile | ||
image: mlflow_production_traefik | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. image names clash with prod file, will cause overwrite |
||
restart: always | ||
volumes: | ||
- traefik_acme_data:/etc/traefik/acme/ | ||
- ./config/.htpasswd:/etc/traefik/.htpasswd:ro | ||
- ./config/traefik.yml:/etc/traefik/traefik.yml:ro | ||
ports: | ||
- "0.0.0.0:80:8080" | ||
- "0.0.0.0:443:8443" | ||
|
||
|
||
mlflow: | ||
build: | ||
context: . | ||
dockerfile: ./dockerfiles/mlflow/Dockerfile | ||
image: mlflow_production_server | ||
restart: always | ||
command: /start | ||
ports: | ||
- "5000:5000" | ||
depends_on: | ||
- postgres | ||
env_file: | ||
- .env | ||
|
||
postgres: | ||
image: postgres:11.8 | ||
restart: always | ||
env_file: | ||
- .env | ||
ports: | ||
- "5432:5432" | ||
volumes: | ||
- local_postgres_data:/var/lib/postgresql/data | ||
Comment on lines
+39
to
+47
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is the only change over the other file, just drop in a new docker-compose-local.yml file and can run docker-compose up with both rather than copy paste |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
--- | ||
version: "3" | ||
|
||
volumes: | ||
traefik_acme_data: {} | ||
|
||
services: | ||
traefik: | ||
build: | ||
context: . | ||
dockerfile: ./dockerfiles/traefik/Dockerfile | ||
image: mlflow_production_traefik | ||
restart: always | ||
volumes: | ||
- traefik_acme_data:/etc/traefik/acme/ | ||
- ./config/.htpasswd:/etc/traefik/.htpasswd:ro | ||
- ./config/traefik.yml:/etc/traefik/traefik.yml:ro | ||
ports: | ||
- "0.0.0.0:80:8080" | ||
- "0.0.0.0:443:8443" | ||
|
||
mlflow: | ||
build: | ||
context: . | ||
dockerfile: ./dockerfiles/mlflow/Dockerfile | ||
image: mlflow_production_server | ||
restart: always | ||
command: /start | ||
env_file: | ||
- .env |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
alembic==1.4.1 | ||
azure-core==1.8.1 | ||
azure-storage-blob==12.5.0 | ||
boto3==1.15.3 | ||
botocore==1.18.3 | ||
certifi==2020.6.20 | ||
cffi==1.14.3 | ||
chardet==3.0.4 | ||
click==7.1.2 | ||
cloudpickle==1.6.0 | ||
cryptography==3.1.1 | ||
databricks-cli==0.11.0 | ||
docker==4.3.1 | ||
entrypoints==0.3 | ||
Flask==1.1.2 | ||
gitdb==4.0.5 | ||
GitPython==3.1.8 | ||
gorilla==0.3.0 | ||
gunicorn==20.0.4 | ||
idna==2.10 | ||
isodate==0.6.0 | ||
itsdangerous==1.1.0 | ||
Jinja2==2.11.2 | ||
jmespath==0.10.0 | ||
Mako==1.1.3 | ||
MarkupSafe==1.1.1 | ||
mlflow==1.11.0 | ||
msrest==0.6.19 | ||
numpy==1.19.2 | ||
oauthlib==3.1.0 | ||
pandas==1.1.2 | ||
prometheus-client==0.8.0 | ||
prometheus-flask-exporter==0.18.0 | ||
protobuf==3.13.0 | ||
psycopg2-binary==2.8.6 | ||
pycparser==2.20 | ||
python-dateutil==2.8.1 | ||
python-editor==1.0.4 | ||
pytz==2020.1 | ||
PyYAML==5.3.1 | ||
querystring-parser==1.2.4 | ||
requests==2.24.0 | ||
requests-oauthlib==1.3.0 | ||
s3transfer==0.3.3 | ||
six==1.15.0 | ||
smmap==3.0.4 | ||
SQLAlchemy==1.3.13 | ||
sqlparse==0.3.1 | ||
tabulate==0.8.7 | ||
urllib3==1.25.10 | ||
websocket-client==0.57.0 | ||
Werkzeug==1.0.1 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/bash | ||
|
||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
|
||
DB_URI=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB} | ||
mlflow db upgrade $DB_URI | ||
|
||
mlflow server \ | ||
--backend-store-uri ${DB_URI} \ | ||
--default-artifact-root ${MLFLOW_ARTIFACT_URI} \ | ||
--host 0.0.0.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
git issues