Skip to content
This repository was archived by the owner on May 10, 2024. It is now read-only.

Commit 2ba0d8d

Browse files
committed
docs: CIP-2: Auth Providers
- Removed platform specific commands. Now things are platform independent - Removed server verification with curl - no value - The default way of running Chroma is via docker compose now Refs: chroma-core/chroma#986
1 parent a1a35a5 commit 2ba0d8d

File tree

1 file changed

+5
-72
lines changed

1 file changed

+5
-72
lines changed

docs/usage-guide.md

Lines changed: 5 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -735,97 +735,30 @@ Supported authentication methods:
735735

736736
#### Server Setup
737737

738-
739738
##### Generate Server-Side Credentials
740739

741740
:::note Security Practices
742741
A good security practice is to store the password securely. In the example below we use bcrypt (currently the only supported hash in Chroma server side auth) to hash the plaintext password.
743742
:::
744743

745-
**_Linux/MacOS:_**
746-
747-
```bash
748-
export CHROMA_USER=admin
749-
export CHROMA_PASSWORD=admin
750-
docker run --rm --entrypoint htpasswd httpd:2 -Bbn ${CHROMA_USER} ${CHROMA_PASSWORD} > server.htpasswd
751-
```
752-
753-
**_Windows:_**
754-
755-
```bash
756-
set CHROMA_USER=admin
757-
set CHROMA_PASSWORD=admin
758-
759-
docker run --rm --entrypoint htpasswd httpd:2 -Bbn %CHROMA_USER% %CHROMA_PASSWORD% > server.htpasswd
760-
```
761-
762-
##### CLI
763-
764744
```bash
765-
CHROMA_SERVER_AUTH_CREDENTIALS_FILE="./server.htpasswd" \
766-
CHROMA_SERVER_AUTH_CREDENTIALS_PROVIDER='chromadb.auth.providers.HtpasswdFileServerAuthCredentialsProvider' \
767-
CHROMA_SERVER_AUTH_PROVIDER='chromadb.auth.basic.BasicAuthServerProvider' \
768-
uvicorn chromadb.app:app --workers 1 --host 0.0.0.0 --port 8000 --proxy-headers --log-config log_config.yml
745+
docker run --rm --entrypoint htpasswd httpd:2 -Bbn admin admin > server.htpasswd
769746
```
770747

771-
##### Docker
748+
##### Running the Server
772749

773-
**_Linux/MacOS:_**
750+
Create a `.chroma_env` file with the following contents:
774751

775-
```bash
776-
cat << EOF > .env
752+
```ini title=".chroma_env"
777753
CHROMA_SERVER_AUTH_CREDENTIALS_FILE="/chroma/server.htpasswd"
778754
CHROMA_SERVER_AUTH_CREDENTIALS_PROVIDER='chromadb.auth.providers.HtpasswdFileServerAuthCredentialsProvider'
779755
CHROMA_SERVER_AUTH_PROVIDER='chromadb.auth.basic.BasicAuthServerProvider'
780-
EOF
781-
782-
docker-compose up -d --build
783-
```
784-
785-
**_Windows:_**
786-
787-
```bash
788-
echo CHROMA_SERVER_AUTH_CREDENTIALS_FILE="/chroma/server.htpasswd" > .env
789-
echo CHROMA_SERVER_AUTH_CREDENTIALS_PROVIDER='chromadb.auth.providers.HtpasswdFileServerAuthCredentialsProvider' >> .env
790-
echo CHROMA_SERVER_AUTH_PROVIDER='chromadb.auth.basic.BasicAuthServerProvider' >> .env
791-
792-
docker-compose up -d --build
793-
```
794-
795-
##### Verify the Server
796-
797-
Now let's verify that the server is running and that authentication is working.
798-
799-
**Success:**
800-
801-
**_Linux/MacOS:_**
802-
803-
```bash
804-
curl -v http://localhost:8000/api/v1/collections -u admin:admin
805756
```
806757

807-
**_Windows:_**
808-
809758
```bash
810-
$headers = @{ Authorization = 'Basic ' + [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes("admin:admin")) }
811-
Invoke-RestMethod -Uri 'http://localhost:8000/api/v1/collections' -Headers $headers -Verbose
759+
docker-compose --env-file ./.chroma_env up -d --build
812760
```
813761

814-
**Auth failure:**
815-
816-
**_Linux/MacOS:_**
817-
818-
```bash
819-
curl -v http://localhost:8000/api/v1/collections -u admin:admin1
820-
```
821-
822-
**_Windows:_**
823-
824-
```bash
825-
$headers = @{ Authorization = 'Basic ' + [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes("admin:admin1")) }
826-
Invoke-RestMethod -Uri 'http://localhost:8000/api/v1/collections' -Headers $headers -Verbose
827-
````
828-
829762
#### Client Setup
830763

831764
```python

0 commit comments

Comments
 (0)