Connection errors with Chroma template

mgburnsHOBBY

a year ago

I'm attempting to deploy the Chroma template (https://railway.app/template/tifygm) and connect it to a Flask app.

Connection code:

import chromadb

db = chromadb.HttpClient(host=os.getenv('CHROMA_DB_HOST', 'chroma.railway.internal'))

Primary Error:

urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='chroma.railway.internal', port=8000): Max retries exceeded with url: /api/v1/tenants/default_tenant (Caused by NameResolutionError(": Failed to resolve 'chroma.railway.internal' ([Errno -2] Name or service not known)"))

I set up a simple repro here:

Clearly an issue with the Private Network. Not sure if it's a bug with the template or something wrong with my setup. Any help would be much appreciated!

Solved

4 Replies

a year ago

Not an issue with the private network, and not a bug with the template, it's simply misconfigured.

To get this working on the chroma you will need to set these environment variables on the chroma service -

IS_PERSISTENT=1
CHROMA_SERVER_AUTH_CREDENTIALS=test-token
CHROMA_SERVER_AUTH_CREDENTIALS_PROVIDER=chromadb.auth.token.TokenConfigServerAuthCredentialsProvider
CHROMA_SERVER_AUTH_PROVIDER=chromadb.auth.token.TokenAuthServerProvider
CHROMA_SERVER_AUTH_TOKEN_TRANSPORT_HEADER=X_CHROMA_TOKEN
CHROMA_PUBLIC_URL=https://${{RAILWAY_PUBLIC_DOMAIN}}
PORT=8000
CHROMA_PRIVATE_URL=http://${{RAILWAY_PRIVATE_DOMAIN}}:${{PORT}}
ANONYMIZED_TELEMETRY=False

Make sure to set a proper CHROMA_SERVER_AUTH_CREDENTIALS variable.

Set this as the start command -

/bin/sh -c "exec uvicorn chromadb.app:app --workers 1 --host :: --port $PORT --proxy-headers --log-config chromadb/log_config.yml --timeout-keep-alive 30"

Make sure to account for the incorrect formatting this forum is doing to that code block.

Keep in mind uvicorn does not support dual-stack binding, so while this will work to get communication on the (ipv6) private network working, communication from the (ipv4) public network won't work, it's one or the other, :: for the private network, 0.0.0.0 for the public network.

And I'm fairly certain the volume should instead be mounted to /chroma/chroma


Status changed to Solved railway[bot] about 1 year ago


mgburnsHOBBY

a year ago

Hero! I'll give that a shot and report back.

Forgive my naivety (Railway newcomer!) -- how does template documentation work? I would never have figured any of that out independently, and I'm wondering if that is something that can be documented or linked to in the template page?


a year ago

I don't own that template, I don't have any control over it unless it breaks ToS.

But all that information was gathered from me simply reading Chroma's own documentation.


a year ago

Please use the correct start command that I gave, along with setting the environment variables I gave.

I had to delete your message because you provided incorrect information.


Connection errors with Chroma template - Railway Help Station