Cannot get ChromaDB working

Added ChromaDB template to my project: https://railway.app/template/tifygm Chroma DB seems to be running fine:
INFO: [16-02-2024 12:48:08] Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit)
INFO: [16-02-2024 12:48:08] Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit)
Tried to access ChromaDB from another service with host: http://chroma.railway.internal:8000 but got no response To make it easier to debug, I created a public domain for chroma and made a curl request that works with my local Chroma DB:
curl --location 'https://chroma-staging-b1f6.up.railway.app/api/v1/collections' \
--header 'Content-Type: application/json' \
--data '{"name":"vector_db","get_or_create":true}'
curl --location 'https://chroma-staging-b1f6.up.railway.app/api/v1/collections' \
--header 'Content-Type: application/json' \
--data '{"name":"vector_db","get_or_create":true}'
Result
<h1 class="error-404">Nothing here... yet</h1>
<h1 class="error-503">Application failed to respond</h1>
<h1 class="error-404">Nothing here... yet</h1>
<h1 class="error-503">Application failed to respond</h1>
Any ideas? Documentation about the chroma template just says: "Uses official chroma docker image and mounts a volume, you can talk to chroma on internal networking port 8000." To me it looks like the internal/external domains are not succesfully linking with http://0.0.0.0:8000 Project ID: 31616189-a805-4097-9eb6-61efdf3f0920
46 Replies
Percy
Percy•10mo ago
Project ID: 31616189-a805-4097-9eb6-61efdf3f0920
Brody
Brody•10mo ago
Tried to access ChromaDB from another service with host: http://chroma.railway.internal:8000/ but got no response
what error did you get when you tried this?
AI made approachable
AI made approachableOP•10mo ago
"Fetch failed". But that was already an error of the application itself trying to access the Chroma API. What are best practices to debug internal communication? Do I need to deploy something that does a curl request?
Brody
Brody•10mo ago
giving me a better error message would surely help 🤣
AI made approachable
AI made approachableOP•10mo ago
So I guess I need to create a curl or something in my app to get a better error message? Being able to execute something via CLI in the environment/service would of course be the easiest. I am a bit confused why there does not seem to be an inbuilt option for this. But yeah will do that later. @Brody : ECONNREFUSED
Connection Test Error: AxiosError: connect ECONNREFUSED fd12:8c32:4503::2d:790b:d369:8000
at AxiosError.from (file:///app/node_modules/axios/lib/core/AxiosError.js:89:14)
at RedirectableRequest.handleRequestError (file:///app/node_modules/axios/lib/adapters/http.js:610:25)
at RedirectableRequest.emit (node:events:517:28)
at eventHandlers.<computed> (/app/node_modules/follow-redirects/index.js:38:24)
at ClientRequest.emit (node:events:517:28)
at Socket.socketErrorListener (node:_http_client:501:9)
at Socket.emit (node:events:517:28)
at emitErrorNT (node:internal/streams/destroy:151:8)
at emitErrorCloseNT (node:internal/streams/destroy:116:3)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
at Axios.request (file:///app/node_modules/axios/lib/core/Axios.js:45:41)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async file:///app/dist/api.js:15:26 {
port: 8000,
address: 'fd12:8c32:4503::2d:790b:d369',
syscall: 'connect',
code: 'ECONNREFUSED',
errno: -111,
config: {
transitional: {
silentJSONParsing: true,
forcedJSONParsing: true,
clarifyTimeoutError: false
},
adapter: [ 'xhr', 'http' ],
transformRequest: [ [Function: transformRequest] ],
transformResponse: [ [Function: transformResponse] ],
timeout: 0,
xsrfCookieName: 'XSRF-TOKEN',
xsrfHeaderName: 'X-XSRF-TOKEN',
maxContentLength: -1,
maxBodyLength: -1,
env: { FormData: [Function], Blob: [class Blob] },
validateStatus: [Function: validateStatus],
headers: Object [AxiosHeaders] {
Accept: 'application/json, text/plain, */*',
'Content-Type': undefined,
'User-Agent': 'axios/1.6.7',
'Accept-Encoding': 'gzip, compress, deflate, br'
},
method: 'get',
url: 'http://chroma.railway.internal:8000/docs';,
data: undefined
},
...
Connection Test Error: AxiosError: connect ECONNREFUSED fd12:8c32:4503::2d:790b:d369:8000
at AxiosError.from (file:///app/node_modules/axios/lib/core/AxiosError.js:89:14)
at RedirectableRequest.handleRequestError (file:///app/node_modules/axios/lib/adapters/http.js:610:25)
at RedirectableRequest.emit (node:events:517:28)
at eventHandlers.<computed> (/app/node_modules/follow-redirects/index.js:38:24)
at ClientRequest.emit (node:events:517:28)
at Socket.socketErrorListener (node:_http_client:501:9)
at Socket.emit (node:events:517:28)
at emitErrorNT (node:internal/streams/destroy:151:8)
at emitErrorCloseNT (node:internal/streams/destroy:116:3)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
at Axios.request (file:///app/node_modules/axios/lib/core/Axios.js:45:41)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async file:///app/dist/api.js:15:26 {
port: 8000,
address: 'fd12:8c32:4503::2d:790b:d369',
syscall: 'connect',
code: 'ECONNREFUSED',
errno: -111,
config: {
transitional: {
silentJSONParsing: true,
forcedJSONParsing: true,
clarifyTimeoutError: false
},
adapter: [ 'xhr', 'http' ],
transformRequest: [ [Function: transformRequest] ],
transformResponse: [ [Function: transformResponse] ],
timeout: 0,
xsrfCookieName: 'XSRF-TOKEN',
xsrfHeaderName: 'X-XSRF-TOKEN',
maxContentLength: -1,
maxBodyLength: -1,
env: { FormData: [Function], Blob: [class Blob] },
validateStatus: [Function: validateStatus],
headers: Object [AxiosHeaders] {
Accept: 'application/json, text/plain, */*',
'Content-Type': undefined,
'User-Agent': 'axios/1.6.7',
'Accept-Encoding': 'gzip, compress, deflate, br'
},
method: 'get',
url: 'http://chroma.railway.internal:8000/docs';,
data: undefined
},
...
This /docs route serves the swagger docs for chroma and works perfectly fine on my local installation
AI made approachable
AI made approachableOP•10mo ago
Both services are in my staging environment, so they should be able to talk to each other.
No description
Brody
Brody•10mo ago
connection refused means chroma isn't listening on an ipv6 address
AI made approachable
AI made approachableOP•10mo ago
Ok, thx. Sadly I cannot figure out how to change that.
Brody
Brody•10mo ago
you'd need to change the default start command
AI made approachable
AI made approachableOP•10mo ago
I was looking at that. But the Railway UI is not showing it to me.
Brody
Brody•10mo ago
I'm talking about the default start command in use by the image itself
AI made approachable
AI made approachableOP•10mo ago
Basically, create my own version of the image, right?
Brody
Brody•10mo ago
not at all but upon further inspection there's a CHROMA_HOST_ADDR environment variable though I'm very curious as to why you think that would be necessary when you know that you can set the start command in the service settings (not that it's needed at this point since there is an applicable environment variable)
AI made approachable
AI made approachableOP•10mo ago
Because I am a noob. All devops topics are new to me.
Brody
Brody•10mo ago
fair enough did you have an idea of what to set that environment variable to?
AI made approachable
AI made approachableOP•10mo ago
Tried: CHROMA_HOST_ADDR=:: But does not help. I also found that one before and could not make it work.
Brody
Brody•10mo ago
more specifically why didn't it help, what changed? what errors did you get?
AI made approachable
AI made approachableOP•10mo ago
Still the same error: {"message":"Connection failed","error":"connect ECONNREFUSED fd12:8c32:4503::2d:8e35:dc90:8000"} And deploy logs still show: [17-02-2024 16:26:44] Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit) Shouldn't it be like this: "Server running at http://:::3100/" ?
Brody
Brody•10mo ago
probably, yeah. show me how and where you set that environment variable
AI made approachable
AI made approachableOP•10mo ago
No description
AI made approachable
AI made approachableOP•10mo ago
And then I applied the changes
Brody
Brody•10mo ago
did you originally deploy this from a template?
Brody
Brody•10mo ago
maybe the author has set a start command for it, please check that
AI made approachable
AI made approachableOP•10mo ago
Just made a fresh deploy from the template, so that I did not overwrite anything, but there seems to be nothing - No startup command - No variables
No description
Brody
Brody•10mo ago
alright, I'm out of ideas, I shall deploy this myself and play around with it when I'm back at my computer
AI made approachable
AI made approachableOP•10mo ago
Thx a lot! I get the feeling the author was a bit lazy and just created the tempalte (to get the rev share) without actually testing it himself And templates have no rating feature so people could leave feedback
Brody
Brody•10mo ago
I was just typing to say something similar.. the template not coming with any variables what so ever is kinda lazy, they mention being able to connect to it via the private network, but that doesn't work, and there's not even convenience variables that build you public and private urls like what the official databases have not to mention it doesn't even come with token authentication enabled, so I think you're right on the money with your reasoning
AI made approachable
AI made approachableOP•10mo ago
There are a lot of templates like this. "Chatbot-UI" is another example.
Brody
Brody•10mo ago
yeah I know, there's far more lower quality templates than you'd ever imagine, for reasons a lot more complex then this as well. sadly there's no template policy (other than tos) so railway can't just remove a template unless it breaks tos
AI made approachable
AI made approachableOP•10mo ago
Can I add another one for the same service and just call ist "Chatbot-UI (actually working)"? Because I made a working chatbot-ui template.
Brody
Brody•10mo ago
that's honestly a hard subject for example, I have a typebot template, it (imo) is very high quality and fully up to date, yet there exists a direct republish of the template named "typebot (updated)" or something, yet mine definitely is up to date in every way possible
AI made approachable
AI made approachableOP•10mo ago
Ok, yeah that sucks if someone abuses it. They should really add a simple "upvote/downvote" feature instead of only showing if it deployed succesfully (which means nothing)
Brody
Brody•10mo ago
eventually there will be policies in place for duplicates, extremely low quality, outright broken, etc that will allow railway to take down the templates but for now, I'm really not sure what the best move is in the case where you want to publish a template that is intended to replace a pre-existing low quality template at the very least don't put "(actually works)" in the title as that's extremely unprofessional, despite it's truth
AI made approachable
AI made approachableOP•10mo ago
Yeah maybe more something like Chatbot-UI (incl. supabase connection + database setup)
Brody
Brody•10mo ago
oh question on that, why supabase? why not postgres on railway?
AI made approachable
AI made approachableOP•10mo ago
That is not my choice. Chatbot-UI currently requires supabase Even if you run it locally That is why it is hard to setup and nothing works without env variables + bash scripts being run on deployment
Brody
Brody•10mo ago
ah it uses supabase for more than just a postgres database?
AI made approachable
AI made approachableOP•10mo ago
Yeah also sending out confirmation emails for new users etc. But not that I know the details. I did not create the project, just using it
Brody
Brody•10mo ago
one day you'll be able to run supabase on railway!
AI made approachable
AI made approachableOP•10mo ago
There is a docker version of it. Might already be doable. But I am not going to try 😛
Brody
Brody•10mo ago
its not, there are two services that require mounting a single volume to the two services, something that railway does not yet support doing at the moment update, the changes to allow setting the host chroma runs on with environment variables where changes that where only made last week, and a new image has not been since published, will get you a solution to change the host for the latest release though environment variables
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
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
start command
uvicorn chromadb.app:app --workers 1 --host :: --port $PORT --proxy-headers --log-config chromadb/log_config.yml --timeout-keep-alive 30
uvicorn chromadb.app:app --workers 1 --host :: --port $PORT --proxy-headers --log-config chromadb/log_config.yml --timeout-keep-alive 30
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 wont work, its one or the other, :: for private network, 0.0.0.0 for public and im fairly certain the volume should instead be mounted to /chroma/chroma
AI made approachable
AI made approachableOP•10mo ago
@Brody : Wow thank you so much! Will check it out tomorrow
Brody
Brody•10mo ago
happy to help, I haven't tested it myself but I know from many past experiences with uvicorn that if it's logging that it's listening on [::] (it is) it will work through the private network (only)
AI made approachable
AI made approachableOP•10mo ago
Internal communication is working! Still have some other issues, but I am sure I can solve those 🙂 Thx again!
Brody
Brody•10mo ago
awesome!
Want results from more Discord servers?
Add your server