ItzCrazyKns / Perplexica

Perplexica is an AI-powered search engine. It is an Open source alternative to Perplexity AI
MIT License
10.98k stars 973 forks source link

Add documentation for deploying Perplexica #92

Closed ItzCrazyKns closed 2 months ago

ItzCrazyKns commented 2 months ago

A lot of people are facing errors while exposing Perplexica to there network or while deploying it somewhere. A guide can be created to guide the user on how to deploy Perplexica and expose it to there network or deploy it on some sort of server. This needs to be done in the docs/installation folder.

iandoug commented 2 months ago

Does Ollama need to be running via docker?

ItzCrazyKns commented 2 months ago

Does Ollama need to be running via docker?

You can run it via Docker or directly on your computer.

mr-biz commented 2 months ago

Here are instructions for updating the Perplexica Docker Compose configuration to run on an http server (Linux):

Stop and Remove Existing Containers/Images

First, stop and remove any existing Perplexica containers and images:

docker compose down --rmi all

Update Docker Compose File

Next, open the docker-compose.yaml file in a text editor:

nano docker-compose.yaml

Replace all instances of 127.0.0.1 with the IP address of the server where Perplexica will be running. You'll need to update two lines:

args:
  - NEXT_PUBLIC_API_URL=http://<SERVER_IP>:3001/api
  - NEXT_PUBLIC_WS_URL=ws://<SERVER_IP>:3001

Additionally, add the restart: always line under the app service to ensure Perplexica automatically restarts if it stops unexpectedly:

services:
  app:
    # ...
    restart: always

Rebuild and Start Perplexica

Finally, rebuild the Perplexica images and start the containers:

docker compose up --build -d

The -d flag runs the containers in detached mode (in the background).

With these changes, Perplexica will be accessible from other machines on the same network using the server's IP address. The restart: always policy ensures Perplexica stays running even after system reboots or crashes.

ItzCrazyKns commented 2 months ago

Here are instructions for updating the Perplexica Docker Compose configuration to run on an http server (Linux):

Stop and Remove Existing Containers/Images

First, stop and remove any existing Perplexica containers and images:

docker compose down --rmi all

Update Docker Compose File

Next, open the docker-compose.yaml file in a text editor:

nano docker-compose.yaml

Replace all instances of 127.0.0.1 with the IP address of the server where Perplexica will be running. You'll need to update two lines:

args:
  - NEXT_PUBLIC_API_URL=http://<SERVER_IP>:3001/api
  - NEXT_PUBLIC_WS_URL=ws://<SERVER_IP>:3001

Additionally, add the restart: always line under the app service to ensure Perplexica automatically restarts if it stops unexpectedly:

services:
  app:
    # ...
    restart: always

Rebuild and Start Perplexica

Finally, rebuild the Perplexica images and start the containers:

docker compose up --build -d

The -d flag runs the containers in detached mode (in the background).

With these changes, Perplexica will be accessible from other machines on the same network using the server's IP address. The restart: always policy ensures Perplexica stays running even after system reboots or crashes.

Appreciate it, we have the guide for Linux now! We just need the Windows and Mac guide after which I'll be pushing this into the docs folder.

mr-biz commented 2 months ago

Here are improved instructions for updating the Docker Compose file and restarting the Perplexica container on Windows, macOS, and Linux:

Windows

  1. Open PowerShell as Administrator

  2. Navigate to the directory containing the docker-compose.yaml file

  3. Stop and remove the existing Perplexica containers and images:

    docker compose down --rmi all
  4. Open the docker-compose.yaml file in a text editor like Notepad++

  5. Replace 127.0.0.1 with the IP address of the server Perplexica is running on in these two lines:

    args:
    - NEXT_PUBLIC_API_URL=http://127.0.0.1:3001/api
    - NEXT_PUBLIC_WS_URL=ws://127.0.0.1:3001
  6. Add the restart: always line under the perplexica service to keep it running after restarts:

    services:
    perplexica:
    # ...
    restart: always
  7. Save and close the docker-compose.yaml file

  8. Rebuild and restart the Perplexica container:

    docker compose up -d --build

macOS

  1. Open the Terminal application

  2. Navigate to the directory with the docker-compose.yaml file:

    cd /path/to/docker-compose.yaml
  3. Stop and remove existing containers and images:

    docker compose down --rmi all
  4. Open docker-compose.yaml in a text editor like Sublime Text:

    nano docker-compose.yaml
  5. Replace 127.0.0.1 with the server IP in these lines:

    args:
    - NEXT_PUBLIC_API_URL=http://127.0.0.1:3001/api 
    - NEXT_PUBLIC_WS_URL=ws://127.0.0.1:3001
  6. Add restart: always under the perplexica service:

    services:
    perplexica:
    # ...
    restart: always
  7. Save and exit the editor

  8. Rebuild and restart Perplexica:

    docker compose up -d --build  

Linux

  1. Open the terminal

  2. Navigate to the docker-compose.yaml directory:

    cd /path/to/docker-compose.yaml
  3. Stop and remove containers and images:

    docker compose down --rmi all
  4. Edit docker-compose.yaml:

    nano docker-compose.yaml
  5. Replace 127.0.0.1 with the server IP:

    args:
    - NEXT_PUBLIC_API_URL=http://127.0.0.1:3001/api
    - NEXT_PUBLIC_WS_URL=ws://127.0.0.1:3001
  6. Add restart: always under perplexica:

    services:
    perplexica:
    # ...
    restart: always
  7. Save and exit the editor

  8. Rebuild and restart Perplexica:

    docker compose up -d --build

These instructions stop the existing Perplexica containers, remove the old images, update the Docker Compose file with the server IP and restart policy, and then rebuild and restart the Perplexica container with the new configuration.

iandoug commented 2 months ago

docker compose up -d --build

no hyphen

ItzCrazyKns commented 2 months ago

Added in https://github.com/ItzCrazyKns/Perplexica/commit/a60145137c677a021df611e236fb8f3f478976ae