-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7c03558
commit bc75ad7
Showing
4 changed files
with
87 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
FROM python:3.8-slim | ||
|
||
# displays logs imidietly to the stream, they wont be part of the buffer | ||
ENV PYTHONUNBUFFERED True | ||
ENV GCP_PROJECT="783282864357" | ||
|
||
WORKDIR /app | ||
|
||
COPY ./requirements.txt ./requirements.txt | ||
|
||
RUN pip install -r requirements.txt | ||
|
||
COPY get_secret.py /app/get_secret.py | ||
COPY entry-point.sh /app/entry-point.sh | ||
COPY mlflow_auth.py /app/mlflow_auth.py | ||
|
||
ENTRYPOINT ["/usr/bin/env", "bash", "/app/entry-point.sh"] | ||
|
||
EXPOSE 8080 | ||
EXPOSE 8000/tcp | ||
CMD [ "--backend-store-uri", "/tmp"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
service: mlflow | ||
runtime: custom | ||
env: flex | ||
automatic_scaling: | ||
min_num_instances: 1 | ||
max_num_instances: 2 | ||
beta_settings: | ||
cloud_sql_instances: broad-ml4cvd:us-central1:broad-ml4cvd-staging-db |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
# Verify that all required variables are set | ||
if [[ -z "${GCP_PROJECT}" ]]; then | ||
echo "Error: GCP_PROJECT not set" | ||
exit 1 | ||
fi | ||
|
||
# Fetch secrets from Secret Manager in CGP | ||
export MLFLOW_TRACKING_USERNAME="$(python3 /app/get_secret.py --project="${GCP_PROJECT}" --secret=mlflow_tracking_username)" | ||
export MLFLOW_TRACKING_PASSWORD="$(python3 /app/get_secret.py --project="${GCP_PROJECT}" --secret=mlflow_tracking_password)" | ||
export ARTIFACT_URL="$(python3 /app/get_secret.py --project="${GCP_PROJECT}" --secret=mlflow_artifact_url)" | ||
if [[ -z "${DATABASE_URL}" ]]; then # Allow overriding for local deployment | ||
export DATABASE_URL="$(python3 /app/get_secret.py --project="${GCP_PROJECT}" --secret=mlflow_database_url)" | ||
fi | ||
|
||
# Verify that all required variables are set | ||
if [[ -z "${MLFLOW_TRACKING_USERNAME}" ]]; then | ||
echo "Error: MLFLOW_TRACKING_USERNAME not set" | ||
exit 1 | ||
fi | ||
|
||
if [[ -z "${MLFLOW_TRACKING_PASSWORD}" ]]; then | ||
echo "Error: MLFLOW_TRACKING_PASSWORD not set" | ||
exit 1 | ||
fi | ||
|
||
if [[ -z "${ARTIFACT_URL}" ]]; then | ||
echo "Error: ARTIFACT_URL not set" | ||
exit 1 | ||
fi | ||
|
||
if [[ -z "${DATABASE_URL}" ]]; then | ||
echo "Error: DATABASE_URL not set" | ||
exit 1 | ||
fi | ||
|
||
if [[ -z "${PORT}" ]]; then | ||
export PORT=8080 | ||
fi | ||
|
||
export WSGI_AUTH_CREDENTIALS="${MLFLOW_TRACKING_USERNAME}:${MLFLOW_TRACKING_PASSWORD}" | ||
export _MLFLOW_SERVER_ARTIFACT_ROOT="${ARTIFACT_URL}" | ||
export _MLFLOW_SERVER_FILE_STORE="${DATABASE_URL}" | ||
|
||
echo "hello its me im the problem its me" | ||
echo ${_MLFLOW_SERVER_FILE_STORE} | ||
echo "or me" | ||
echo ${_MLFLOW_SERVER_ARTIFACT_ROOT} | ||
|
||
# Start MLflow and ngingx using supervisor | ||
exec gunicorn -b "${HOST}:${PORT}" -w 4 --log-level debug --access-logfile=- --error-logfile=- --log-level=debug mlflow_auth:app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
from mlflow.server import app as mlflow_app | ||
from wsgi_basic_auth import BasicAuth | ||
|
||
app = BasicAuth(mlflow_app) |