Install Lightrag as a Linux Service (sample files and installation guide)
This commit is contained in:
@@ -342,7 +342,7 @@ curl http://localhost:9621/api/tags
|
|||||||
|
|
||||||
Handle chat completion requests
|
Handle chat completion requests
|
||||||
|
|
||||||
```
|
```shell
|
||||||
curl -N -X POST http://localhost:9621/api/chat -H "Content-Type: application/json" -d \
|
curl -N -X POST http://localhost:9621/api/chat -H "Content-Type: application/json" -d \
|
||||||
'{"model":"lightrag:latest","messages":[{"role":"user","content":"猪八戒是谁"}],"stream":true}'
|
'{"model":"lightrag:latest","messages":[{"role":"user","content":"猪八戒是谁"}],"stream":true}'
|
||||||
```
|
```
|
||||||
@@ -424,3 +424,34 @@ This intelligent caching mechanism:
|
|||||||
- Only new documents in the input directory will be processed
|
- Only new documents in the input directory will be processed
|
||||||
- This optimization significantly reduces startup time for subsequent runs
|
- This optimization significantly reduces startup time for subsequent runs
|
||||||
- The working directory (`--working-dir`) stores the vectorized documents database
|
- The working directory (`--working-dir`) stores the vectorized documents database
|
||||||
|
|
||||||
|
## Install Lightrag as a Linux Service
|
||||||
|
|
||||||
|
Create your service file: `lightrag.sevice`. Modified the following lines from `lightrag.sevice.example`
|
||||||
|
|
||||||
|
```text
|
||||||
|
Description=LightRAG Ollama Service
|
||||||
|
WorkingDirectory=<lightrag installed directory>
|
||||||
|
ExecStart=<lightrag installed directory>/lightrag/api/start_lightrag.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
Create your service startup script: `start_lightrag.sh`. Change you python virtual environment activation method as need:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# python virtual environment activation
|
||||||
|
source /home/netman/lightrag-xyj/venv/bin/activate
|
||||||
|
# start lightrag api server
|
||||||
|
lightrag-server
|
||||||
|
```
|
||||||
|
|
||||||
|
Install lightrag.service in Linux. Sample commands in Ubuntu server look like:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
sudo cp lightrag-server.service /etc/systemd/system/
|
||||||
|
sudo systemctl daemon-reload
|
||||||
|
sudo systemctl start lightrag-server.service
|
||||||
|
sudo systemctl status lightrag-server.service
|
||||||
|
sudo systemctl enable lightrag-server.service
|
||||||
|
```
|
||||||
|
17
lightrag/api/lightrag.service.example
Normal file
17
lightrag/api/lightrag.service.example
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=LightRAG XYJ Ollama Service
|
||||||
|
After=network.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
User=netman
|
||||||
|
# Memory settings
|
||||||
|
MemoryHigh=8G
|
||||||
|
MemoryMax=12G
|
||||||
|
WorkingDirectory=/home/netman/lightrag-xyj
|
||||||
|
ExecStart=/home/netman/lightrag-xyj/lightrag/api/start_lightrag_server.sh
|
||||||
|
Restart=always
|
||||||
|
RestartSec=10
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
4
lightrag/api/start_lightrag.sh.example
Normal file
4
lightrag/api/start_lightrag.sh.example
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
source /home/netman/lightrag-xyj/venv/bin/activate
|
||||||
|
lightrag-server
|
Reference in New Issue
Block a user