Update README.md

This commit is contained in:
Ghassan Yusuf 2025-03-28 04:44:39 +03:00
parent 32e8bf428f
commit 4c1c61bc68

123
README.md
View File

@ -1,62 +1,42 @@
# Perplexica Web Reasearch AI
# How to Set Up and Self-Host Perplexica Using Docker
## Preperation
## 1. Preparing Your Development Environment
### Updating Dependencies
Before you start, it's essential to ensure your system has the necessary dependencies installed:
```bash
sudo apt update && sudo apt upgrade -y
```
apt update && apt upgrade -y
This command updates your package lists and installs any new required packages.
### Installing Docker
Docker is crucial for containerizing and running Perplexica. Install Docker CE (for development) or Docker Hub (for production):
```bash
apt install docker.io docker-compose git -y
```
## Download The Project
```
This will install Docker CE on your system, allowing you to create and run Docker containers.
## 2. Cloning the Perplexica Repository
To get access to the Perplexica codebase:
```bash
git clone https://github.com/ItzCrazyKns/Perplexica
cd Perplexica
mv sample.config.toml config.toml
mv .env.example .env
nano config.toml
```
### Edit config.toml
run the following command
```
nano config.toml
```
make sure it looks like the following
```yaml
[GENERAL]
SIMILARITY_MEASURE = "cosine"
KEEP_ALIVE = "5m"
Replace `[your-repository-url]` with the actual GitHub repository URL of your Perplexica project.
[MODELS.OPENAI]
API_KEY = ""
## 3. Configuring the Docker Compose File
[MODELS.GROQ]
API_KEY = ""
### Understanding the Docker Compose File
[MODELS.ANTHROPIC]
API_KEY = ""
The following YAML file configures a multi-service application:
[MODELS.GEMINI]
API_KEY = ""
[MODELS.CUSTOM_OPENAI]
API_KEY = ""
API_URL = ""
MODEL_NAME = ""
[MODELS.OLLAMA]
API_URL = "http://ollama:11434"
[API_ENDPOINTS]
SEARXNG = "http://searxng:8080"
```
### Edit The Docker Compose File
run the following command
```
nano docker-compose.yaml
```
Make Sure It Looks Like The following
```yaml
services:
searxng:
@ -106,6 +86,7 @@ services:
- ./config.toml:/home/perplexica/config.toml
depends_on:
- ollama #Ensure ollama is started first
- searxng #Ensure searxng is started second
restart: unless-stopped
networks:
@ -117,19 +98,55 @@ volumes:
ollama_data: # Add ollama volume so it does not get lost
```
### Finally - Execute Docker Compose
run the following command
```
### Explanation of Each Service
1. **searxng**:
- Uses the official `docker.io/searxng/searxng:latest` image.
- Listens on port 4000 and maps to Perplexica's 8080 endpoint.
2. **ollama**:
- Uses the Ollama image with CUDA support for GPU acceleration.
- Exposes port 11434, which is used by Perplexica for API communication.
3. **app** (Perplexica Service):
- Runs in a custom Docker image (`itzcrazykns1337/perplexica:main`).
- Exposes the application on port 3000.
- Maps local development files to host volumes for data persistence.
### Volume Configuration
Volumes ensure that data remains accessible after deployment:
- `backend-dbstore`: Stores the database used by Perplexica.
- `uploads`: Stores uploaded content (e.g., PDFs).
- `config.toml`: Stores configuration settings.
## 4. Building and Running the Application
After setting up the Docker Compose file, run these commands to deploy:
```bash
docker-compose down && docker-compose up --build -d
```
## In Case Of Failour
run the following commands, i will clean the docker engin from all containers, volumes, images etc
```
This command:
1. Removes existing containers (`docker-compose down`).
2. Builds and starts a new deployment (`docker-compose up --build -d`).
## 5. What If It Fails?
If the setup fails, clean all containers and volumes:
```bash
docker rm -v -f $(docker ps -qa)
docker rmi -f $(docker images -aq)
docker volume prune
docker system prune
sudo systemctl restart docker
```
then start over again
Then, repeat the deployment steps.
## 6. Conclusion
By following these steps, you'll have a fully functional Perplexica application running on your local machine. The Docker setup ensures consistency across development environments and simplifies deployment to production.false