Persys server. All services you need to run Persys locally.
Refer to the main repo for contributions and other instructions.
This README is a work in progress, more instructions to come.
Download the persys-server
code base.
git clone https://github.com/persys-ai/persys-server.git
- Copy the example environment file to create your local configuration:
cp persys-server/.env.example persys-server/.env
- Copy the hashed default password file to your data directory. This is required. Enter
persys
is the password. You can change it in your settings tab "gear icon".
cp p.json.example /path/to/data/p.json
- Configure the following environment variables in your
.env
file:
DATA_PATH
: [IMPORTANT] This is the path in your machine where you want your data to persist. Important: You need to specify this.BASE_DIR
: Base directory for data storage inside the container (default: "/data"), you probably don't need to change this unless you really need to.HOST
: Host address, find yours withhostname
orecho $HOST
(default: "localhost").MODEL_V
: Model version (default: "llama3.2:1b")EMBED_MODEL
: Embedding model name (default: "nomic-embed-text")SERVER_PORT
: Main server REST API port. Default is3000
.CHAT_PORT
: The port number for the chat applicationchat.js
. Default is9000
.RAG_PORT
: The port number for the Retrieval Augmentation Generation applicationrag.js
. Default is7000
.MONITOR_PORT
: The port number for the system monitorstats.js
application (will be renamed tomonitor.js
eventually).OLLAMA_HOST
: Ollama host. No need to change unless you have conflicts. Default isollama
.OLLAMA_PORT
: Ollama port. No need to change unless you have conflicts. Default is11434
.CHROMA_HOST
: ChromaDB host. No need to change unless you have conflicts. Default ischromadb
.CHROMA_PORT
: ChromaDB port. No need to change unless you have conflicts. Default is8000
.CHAT_LIMITER
: Used for low ram devices. Limits session history to 4 exchanges for performance.DEVICE_NAME
: [COMMERCIAL] (default: "my-device"). Needed for shipped devices.SERIAL_NUMBER
: [COMMERCIAL] (default: "000-fff-000-fff"). Needed for shipped devices.PUBLIC_KEY_VERSION
: [COMMERCIAL] (default: "1.0.0"). Needed for shipped devices.FIRMWARE_VERSION
: [COMMERCIAL] (default: "1.0.1"). Needed for shipped devices.
[IMPORTANT] Set up your environment variables before running any services. [COMMERCIAL] For shipped devices, you do not need to modify these, don't delete them though.
Compose file using target file -f
found inside the cloned repo persys-server
.
The compose file will run the following images: persys-server
, ollama/ollama
and chromadb/chroma
.
The compose.yaml
file will use the .env
file you copied from the Environments section above.
Important: Before you use the docker compose
command, modify your .env
file, namely the DATA_PATH
variable. This is where your data will persist outside of the container.
This can be any folder you create on your machine.
docker build -t persys-server persys-server
docker pull ollama/ollama # if you do not have ollama already
docker pull chromadb/chroma # if you do not have chromadb already
docker compose -f persys-server/compose.yaml up -d
curl http://localhost:11434/api/pull -d '{"model":"llama3.2:1b"}' #if you have no models installed (pulling will be added to persys-client soon)
Dockerfile is available for easy setup to run persys-server
as a container.
When using Docker, you can either:
- Set environment variables in your
.env
file - Pass them directly to the container using
-e
flags
Build images. If you downloaded the repo using git clone
then your directory will be persys-server
. Build the image the directory.
docker build -t persys-server persys-server
docker pull ollama/ollama # if you do not have ollama already
docker pull chromadb/chroma # if you do not have chromadb already
With --env-file
option to let Docker know which environment file to use.
docker run -d \
-p 3000:3000 -p 4000:4000 -p 7000:7000 -p 9000:9000 \
--mount type=bind,src=/path/to/data,target=/data \
--env-file=.env
persys-server
Or with individual -e
options to specify out environment variables.
docker run -d \
-p 3000:3000 -p 4000:4000 -p 7000:7000 -p 9000:9000 \
--mount type=bind,src=/path/to/data,target=/data \
-e BASE_DIR=/data \
-e HOST=localhost \
persys-server
If you do not have Chromadb installed:
docker pull chromadb/chroma
docker run -d -p 8000:8000 --name chroma_img chromadb/chroma
If you do not have Ollama installed:
docker pull ollama/ollama
docker run -d -v ollama:/root/.ollama -p 11434:11434 --name ollama_img ollama/ollama
docker exec -it ollama_img ollama pull llama3.2
docker exec -it ollama_img ollama pull llama3.2:1b
docker exec -it ollama_img ollama pull nomic-embed-text
node
ollama
(for chat and rag)imagemagick
&graphicsmagick
(for tesseract pdf conversions)pm2
(manage services)chromadb
(vector database)tesseract-ocr
(read image text)
For local development:
- Install dependencies:
npm install
- Set up your
.env
file as described above - Start the services:
npm start
server.js
main server filestats.js
monitoring servicerag.js
rag stream servicechat.js
chat stream service