
Google Vertex AI is Google Cloud's managed machine learning platform that provides experiment tracking, training jobs, pipelines, a model registry, and model serving as hosted services within the GCP ecosystem. It abstracts infrastructure management but ties teams to GCP-specific APIs, per-use compute billing, and Google's tooling.
ClearML is an open-source MLOps platform that delivers experiment management, distributed training coordination, pipeline orchestration, and model serving without requiring a cloud provider account. It deploys on any Docker host or Kubernetes cluster, captures training metrics automatically without code changes, and keeps all data within the team's own infrastructure.
This article explains how to deploy ClearML Server using Docker Compose with Traefik as a reverse proxy, configure agents for remote execution, and run machine learning workflows. It covers experiment tracking, pipeline creation, hyperparameter optimization, model serving with Triton, and migration strategies from Google Vertex AI.
ClearML maps directly to Vertex AI components, providing equivalent functionality through a self-hosted, cloud-agnostic platform.
The ClearML architecture consists of:
Before you begin, you need to:
app.clearml.example.com (Web UI), api.clearml.example.com (API server), and files.clearml.example.com (file server).The ClearML Server does not require a GPU instance. Deploy ClearML Agents on GPU-enabled instances to handle compute-intensive training tasks.
ClearML Server runs as a multi-container application with Elasticsearch for indexing, MongoDB for metadata, and Redis for caching. Traefik handles HTTPS termination and routes traffic to the appropriate service.
Increase the virtual memory limit for Elasticsearch.
Apply the sysctl configuration.
Restart the Docker service to apply memory changes.
Create the directory structure for persistent storage.
data/elastic_7: Elasticsearch index storagedata/mongo_4: MongoDB database filesdata/redis: Redis cache persistencedata/fileserver: Uploaded artifacts and modelslogs: Service log filesconfig: Configuration filesSet ownership to match the container user IDs.
Create the project directory.
Navigate to the project directory.
Download the official ClearML Docker Compose file.
Open the Docker Compose file to modify port mappings and network configuration.
Locate each ports: block under the apiserver, webserver, and fileserver services and comment them out by adding # at the beginning of each line. Traefik handles external routing, so direct port exposure is not needed.
Locate the networks block at the bottom of the file and update it to use named bridge networks:
Save and close the file.
Create the environment file for ClearML service URLs. Replace clearml.example.com with your domain.
Add the following configuration:
Save and close the file.
Start the ClearML services.
Verify all containers are running.
The output displays containers for clearml-webserver, clearml-apiserver, clearml-fileserver, clearml-mongo, clearml-elastic, and clearml-redis.
Check the logs for startup errors.
For more information on managing Docker Compose stacks, see the How To Use Docker Compose article.
Traefik routes HTTPS traffic to ClearML services using subdomain-based routing. Each ClearML component receives a dedicated subdomain with automatic Let's Encrypt certificate management.
Create the Traefik directory.
Navigate to the Traefik directory.
Create the Let's Encrypt storage directory.
Create the certificate storage file.
Restrict the file permissions so only the owner can read and write it. Let's Encrypt requires this permission level before it writes any certificate data.
Create the Traefik environment file. Replace admin@example.com with your email address for Let's Encrypt notifications.
Add the following configuration:
Save and close the file.
Create the Traefik Docker Compose file.
Add the following configuration:
Save and close the file.
Create the Traefik dynamic configuration file. Replace clearml.example.com with your domain.
Add the following routing rules:
Save and close the file.
Start Traefik.
Verify Traefik obtained the SSL certificates.
The output indicates certificate generation for each subdomain.
The ClearML Web UI provides initial setup and ongoing configuration management through a browser-based interface.
Open a web browser and navigate to the ClearML Web UI at https://app.clearml.example.com.
Create the administrator account on first access:
admin).Navigate to Settings in the left sidebar.
Click Workspace to view the workspace configuration.
Click Create new credentials to generate API credentials.
Copy and save the credentials block. This contains the API access key and secret key required for agent and SDK configuration.
The credentials block follows this format:
ClearML Agent transforms any machine into a remote worker that pulls tasks from queues and executes them with full environment reproducibility. The agent manages virtual environments, GPU allocation, and code versioning automatically.
You can run the ClearML Agent on the same server as the ClearML Server or on a dedicated machine. For GPU workloads, deploy agents on GPU-enabled instances.
Create the agent directory.
Navigate to the agent directory.
Install the Python virtual environment package.
Create and activate a virtual environment.
Install the ClearML Agent package.
Initialize the agent configuration.
The command starts an interactive setup. When prompted:
The agent saves the configuration to ~/clearml.conf.
Start the agent in daemon mode on the default queue.
For GPU workloads, specify GPU indices:
Verify the agent registered in the ClearML Web UI by navigating to Workers & Queues and selecting the Workers tab.
The ClearML SDK instruments Python scripts for automatic experiment tracking, logging hyperparameters, metrics, code versions, and model artifacts without code changes.
Ensure the virtual environment is active.
Install the ClearML SDK and common data science dependencies.
Configure the SDK connection to your ClearML Server.
Paste the credentials block from the ClearML Web UI when prompted. The configuration saves to ~/clearml.conf.
ClearML tracks every script execution as a task, automatically logging hyperparameters, metrics, code changes, and artifacts. The following experiment trains a Random Forest classifier to verify the server connection and demonstrate the tracking workflow.
Create a directory for experiments.
Navigate to the experiments directory.
Create the experiment script.
Add the following code:
Save and close the file.
Run the experiment.
The output displays a task URL. Open the URL to view the experiment in the ClearML Web UI.
Open the ClearML Web UI and navigate to the ClearML Tutorial project to view the experiment details.
The web interface organizes experiment data into tabs:
ClearML Pipelines chain tasks into a Directed Acyclic Graph (DAG) where step outputs feed into downstream inputs. The pipeline controller manages execution order, caching, and data flow between steps.
Navigate to the experiments directory.
Create the pipeline script.
Add the following code:
Save and close the file.
Run the pipeline.
View the pipeline execution graph in the ClearML Web UI under the ClearML Tutorial project.
Hyperparameter Optimization (HPO) automates the search for optimal model parameters by spawning experiment variations. ClearML clones a baseline experiment, modifies parameters according to defined search ranges, and tracks each trial independently.
Navigate to the experiments directory.
Create the HPO script.
Add the following code:
Save and close the file.
Run the optimization.
Monitor the optimization progress in the ClearML Web UI under ClearML Tutorial.
ClearML Serving provides model deployment with Triton inference server support. It enables production endpoints with versioning, monitoring, and automatic model updates.
Navigate to the project directory.
Clone the ClearML Serving repository.
Install the ClearML Serving package.
Create a serving service.
Copy the Serving Service ID from the output for use in subsequent steps.
Open the serving environment file.
Update the configuration with your ClearML server details. Replace the placeholders with your actual values.
Replace:
clearml.example.com with your domain.YOUR_ACCESS_KEY with your ClearML API access key.YOUR_SECRET_KEY with your ClearML API secret key.SERVING_SERVICE_ID with the ID from the previous step.Save and close the file.
Start the serving stack.
Install the PyTorch example dependencies.
Train and register a sample model.
Navigate to the task's Artifacts tab in the ClearML Web UI and copy the Model ID.
Add the model endpoint to the serving service. Replace SERVING_SERVICE_ID and MODEL_ID with your actual values.
Restart the serving containers to load the new endpoint.
Test the inference endpoint. Replace SERVER-IP with your server's IP address.
Validate the complete ClearML deployment by testing each component's functionality.
Navigate to https://app.clearml.example.com and verify you can log in and view projects.
Verify the API server responds.
Confirm the file server is accessible.
Navigate to Workers & Queues in the Web UI and confirm the agent appears under the Workers tab.
Confirm the first experiment appears in the ClearML Tutorial project with metrics, artifacts, and execution details.
Clone an experiment in the Web UI, modify a hyperparameter, and enqueue it. Verify the agent picks up and executes the task.
Migrating from Vertex AI to ClearML shifts workflows from a managed cloud service to a self-hosted, infrastructure-agnostic platform.
Vertex AI experiments use the google.cloud.aiplatform SDK with experiment tracking and metadata logging.
google.cloud.aiplatform experiment tracking with clearml.Task.Vertex AI uses Custom Training Jobs via the google.cloud.aiplatform SDK to launch managed training workloads.
google.cloud.aiplatform.CustomJob with clearml.Task.task.execute_remotely() or enqueue through the Web UI. Agents running on any infrastructure pick up and execute tasks.Vertex AI Workbench provides managed Jupyter notebook environments integrated with Vertex AI services.
Task.init() works identically from notebooks and automatically tracks cells, metrics, and outputs.Vertex AI pipelines are built on Kubeflow Pipelines and use a DSL defined in Python.
PipelineController or the @pipeline decorator.Vertex AI uses Vizier for hyperparameter tuning, integrated with training job submissions.
HyperParameterOptimizer.Vertex AI Model Registry serves as a central repository to manage the lifecycle of your machine learning models.
OutputModel for automatic model tracking.Vertex AI Endpoints is the managed service within Google Cloud's Vertex AI platform designed for hosting and serving machine learning models.
Vertex AI integrates with Google Cloud Storage for data access and uses datasets and metadata tracking via the google.cloud.aiplatform SDK.
GCS paths directly. Continue using existing buckets or migrate to any object storage.google-cloud-aiplatform and related Vertex AI SDK usage with the clearml package. ClearML offers a simpler, more unified API with less boilerplate.clearml.conf or environment variables (CLEARML_API_ACCESS_KEY, CLEARML_API_SECRET_KEY).AIP_*) and conventions for inputs/outputs in custom jobs and predictions. ClearML agents work with standard Python environments and any Docker container without requiring Vertex-specific environment variables or conventions.Cloud Logging and Cloud Monitoring) with ClearML’s built-in Scalars, Plots, and hardware monitoring dashboards.requirements.txt from the task environment; Docker base images can be set per task under the execution settings.mlflow.log_* calls route to ClearML without requiring a full SDK rewrite.You have successfully deployed ClearML Server with Traefik reverse proxy, configured agents for remote execution, and executed machine learning workflows including experiment tracking, pipelines, hyperparameter optimization, and model serving. For more information, visit the official ClearML documentation.
0 Comments
Be the first to comment and share your perspective with the community.