Spaces:
Sleeping
Sleeping
File size: 2,705 Bytes
287a0bc |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
{
"cells": [
{
"cell_type": "markdown",
"source": [
"# Generate a Certificate\n",
"\n",
"```bash\n",
"openssl req -new -newkey rsa:2048 -sha256 -days 365 -nodes -x509 \\\n",
" -keyout ./serverkey.pem \\\n",
" -out ./servercert.pem \\\n",
" -subj \"/O=Chroma/C=US\" \\\n",
" -config chromadb/test/openssl.cnf\n",
"```\n",
"\n",
"> Note: The above command should be executed at the root of the repo (openssl.cnf uses relative path)\n"
],
"metadata": {
"collapsed": false
},
"id": "faa8cefb6825fe83"
},
{
"cell_type": "markdown",
"source": [
"# Start the server\n",
"\n",
"```bash\n",
"uvicorn chromadb.app:app --workers 1 --host 0.0.0.0 --port 8443 \\\n",
" --proxy-headers --log-config chromadb/log_config.yml --ssl-keyfile ./serverkey.pem --ssl-certfile ./servercert.pem\n",
"```"
],
"metadata": {
"collapsed": false
},
"id": "e084285e11c3747d"
},
{
"cell_type": "markdown",
"source": [
"# Test with cert as SSL verify string"
],
"metadata": {
"collapsed": false
},
"id": "130df9c0a6d67b52"
},
{
"cell_type": "code",
"execution_count": null,
"id": "initial_id",
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"from chromadb import Settings\n",
"import chromadb\n",
"client = chromadb.HttpClient(host=\"localhost\",port=\"8443\",ssl=True, settings=Settings(chroma_server_ssl_verify='./servercert.pem'))\n",
"print(client.heartbeat())"
]
},
{
"cell_type": "markdown",
"source": [
"# Test with cert as SSL verify boolean"
],
"metadata": {
"collapsed": false
},
"id": "8223d0100df06ec4"
},
{
"cell_type": "code",
"outputs": [],
"source": [
"from chromadb import Settings\n",
"import chromadb\n",
"client = chromadb.HttpClient(host=\"localhost\",port=\"8443\",ssl=True, settings=Settings(chroma_server_ssl_verify=False))\n",
"print(client.heartbeat())"
],
"metadata": {
"collapsed": false
},
"id": "f7cf299721741c1",
"execution_count": null
},
{
"cell_type": "code",
"outputs": [],
"source": [],
"metadata": {
"collapsed": false
},
"id": "6231ac2ac38383c2"
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.6"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
|