mirror of
https://github.com/ItzCrazyKns/Perplexica.git
synced 2025-09-16 22:31:32 +00:00
Compare commits
1 Commits
a661450633
...
b68aec1b7f
Author | SHA1 | Date | |
---|---|---|---|
|
b68aec1b7f |
37
.github/workflows/docker-build.yaml
vendored
37
.github/workflows/docker-build.yaml
vendored
@@ -10,6 +10,9 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
build-and-push:
|
build-and-push:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
service: [backend, app]
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
@@ -33,24 +36,38 @@ jobs:
|
|||||||
id: version
|
id: version
|
||||||
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
|
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Build and push Docker image (latest)
|
- name: Build and push Docker image for ${{ matrix.service }}
|
||||||
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
|
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
|
||||||
run: |
|
run: |
|
||||||
docker buildx create --use
|
docker buildx create --use
|
||||||
docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 \
|
if [[ "${{ matrix.service }}" == "backend" ]]; then \
|
||||||
--cache-from=type=registry,ref=itzcrazykns1337/perplexica:latest \
|
DOCKERFILE=backend.dockerfile; \
|
||||||
|
IMAGE_NAME=perplexica-backend; \
|
||||||
|
else \
|
||||||
|
DOCKERFILE=app.dockerfile; \
|
||||||
|
IMAGE_NAME=perplexica-frontend; \
|
||||||
|
fi
|
||||||
|
docker buildx build --platform linux/amd64,linux/arm64 \
|
||||||
|
--cache-from=type=registry,ref=itzcrazykns1337/${IMAGE_NAME}:main \
|
||||||
--cache-to=type=inline \
|
--cache-to=type=inline \
|
||||||
-f docker/Dockerfile \
|
-f $DOCKERFILE \
|
||||||
-t itzcrazykns1337/perplexica:latest \
|
-t itzcrazykns1337/${IMAGE_NAME}:main \
|
||||||
--push .
|
--push .
|
||||||
|
|
||||||
- name: Build and push Docker image (release)
|
- name: Build and push release Docker image for ${{ matrix.service }}
|
||||||
if: github.event_name == 'release'
|
if: github.event_name == 'release'
|
||||||
run: |
|
run: |
|
||||||
docker buildx create --use
|
docker buildx create --use
|
||||||
docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 \
|
if [[ "${{ matrix.service }}" == "backend" ]]; then \
|
||||||
--cache-from=type=registry,ref=itzcrazykns1337/perplexica:${{ env.RELEASE_VERSION }} \
|
DOCKERFILE=backend.dockerfile; \
|
||||||
|
IMAGE_NAME=perplexica-backend; \
|
||||||
|
else \
|
||||||
|
DOCKERFILE=app.dockerfile; \
|
||||||
|
IMAGE_NAME=perplexica-frontend; \
|
||||||
|
fi
|
||||||
|
docker buildx build --platform linux/amd64,linux/arm64 \
|
||||||
|
--cache-from=type=registry,ref=itzcrazykns1337/${IMAGE_NAME}:${{ env.RELEASE_VERSION }} \
|
||||||
--cache-to=type=inline \
|
--cache-to=type=inline \
|
||||||
-f docker/Dockerfile \
|
-f $DOCKERFILE \
|
||||||
-t itzcrazykns1337/perplexica:${{ env.RELEASE_VERSION }} \
|
-t itzcrazykns1337/${IMAGE_NAME}:${{ env.RELEASE_VERSION }} \
|
||||||
--push .
|
--push .
|
||||||
|
30
README.md
30
README.md
@@ -1,23 +1,8 @@
|
|||||||
# 🚀 Perplexica - An AI-powered search engine 🔎 <!-- omit in toc -->
|
# 🚀 Perplexica - An AI-powered search engine 🔎 <!-- omit in toc -->
|
||||||
|
|
||||||
<div align="center" markdown="1">
|
|
||||||
<sup>Special thanks to:</sup>
|
|
||||||
<br>
|
|
||||||
<br>
|
|
||||||
<a href="https://www.warp.dev/perplexica">
|
|
||||||
<img alt="Warp sponsorship" width="400" src="https://github.com/user-attachments/assets/775dd593-9b5f-40f1-bf48-479faff4c27b">
|
|
||||||
</a>
|
|
||||||
|
|
||||||
### [Warp, the AI Devtool that lives in your terminal](https://www.warp.dev/perplexica)
|
|
||||||
|
|
||||||
[Available for MacOS, Linux, & Windows](https://www.warp.dev/perplexica)
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<hr/>
|
|
||||||
|
|
||||||
[](https://discord.gg/26aArMy8tT)
|
[](https://discord.gg/26aArMy8tT)
|
||||||
|
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
## Table of Contents <!-- omit in toc -->
|
## Table of Contents <!-- omit in toc -->
|
||||||
@@ -26,7 +11,7 @@
|
|||||||
- [Preview](#preview)
|
- [Preview](#preview)
|
||||||
- [Features](#features)
|
- [Features](#features)
|
||||||
- [Installation](#installation)
|
- [Installation](#installation)
|
||||||
- [Docker Installation (Recommended)](#docker-installation-recommended)
|
- [Getting Started with Docker (Recommended)](#getting-started-with-docker-recommended)
|
||||||
- [Non-Docker Installation](#non-docker-installation)
|
- [Non-Docker Installation](#non-docker-installation)
|
||||||
- [Nginx Reverse Proxy](#nginx-reverse-proxy)
|
- [Nginx Reverse Proxy](#nginx-reverse-proxy)
|
||||||
- [Ollama Connection Errors](#ollama-connection-errors)
|
- [Ollama Connection Errors](#ollama-connection-errors)
|
||||||
@@ -72,9 +57,9 @@ It has many more features like image and video search. Some of the planned featu
|
|||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
Perplexica can be installed using Docker (recommended) or directly on your system.
|
There are mainly 2 ways of installing Perplexica - With Docker, Without Docker. Using Docker is highly recommended.
|
||||||
|
|
||||||
### Docker Installation (Recommended)
|
### Getting Started with Docker (Recommended)
|
||||||
|
|
||||||
1. Ensure Docker is installed and running on your system.
|
1. Ensure Docker is installed and running on your system.
|
||||||
2. Clone the Perplexica repository:
|
2. Clone the Perplexica repository:
|
||||||
@@ -102,15 +87,10 @@ Perplexica can be installed using Docker (recommended) or directly on your syste
|
|||||||
docker compose up -d
|
docker compose up -d
|
||||||
```
|
```
|
||||||
|
|
||||||
6. Wait a few minutes for the setup to complete. You can access Perplexica at http://localhost:8080 in your web browser.
|
6. Wait a few minutes for the setup to complete. You can access Perplexica at http://localhost:3000 in your web browser.
|
||||||
|
|
||||||
**Note**: After the containers are built, you can start Perplexica directly from Docker without having to open a terminal.
|
**Note**: After the containers are built, you can start Perplexica directly from Docker without having to open a terminal.
|
||||||
|
|
||||||
The Docker configuration is located in the `docker/` directory, containing:
|
|
||||||
- Dockerfile with multi-stage build for efficient images
|
|
||||||
- Service configurations for the integrated process manager
|
|
||||||
- Nginx reverse proxy configuration
|
|
||||||
|
|
||||||
### Non-Docker Installation
|
### Non-Docker Installation
|
||||||
|
|
||||||
1. Install SearXNG and allow `JSON` format in the SearXNG settings.
|
1. Install SearXNG and allow `JSON` format in the SearXNG settings.
|
||||||
|
15
app.dockerfile
Normal file
15
app.dockerfile
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
FROM node:20.18.0-alpine
|
||||||
|
|
||||||
|
ARG NEXT_PUBLIC_WS_URL=ws://127.0.0.1:3001
|
||||||
|
ARG NEXT_PUBLIC_API_URL=http://127.0.0.1:3001/api
|
||||||
|
ENV NEXT_PUBLIC_WS_URL=${NEXT_PUBLIC_WS_URL}
|
||||||
|
ENV NEXT_PUBLIC_API_URL=${NEXT_PUBLIC_API_URL}
|
||||||
|
|
||||||
|
WORKDIR /home/perplexica
|
||||||
|
|
||||||
|
COPY ui /home/perplexica/
|
||||||
|
|
||||||
|
RUN yarn install --frozen-lockfile
|
||||||
|
RUN yarn build
|
||||||
|
|
||||||
|
CMD ["yarn", "start"]
|
17
backend.dockerfile
Normal file
17
backend.dockerfile
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
FROM node:18-slim
|
||||||
|
|
||||||
|
WORKDIR /home/perplexica
|
||||||
|
|
||||||
|
COPY src /home/perplexica/src
|
||||||
|
COPY tsconfig.json /home/perplexica/
|
||||||
|
COPY drizzle.config.ts /home/perplexica/
|
||||||
|
COPY package.json /home/perplexica/
|
||||||
|
COPY yarn.lock /home/perplexica/
|
||||||
|
|
||||||
|
RUN mkdir /home/perplexica/data
|
||||||
|
RUN mkdir /home/perplexica/uploads
|
||||||
|
|
||||||
|
RUN yarn install --frozen-lockfile --network-timeout 600000
|
||||||
|
RUN yarn build
|
||||||
|
|
||||||
|
CMD ["yarn", "start"]
|
@@ -2,43 +2,62 @@ services:
|
|||||||
searxng:
|
searxng:
|
||||||
image: docker.io/searxng/searxng:latest
|
image: docker.io/searxng/searxng:latest
|
||||||
volumes:
|
volumes:
|
||||||
- ./searxng:/etc/searxng
|
- ./searxng:/etc/searxng:rw
|
||||||
|
ports:
|
||||||
|
- 4000:8080
|
||||||
networks:
|
networks:
|
||||||
- perplexica-network
|
- perplexica-network
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|
||||||
perplexica:
|
perplexica-backend:
|
||||||
image: itzcrazykns1337/perplexica:latest
|
build:
|
||||||
ports:
|
context: .
|
||||||
- "8080:8080"
|
dockerfile: backend.dockerfile
|
||||||
|
image: itzcrazykns1337/perplexica-backend:main
|
||||||
environment:
|
environment:
|
||||||
- SEARXNG_API_URL=http://searxng:4000
|
- SEARXNG_API_URL=http://searxng:8080
|
||||||
- SIMILARITY_MEASURE=cosine
|
|
||||||
- KEEP_ALIVE=5m
|
|
||||||
- OPENAI_API_KEY=${OPENAI_API_KEY:-}
|
|
||||||
- GROQ_API_KEY=${GROQ_API_KEY:-}
|
|
||||||
- ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY:-}
|
|
||||||
- GEMINI_API_KEY=${GEMINI_API_KEY:-}
|
|
||||||
- OLLAMA_API_URL=${OLLAMA_API_URL:-}
|
|
||||||
- CUSTOM_OPENAI_API_KEY=${CUSTOM_OPENAI_API_KEY:-}
|
|
||||||
- CUSTOM_OPENAI_API_URL=${CUSTOM_OPENAI_API_URL:-}
|
|
||||||
- CUSTOM_OPENAI_MODEL_NAME=${CUSTOM_OPENAI_MODEL_NAME:-}
|
|
||||||
volumes:
|
|
||||||
- backend-dbstore:/app/backend/data
|
|
||||||
- uploads:/app/backend/uploads
|
|
||||||
extra_hosts:
|
|
||||||
- 'host.docker.internal:host-gateway'
|
|
||||||
depends_on:
|
depends_on:
|
||||||
- searxng
|
- searxng
|
||||||
|
ports:
|
||||||
|
- 3001:3001
|
||||||
|
volumes:
|
||||||
|
- backend-dbstore:/home/perplexica/data
|
||||||
|
- uploads:/home/perplexica/uploads
|
||||||
|
- ./config.toml:/home/perplexica/config.toml
|
||||||
|
extra_hosts:
|
||||||
|
- 'host.docker.internal:host-gateway'
|
||||||
|
networks:
|
||||||
|
- perplexica-network
|
||||||
|
restart: unless-stopped
|
||||||
|
|
||||||
|
perplexica-frontend:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: app.dockerfile
|
||||||
|
args:
|
||||||
|
- NEXT_PUBLIC_API_URL=/api
|
||||||
|
- NEXT_PUBLIC_WS_URL=auto
|
||||||
|
image: itzcrazykns1337/perplexica-frontend:main
|
||||||
|
depends_on:
|
||||||
|
- perplexica-backend
|
||||||
|
ports:
|
||||||
|
- 3000:3000
|
||||||
|
networks:
|
||||||
|
- perplexica-network
|
||||||
|
restart: unless-stopped
|
||||||
|
|
||||||
|
nginx:
|
||||||
|
image: nginx:alpine
|
||||||
|
ports:
|
||||||
|
- "8080:80"
|
||||||
|
volumes:
|
||||||
|
- ./nginx.conf:/etc/nginx/nginx.conf:ro
|
||||||
|
depends_on:
|
||||||
|
- perplexica-frontend
|
||||||
|
- perplexica-backend
|
||||||
networks:
|
networks:
|
||||||
- perplexica-network
|
- perplexica-network
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
healthcheck:
|
|
||||||
test: ["CMD", "curl", "-f", "http://localhost:8080/"]
|
|
||||||
interval: 30s
|
|
||||||
timeout: 10s
|
|
||||||
retries: 3
|
|
||||||
start_period: 5s
|
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
perplexica-network:
|
perplexica-network:
|
||||||
|
@@ -1,93 +0,0 @@
|
|||||||
# Multi-stage build for Perplexica
|
|
||||||
# Stage 1: Build the backend
|
|
||||||
FROM node:lts-alpine as backend-builder
|
|
||||||
|
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
COPY src ./src
|
|
||||||
COPY tsconfig.json drizzle.config.ts package.json yarn.lock ./
|
|
||||||
|
|
||||||
RUN yarn install --frozen-lockfile --network-timeout 600000 && \
|
|
||||||
yarn build
|
|
||||||
|
|
||||||
# Stage 2: Build the frontend
|
|
||||||
FROM node:lts-alpine as frontend-builder
|
|
||||||
|
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
COPY ui ./
|
|
||||||
ARG NEXT_PUBLIC_API_URL=/api
|
|
||||||
ARG NEXT_PUBLIC_WS_URL=auto
|
|
||||||
ENV NEXT_PUBLIC_API_URL=${NEXT_PUBLIC_API_URL}
|
|
||||||
ENV NEXT_PUBLIC_WS_URL=${NEXT_PUBLIC_WS_URL}
|
|
||||||
|
|
||||||
RUN yarn install --frozen-lockfile && \
|
|
||||||
yarn build
|
|
||||||
|
|
||||||
# Stage 3: Final image
|
|
||||||
FROM node:lts-alpine
|
|
||||||
|
|
||||||
# Install curl and jq for GitHub API access
|
|
||||||
RUN apk add --no-cache curl jq
|
|
||||||
|
|
||||||
# Determine latest S6 overlay version at build time
|
|
||||||
RUN S6_OVERLAY_VERSION=$(curl -s https://api.github.com/repos/just-containers/s6-overlay/releases/latest | jq -r .tag_name | sed 's/^v//') && \
|
|
||||||
echo "Using S6 overlay version: $S6_OVERLAY_VERSION" && \
|
|
||||||
echo "$S6_OVERLAY_VERSION" > /tmp/s6-version
|
|
||||||
|
|
||||||
# Use Docker's TARGETARCH for automatic architecture detection
|
|
||||||
ARG TARGETARCH
|
|
||||||
|
|
||||||
# Install additional required packages and create directory structure in one layer
|
|
||||||
RUN apk add --no-cache \
|
|
||||||
nginx \
|
|
||||||
tzdata \
|
|
||||||
bash && \
|
|
||||||
mkdir -p /app/backend /app/frontend /app/data /app/uploads
|
|
||||||
|
|
||||||
# Map Docker's architecture names to s6-overlay architecture names and download/install
|
|
||||||
RUN S6_OVERLAY_VERSION=$(cat /tmp/s6-version) && \
|
|
||||||
case "${TARGETARCH}" in \
|
|
||||||
"amd64") S6_OVERLAY_ARCH="x86_64" ;; \
|
|
||||||
"arm64") S6_OVERLAY_ARCH="aarch64" ;; \
|
|
||||||
"arm") S6_OVERLAY_ARCH="arm" ;; \
|
|
||||||
*) echo "Unsupported architecture: ${TARGETARCH}. Only amd64, arm64, and arm are supported." && exit 1 ;; \
|
|
||||||
esac && \
|
|
||||||
echo "Target architecture: ${TARGETARCH} -> S6 architecture: ${S6_OVERLAY_ARCH}" && \
|
|
||||||
echo "Downloading s6-overlay v${S6_OVERLAY_VERSION} for architecture: ${S6_OVERLAY_ARCH}" && \
|
|
||||||
curl -L -s -o /tmp/s6-overlay-noarch.tar.xz "https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-noarch.tar.xz" && \
|
|
||||||
tar -C / -Jxpf /tmp/s6-overlay-noarch.tar.xz && \
|
|
||||||
curl -L -s -o /tmp/s6-overlay-arch.tar.xz "https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-${S6_OVERLAY_ARCH}.tar.xz" && \
|
|
||||||
tar -C / -Jxpf /tmp/s6-overlay-arch.tar.xz && \
|
|
||||||
curl -L -s -o /tmp/s6-overlay-symlinks-noarch.tar.xz "https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-symlinks-noarch.tar.xz" && \
|
|
||||||
tar -C / -Jxpf /tmp/s6-overlay-symlinks-noarch.tar.xz && \
|
|
||||||
rm -f /tmp/s6-overlay-*.tar.xz /tmp/s6-version
|
|
||||||
|
|
||||||
# Copy configuration files
|
|
||||||
COPY docker/etc/s6-overlay/services /etc/services.d/
|
|
||||||
COPY docker/etc/nginx/nginx.conf /etc/nginx/nginx.conf
|
|
||||||
|
|
||||||
# Make service scripts executable
|
|
||||||
RUN chmod +x /etc/services.d/*/run /etc/services.d/*/finish
|
|
||||||
|
|
||||||
# Copy application files from builders
|
|
||||||
COPY --from=backend-builder /app/dist /app/backend/dist
|
|
||||||
COPY --from=backend-builder /app/node_modules /app/backend/node_modules
|
|
||||||
COPY --from=backend-builder /app/package.json /app/backend/package.json
|
|
||||||
COPY --from=backend-builder /app/drizzle.config.ts /app/backend/drizzle.config.ts
|
|
||||||
# Copy only the schema file for Drizzle migrations
|
|
||||||
COPY --from=backend-builder /app/src/db/schema.ts /app/backend/src/db/schema.ts
|
|
||||||
COPY --from=frontend-builder /app/.next /app/frontend/.next
|
|
||||||
COPY --from=frontend-builder /app/node_modules /app/frontend/node_modules
|
|
||||||
COPY --from=frontend-builder /app/package.json /app/frontend/package.json
|
|
||||||
COPY --from=frontend-builder /app/public /app/frontend/public
|
|
||||||
|
|
||||||
# Configure volumes and ports
|
|
||||||
VOLUME ["/app/backend/data", "/app/backend/uploads"]
|
|
||||||
EXPOSE 8080
|
|
||||||
|
|
||||||
# Set up healthcheck
|
|
||||||
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
|
||||||
CMD curl -f http://localhost:8080/ || exit 1
|
|
||||||
|
|
||||||
ENTRYPOINT ["/init"]
|
|
@@ -1,3 +0,0 @@
|
|||||||
#!/usr/bin/with-contenv bash
|
|
||||||
s6-svc -d /var/run/s6/services/frontend
|
|
||||||
s6-svc -d /var/run/s6/services/nginx
|
|
@@ -1,8 +0,0 @@
|
|||||||
#!/usr/bin/with-contenv bash
|
|
||||||
cd /app/backend
|
|
||||||
|
|
||||||
# Run database migrations before starting the app
|
|
||||||
yarn db:push
|
|
||||||
|
|
||||||
# Start the application
|
|
||||||
exec node dist/app.js
|
|
@@ -1,2 +0,0 @@
|
|||||||
#!/usr/bin/with-contenv bash
|
|
||||||
s6-svc -d /var/run/s6/services/nginx
|
|
@@ -1,3 +0,0 @@
|
|||||||
#!/usr/bin/with-contenv bash
|
|
||||||
cd /app/frontend
|
|
||||||
exec node_modules/.bin/next start
|
|
@@ -1,2 +0,0 @@
|
|||||||
#!/usr/bin/with-contenv bash
|
|
||||||
exec nginx -g "daemon off;"
|
|
@@ -1,10 +1,12 @@
|
|||||||
# Accessing Perplexica over a Network
|
# Exposing Perplexica to a Network
|
||||||
|
|
||||||
This guide explains how to access Perplexica over your network using the nginx reverse proxy included in the Docker setup.
|
This guide explains how to make Perplexica available over a network using the built-in Nginx reverse proxy.
|
||||||
|
|
||||||
## Basic Network Access
|
## Accessing Perplexica Over a Network
|
||||||
|
|
||||||
Perplexica is automatically accessible from any device on your network:
|
### Basic Access
|
||||||
|
|
||||||
|
With the Nginx reverse proxy, Perplexica is automatically accessible from any device on your network:
|
||||||
|
|
||||||
1. Start Perplexica using Docker Compose:
|
1. Start Perplexica using Docker Compose:
|
||||||
```bash
|
```bash
|
||||||
@@ -21,15 +23,28 @@ Perplexica is automatically accessible from any device on your network:
|
|||||||
http://YOUR_SERVER_IP:8080
|
http://YOUR_SERVER_IP:8080
|
||||||
```
|
```
|
||||||
|
|
||||||
## Custom Port Configuration
|
### Domain Configuration
|
||||||
|
|
||||||
|
If you have a domain name, you can point it to your server:
|
||||||
|
|
||||||
|
1. Configure your domain's DNS settings to point to your server IP
|
||||||
|
|
||||||
|
2. Access Perplexica via:
|
||||||
|
```
|
||||||
|
http://your-domain.com:8080
|
||||||
|
```
|
||||||
|
|
||||||
|
## Advanced Configuration
|
||||||
|
|
||||||
|
### Custom Port
|
||||||
|
|
||||||
If you need to use a different port instead of the default 8080:
|
If you need to use a different port instead of the default 8080:
|
||||||
|
|
||||||
1. Modify the `docker-compose.yaml` file:
|
1. Modify the `docker-compose.yaml` file:
|
||||||
```yaml
|
```yaml
|
||||||
perplexica:
|
nginx:
|
||||||
ports:
|
ports:
|
||||||
- "YOUR_CUSTOM_PORT:8080"
|
- "YOUR_CUSTOM_PORT:80"
|
||||||
```
|
```
|
||||||
|
|
||||||
2. Restart the containers:
|
2. Restart the containers:
|
||||||
@@ -37,10 +52,55 @@ If you need to use a different port instead of the default 8080:
|
|||||||
docker compose down && docker compose up -d
|
docker compose down && docker compose up -d
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### SSL/HTTPS Configuration
|
||||||
|
|
||||||
|
For secure HTTPS access:
|
||||||
|
|
||||||
|
1. Modify the Nginx configuration to include SSL:
|
||||||
|
```nginx
|
||||||
|
# In nginx.conf
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
listen 443 ssl;
|
||||||
|
|
||||||
|
ssl_certificate /path/to/certificate.crt;
|
||||||
|
ssl_certificate_key /path/to/private.key;
|
||||||
|
|
||||||
|
# Rest of configuration...
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Update the Docker volume to include your certificates:
|
||||||
|
```yaml
|
||||||
|
nginx:
|
||||||
|
volumes:
|
||||||
|
- ./nginx.conf:/etc/nginx/nginx.conf:ro
|
||||||
|
- ./ssl:/path/to/ssl:ro
|
||||||
|
```
|
||||||
|
|
||||||
|
3. Restart the containers:
|
||||||
|
```bash
|
||||||
|
docker compose down && docker compose up -d
|
||||||
|
```
|
||||||
|
|
||||||
|
4. Or just use another reverse proxy on top of this one...
|
||||||
|
|
||||||
## Troubleshooting
|
## Troubleshooting
|
||||||
|
|
||||||
If you encounter issues accessing Perplexica over your network:
|
If you encounter issues accessing Perplexica over your network:
|
||||||
|
|
||||||
1. **Firewall Settings**: Ensure port 8080 (or your custom port) is allowed in your firewall
|
1. **Firewall Settings**: Ensure port 8080 (or your custom port) is allowed in your firewall
|
||||||
2. **Docker Logs**: Check for any connection issues with `docker logs perplexica`
|
|
||||||
3. **Network Access**: Make sure your devices are on the same network and can reach the server
|
2. **Docker Network**: Check if Docker's network settings allow external connections:
|
||||||
|
```bash
|
||||||
|
docker network inspect perplexica_perplexica-network
|
||||||
|
```
|
||||||
|
|
||||||
|
3. **Nginx Logs**: Check for any connection issues:
|
||||||
|
```bash
|
||||||
|
docker logs perplexica-nginx-1
|
||||||
|
```
|
||||||
|
|
||||||
|
4. **Direct Access**: Verify if you can access the services directly:
|
||||||
|
- Frontend: http://YOUR_SERVER_IP:3000
|
||||||
|
- Backend: http://YOUR_SERVER_IP:3001
|
||||||
|
@@ -7,17 +7,12 @@ http {
|
|||||||
absolute_redirect off;
|
absolute_redirect off;
|
||||||
|
|
||||||
server {
|
server {
|
||||||
listen 8080;
|
listen 80;
|
||||||
server_name localhost;
|
server_name localhost:8080;
|
||||||
|
|
||||||
# Global timeout settings for all locations
|
|
||||||
proxy_read_timeout 86400s; # 24 hours
|
|
||||||
proxy_send_timeout 86400s; # 24 hours
|
|
||||||
proxy_connect_timeout 60s; # Connection establishment timeout
|
|
||||||
|
|
||||||
# API requests
|
# API requests
|
||||||
location /api {
|
location /api {
|
||||||
proxy_pass http://localhost:3001;
|
proxy_pass http://perplexica-backend:3001;
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
@@ -26,7 +21,7 @@ http {
|
|||||||
|
|
||||||
# WebSocket requests
|
# WebSocket requests
|
||||||
location /ws {
|
location /ws {
|
||||||
proxy_pass http://localhost:3001;
|
proxy_pass http://perplexica-backend:3001;
|
||||||
proxy_http_version 1.1;
|
proxy_http_version 1.1;
|
||||||
proxy_set_header Upgrade $http_upgrade;
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
proxy_set_header Connection "upgrade";
|
proxy_set_header Connection "upgrade";
|
||||||
@@ -38,7 +33,7 @@ http {
|
|||||||
|
|
||||||
# Frontend requests
|
# Frontend requests
|
||||||
location / {
|
location / {
|
||||||
proxy_pass http://localhost:3000;
|
proxy_pass http://perplexica-frontend:3000;
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
@@ -41,83 +41,39 @@ type RecursivePartial<T> = {
|
|||||||
[P in keyof T]?: RecursivePartial<T[P]>;
|
[P in keyof T]?: RecursivePartial<T[P]>;
|
||||||
};
|
};
|
||||||
|
|
||||||
const loadConfig = () => {
|
const loadConfig = () =>
|
||||||
try {
|
toml.parse(
|
||||||
return toml.parse(
|
|
||||||
fs.readFileSync(path.join(__dirname, `../${configFileName}`), 'utf-8'),
|
fs.readFileSync(path.join(__dirname, `../${configFileName}`), 'utf-8'),
|
||||||
) as any as Config;
|
) as any as Config;
|
||||||
} catch (error) {
|
|
||||||
// Return default config if file doesn't exist
|
|
||||||
return {
|
|
||||||
GENERAL: {
|
|
||||||
PORT: 3001,
|
|
||||||
SIMILARITY_MEASURE: 'cosine',
|
|
||||||
KEEP_ALIVE: '5m',
|
|
||||||
},
|
|
||||||
MODELS: {
|
|
||||||
OPENAI: {
|
|
||||||
API_KEY: '',
|
|
||||||
},
|
|
||||||
GROQ: {
|
|
||||||
API_KEY: '',
|
|
||||||
},
|
|
||||||
ANTHROPIC: {
|
|
||||||
API_KEY: '',
|
|
||||||
},
|
|
||||||
GEMINI: {
|
|
||||||
API_KEY: '',
|
|
||||||
},
|
|
||||||
OLLAMA: {
|
|
||||||
API_URL: '',
|
|
||||||
},
|
|
||||||
CUSTOM_OPENAI: {
|
|
||||||
API_URL: '',
|
|
||||||
API_KEY: '',
|
|
||||||
MODEL_NAME: '',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
API_ENDPOINTS: {
|
|
||||||
SEARXNG: '',
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getPort = () =>
|
export const getPort = () => loadConfig().GENERAL.PORT;
|
||||||
process.env.PORT ? parseInt(process.env.PORT, 10) : loadConfig().GENERAL.PORT;
|
|
||||||
|
|
||||||
export const getSimilarityMeasure = () =>
|
export const getSimilarityMeasure = () =>
|
||||||
process.env.SIMILARITY_MEASURE || loadConfig().GENERAL.SIMILARITY_MEASURE;
|
loadConfig().GENERAL.SIMILARITY_MEASURE;
|
||||||
|
|
||||||
export const getKeepAlive = () =>
|
export const getKeepAlive = () => loadConfig().GENERAL.KEEP_ALIVE;
|
||||||
process.env.KEEP_ALIVE || loadConfig().GENERAL.KEEP_ALIVE;
|
|
||||||
|
|
||||||
export const getOpenaiApiKey = () =>
|
export const getOpenaiApiKey = () => loadConfig().MODELS.OPENAI.API_KEY;
|
||||||
process.env.OPENAI_API_KEY || loadConfig().MODELS.OPENAI.API_KEY;
|
|
||||||
|
|
||||||
export const getGroqApiKey = () =>
|
export const getGroqApiKey = () => loadConfig().MODELS.GROQ.API_KEY;
|
||||||
process.env.GROQ_API_KEY || loadConfig().MODELS.GROQ.API_KEY;
|
|
||||||
|
|
||||||
export const getAnthropicApiKey = () =>
|
export const getAnthropicApiKey = () => loadConfig().MODELS.ANTHROPIC.API_KEY;
|
||||||
process.env.ANTHROPIC_API_KEY || loadConfig().MODELS.ANTHROPIC.API_KEY;
|
|
||||||
|
|
||||||
export const getGeminiApiKey = () =>
|
export const getGeminiApiKey = () => loadConfig().MODELS.GEMINI.API_KEY;
|
||||||
process.env.GEMINI_API_KEY || loadConfig().MODELS.GEMINI.API_KEY;
|
|
||||||
|
|
||||||
export const getSearxngApiEndpoint = () =>
|
export const getSearxngApiEndpoint = () =>
|
||||||
process.env.SEARXNG_API_URL || loadConfig().API_ENDPOINTS.SEARXNG;
|
process.env.SEARXNG_API_URL || loadConfig().API_ENDPOINTS.SEARXNG;
|
||||||
|
|
||||||
export const getOllamaApiEndpoint = () =>
|
export const getOllamaApiEndpoint = () => loadConfig().MODELS.OLLAMA.API_URL;
|
||||||
process.env.OLLAMA_API_URL || loadConfig().MODELS.OLLAMA.API_URL;
|
|
||||||
|
|
||||||
export const getCustomOpenaiApiKey = () =>
|
export const getCustomOpenaiApiKey = () =>
|
||||||
process.env.CUSTOM_OPENAI_API_KEY || loadConfig().MODELS.CUSTOM_OPENAI.API_KEY;
|
loadConfig().MODELS.CUSTOM_OPENAI.API_KEY;
|
||||||
|
|
||||||
export const getCustomOpenaiApiUrl = () =>
|
export const getCustomOpenaiApiUrl = () =>
|
||||||
process.env.CUSTOM_OPENAI_API_URL || loadConfig().MODELS.CUSTOM_OPENAI.API_URL;
|
loadConfig().MODELS.CUSTOM_OPENAI.API_URL;
|
||||||
|
|
||||||
export const getCustomOpenaiModelName = () =>
|
export const getCustomOpenaiModelName = () =>
|
||||||
process.env.CUSTOM_OPENAI_MODEL_NAME || loadConfig().MODELS.CUSTOM_OPENAI.MODEL_NAME;
|
loadConfig().MODELS.CUSTOM_OPENAI.MODEL_NAME;
|
||||||
|
|
||||||
const mergeConfigs = (current: any, update: any): any => {
|
const mergeConfigs = (current: any, update: any): any => {
|
||||||
if (update === null || update === undefined) {
|
if (update === null || update === undefined) {
|
||||||
|
Reference in New Issue
Block a user