Setting Up a Self-Hosted NIM MSA Server🔗
If you want to use the Hub's MSA Service with NVIDIA NIM but don't yet have an MSA server available, this guide walks you through deploying a self-hosted NVIDIA NIM MSA Search service using Docker Compose.
The setup uses the NIM container for MSA search and a Caddy reverse proxy for CORS handling, making the service accessible to the Hub on port 8080.
Prerequisites🔗
Hardware🔗
- An NVIDIA GPU instance (e.g. AWS
g6e.2xlargewith NVIDIA L40S Tensor Core GPU, or equivalent) - At least 2 TB of storage for the MSA database cache
- The instance must be reachable from the Hub on port 8080
Software🔗
- Docker
- Docker Compose
- NVIDIA Container Toolkit (provides the
nvidiacontainer runtime)
NVIDIA NGC API Key🔗
An NGC API key is required to pull the NIM container image and download model data at startup.
You can generate one at NGC under your account settings.
Warning
Keep your NGC API key secure. Do not commit it to version control or share it publicly.
Setup🔗
Create a directory for the deployment files:
mkdir nim-msa && cd nim-msa
The directory will contain three files:
nim-msa/
├── .env
├── Caddyfile
└── compose.yaml
1. Create compose.yaml🔗
services:
nim:
image: nvcr.io/nim/colabfold/msa-search:2.1
runtime: nvidia
environment:
- NGC_API_KEY=${NGC_API_KEY}
volumes:
- ${LOCAL_NIM_CACHE}:/opt/nim/.cache
ports:
- "8000:8000"
caddy:
image: caddy:2
ports:
- "8080:8080"
volumes:
- ./Caddyfile:/etc/caddy/Caddyfile:rw
depends_on:
- nim
Tip
Check the NVIDIA NIM MSA Search releases for the latest available version and update the image tag accordingly.
2. Create Caddyfile🔗
The Caddy reverse proxy listens on port 8080 and forwards requests to the NIM service on port 8000. It also handles CORS headers for local development access.
:8080 {
@localdev header_regexp Origin ^https?://(localhost|127\.0\.0\.1)(:\d+)?$
@preflight method OPTIONS
handle @preflight {
header @localdev Access-Control-Allow-Origin "{header.Origin}"
header @localdev Access-Control-Allow-Credentials "true"
header @localdev Access-Control-Allow-Methods "GET, POST, PUT, PATCH, DELETE, OPTIONS"
header @localdev Access-Control-Allow-Headers "Authorization, Content-Type, Accept, Origin, X-Requested-With, nvcf-poll-seconds"
header @localdev Access-Control-Max-Age "86400"
header @localdev Vary "Origin"
respond "" 204
}
route {
header @localdev {
Access-Control-Allow-Origin "{header.Origin}"
Access-Control-Allow-Credentials "true"
Vary "Origin"
}
reverse_proxy nim:8000
}
}
3. Create .env🔗
NGC_API_KEY=your-ngc-api-key-here
LOCAL_NIM_CACHE=/data/nim
Replace your-ngc-api-key-here with your actual NGC API key.
Set LOCAL_NIM_CACHE to the mount path of your large storage volume. The NIM service downloads and caches MSA databases here (up to 2 TB).
4. Start the Services🔗
docker compose up -d
The NIM container will download the MSA database on first startup, which may take some time depending on network speed.
You can follow the logs to monitor progress:
docker compose logs -f nim
5. Verify the Service🔗
Once the NIM container is healthy, confirm the service is reachable:
curl http://localhost:8080/v1/health/ready
Connecting the Hub to the MSA Server🔗
Once the NIM MSA server is running, configure the Hub to use it as an MSA provider. Set the URL to the address of the server on port 8080.
- For Docker deployments, see MSA Server Configuration.
- For Kubernetes deployments, see MSA Server Configuration.
Managing the Service🔗
Stop the services:
docker compose stop
Start the services again:
docker compose start
Remove the services entirely:
docker compose down
Info
Stopping or removing the containers does not delete the cached MSA databases. The cache persists on the host volume at the path specified by LOCAL_NIM_CACHE.