Skip to content

Commit

Permalink
Add Heroku Deploy Button
Browse files Browse the repository at this point in the history
  • Loading branch information
DougTrajano committed Jul 23, 2022
1 parent 927d755 commit c9eddc7
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 18 deletions.
41 changes: 41 additions & 0 deletions app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"name": "mlflow-server",
"description": "MLflow Tracking Server with basic authentication (user/password).",
"logo": "https://mlflow.org/docs/1.27.0/_static/MLflow-logo-final-black.png",
"keywords": [
"machine learning",
"data science",
"machinelearning",
"mlflow",
"experiment tracking"
],
"repository": "https://github.com/DougTrajano/mlflow-server",
"stack": "container",
"env": {
"MLFLOW_TRACKING_PASSWORD": {
"description": "Password for mlflow web dashboard and HTTP API",
"value": "mlflow"
},
"MLFLOW_TRACKING_USERNAME": {
"description": "Username for mlflow web dashboard and HTTP API",
"value": "mlflow"
},
"MLFLOW_ARTIFACT_URI": {
"description": "URI for mlflow artifacts",
"value": "./mlruns"
},
"AWS_ACCESS_KEY_ID": {
"description": "AWS access key ID",
"value": "ACCESS_KEY_ID"
},
"AWS_SECRET_ACCESS_KEY": {
"description": "AWS secret access key",
"value": "SECRET_ACCESS_KEY"
}
},
"addons": [
{
"plan": "heroku-postgresql"
}
]
}
4 changes: 2 additions & 2 deletions heroku.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
build:
docker:
mlflow: Dockerfile
web: Dockerfile

setup:
addons:
- plan: heroku-postgresql
as: DATABASE
as: DATABASE
44 changes: 28 additions & 16 deletions scripts/mlflow.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,41 @@ if [[ -z "${MLFLOW_ARTIFACT_URI}" ]]; then
export MLFLOW_ARTIFACT_URI="./mlruns"
fi

if [[ -z "${MLFLOW_DB_DIALECT}" ]]; then
export MLFLOW_DB_DIALECT="mysql+pymysql"
if [[ -n "${DATABASE_URL}" ]]; then
export MLFLOW_BACKEND_URI="${DATABASE_URL}"
unset DATABASE_URL
fi

if [[ -z "${MLFLOW_DB_USERNAME}" ]]; then
export MLFLOW_DB_USERNAME="mlflow"
fi
if [[ -z "${MLFLOW_BACKEND_URI}" ]]; then
echo "MLFLOW_BACKEND_URI not set. Define default value based on other variables."

if [[ -z "${MLFLOW_DB_PASSWORD}" ]]; then
export MLFLOW_DB_PASSWORD="mlflow"
fi
if [[ -z "${MLFLOW_DB_DIALECT}" ]]; then
export MLFLOW_DB_DIALECT="mysql+pymysql"
fi

if [[ -z "${MLFLOW_DB_DATABASE}" ]]; then
export MLFLOW_DB_DATABASE="mlflow"
fi
if [[ -z "${MLFLOW_DB_USERNAME}" ]]; then
export MLFLOW_DB_USERNAME="mlflow"
fi

if [[ -z "${MLFLOW_DB_PORT}" ]]; then
export MLFLOW_DB_PORT=3306
fi
if [[ -z "${MLFLOW_DB_PASSWORD}" ]]; then
export MLFLOW_DB_PASSWORD="mlflow"
fi

if [[ -z "${MLFLOW_DB_DATABASE}" ]]; then
export MLFLOW_DB_DATABASE="mlflow"
fi

if [[ -z "${MLFLOW_DB_PORT}" ]]; then
export MLFLOW_DB_PORT=3306
fi

if [[ -z "${MLFLOW_BACKEND_URI}" ]]; then
echo "MLFLOW_BACKEND_URI not set. Define default value based on other variables."
export MLFLOW_BACKEND_URI=${MLFLOW_DB_DIALECT}://${MLFLOW_DB_USERNAME}:${MLFLOW_DB_PASSWORD}@${MLFLOW_DB_HOST}:${MLFLOW_DB_PORT}/${MLFLOW_DB_DATABASE}
unset MLFLOW_DB_DIALECT
unset MLFLOW_DB_USERNAME
unset MLFLOW_DB_PASSWORD
unset MLFLOW_DB_DATABASE
unset MLFLOW_DB_HOST
unset MLFLOW_DB_PORT
fi

echo "Starting mlflow server"
Expand Down

0 comments on commit c9eddc7

Please sign in to comment.