Skip to content

Commit

Permalink
feat: switched to local env variables
Browse files Browse the repository at this point in the history
  • Loading branch information
MBenediktF committed Aug 13, 2024
1 parent b6690de commit de4fc83
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 14 deletions.
5 changes: 4 additions & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
GITHUB_REGISTRY_ACCESS_TOKEN=<your_github_access_token>
GHCR_PERSONAL_ACCESS_TOKEN=g<your_github_personal_access_token>
AWS_ACCESS_KEY_ID=<aws_s3_user_access_key_id>
AWS_SECRET_ACCESS_KEY=<aws_s3_user_access_key_secret>
BUCKET_NAME=<s3_bucket_name>
24 changes: 11 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
include .env

build_mlflow_ui_container:
@docker info > /dev/null 2>&1 || (echo "Docker is not running. Please start Docker." && exit 1)
@docker build -t mlflow_s3_sync_image -f mlflow/Dockerfile mlflow
@docker save -o mlflow/mlflow_s3_sync_image.tar mlflow_s3_sync_image
@docker rmi mlflow_s3_sync_image

setup_mlflow_ui:
@docker info > /dev/null 2>&1 || (echo "Docker is not running. Please start Docker." && exit 1)
@echo "Logging in to GitHub Container Registry..."
@echo $(GHCR_PERSONAL_ACCESS_TOKEN) | docker login ghcr.io -u USERNAME --password-stdin
@echo "Grabbing the container package..."
@docker pull ghcr.io/bosch-devopsuplift/mlflow_ui_s3:main

start_mlflow_ui:
@docker info > /dev/null 2>&1 || (echo "Docker is not running. Please start Docker." && exit 1)
@if ! docker images --format "{{.Repository}}" | grep -q "^mlflow_s3_sync_image$$"; then \
if [ -f mlflow/mlflow_s3_sync_image.tar ]; then \
echo "Image mlflow_s3_sync_image not found. Loading image from mlflow_s3_sync_image.tar ..."; \
sudo docker load -i mlflow/mlflow_s3_sync_image.tar; \
else \
echo "Image mlflow_s3_sync_image not found and mlflow_s3_sync_image.tar does not exist. Please build or export the image."; \
exit 1; \
fi \
else \
echo "Image mlflow_s3_sync_image exists."; \
fi
@if docker ps -a --format '{{.Names}}' | grep -w mlflow_ui > /dev/null; then \
if docker ps --format '{{.Names}}' | grep -w mlflow_ui > /dev/null; then \
echo "Container mlflow_ui is already running."; \
Expand All @@ -26,7 +24,7 @@ start_mlflow_ui:
fi \
else \
echo "Creating and starting a new container ..."; \
docker run -d -p 4444:5000 --name mlflow_ui mlflow_s3_sync_image; \
docker run -e AWS_ACCESS_KEY_ID=$(AWS_ACCESS_KEY_ID) -e AWS_SECRET_ACCESS_KEY=$(AWS_SECRET_ACCESS_KEY) -e BUCKET_NAME=$(NUCKET_NAME) -d -p 4444:5000 --name mlflow_ui mlflow_ui_s3; \
fi
@echo "MLflow UI is running at http://localhost:4444"

Expand All @@ -38,4 +36,4 @@ remove_mlflow_ui:
@docker info > /dev/null 2>&1 || (echo "Docker is not running. Please start Docker." && exit 1)
@docker stop mlflow_ui || true
@docker rm mlflow_ui || true
@docker rmi mlflow_s3_sync_image || true
@docker rmi mlflow_ui_s3 || true
9 changes: 9 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# How to start the mlfluw ui

- Create a classic personal access token in your github developer settings (it only needs the read packages permission) and paste it to .env
- Run 'make setiup_mlflow_ui' to setup the docker container
- Add the aws key id and secrret and the bucket name to the .env file
- Run 'make start_mlflow_ui' to start the docker container
- Access the mlflow ui at localhost:4444
- Run 'make stop_mlflow_ui' to stop the docker container
- Run 'make 'remove_mlflow_ui' to delete the docker container and the image

0 comments on commit de4fc83

Please sign in to comment.