From 4c1c61bc68a061133fd33d4133bd89fbd4612f99 Mon Sep 17 00:00:00 2001 From: Ghassan Yusuf Date: Fri, 28 Mar 2025 04:44:39 +0300 Subject: [PATCH] Update README.md --- README.md | 123 +++++++++++++++++++++++++++++++----------------------- 1 file changed, 70 insertions(+), 53 deletions(-) diff --git a/README.md b/README.md index bac4613..24ecf18 100644 --- a/README.md +++ b/README.md @@ -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 \ No newline at end of file