feat: монорепо миграция, Discover/SearxNG улучшения
- Миграция на монорепозиторий (apps/frontend, apps/chat-service, etc.) - Discover: проверка SearxNG, понятное empty state при ненастроенном поиске - searxng.ts: валидация URL, проверка JSON-ответа, авто-добавление http:// - docker/searxng-config: настройки для JSON API SearxNG Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
76
docker/Dockerfile
Normal file
76
docker/Dockerfile
Normal file
@@ -0,0 +1,76 @@
|
||||
FROM node:24.5.0-slim AS builder
|
||||
|
||||
RUN apt-get update && apt-get install -y python3 python3-pip sqlite3 && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
WORKDIR /home/gooseek
|
||||
|
||||
COPY package.json package-lock.json ./
|
||||
COPY apps/frontend/package.json ./apps/frontend/
|
||||
COPY apps/shared-types/package.json ./apps/shared-types/
|
||||
COPY apps/shared-utils/package.json ./apps/shared-utils/
|
||||
|
||||
RUN npm install
|
||||
|
||||
COPY apps ./apps
|
||||
|
||||
RUN mkdir -p /home/gooseek/apps/frontend/data
|
||||
ENV DATA_DIR=/home/gooseek/apps/frontend
|
||||
RUN npm run build
|
||||
|
||||
FROM node:24.5.0-slim
|
||||
|
||||
RUN apt-get update && apt-get install -y \
|
||||
python3-dev python3-babel python3-venv python-is-python3 \
|
||||
uwsgi uwsgi-plugin-python3 \
|
||||
git build-essential libxslt-dev zlib1g-dev libffi-dev libssl-dev \
|
||||
curl sudo \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
WORKDIR /home/gooseek
|
||||
|
||||
COPY --from=builder /home/gooseek/apps/frontend/public ./public
|
||||
COPY --from=builder /home/gooseek/apps/frontend/.next/static ./public/_next/static
|
||||
COPY --from=builder /home/gooseek/apps/frontend/.next/standalone ./
|
||||
COPY --from=builder /home/gooseek/apps/frontend/drizzle ./drizzle
|
||||
|
||||
RUN mkdir -p /home/gooseek/data /home/gooseek/uploads
|
||||
|
||||
RUN useradd --shell /bin/bash --system \
|
||||
--home-dir "/usr/local/searxng" \
|
||||
--comment 'Privacy-respecting metasearch engine' \
|
||||
searxng
|
||||
|
||||
RUN mkdir "/usr/local/searxng"
|
||||
RUN mkdir -p /etc/searxng
|
||||
RUN chown -R "searxng:searxng" "/usr/local/searxng"
|
||||
|
||||
COPY docker/searxng/settings.yml /etc/searxng/settings.yml
|
||||
COPY docker/searxng/limiter.toml /etc/searxng/limiter.toml
|
||||
COPY docker/searxng/uwsgi.ini /etc/searxng/uwsgi.ini
|
||||
RUN chown -R searxng:searxng /etc/searxng
|
||||
|
||||
USER searxng
|
||||
|
||||
RUN git clone "https://github.com/searxng/searxng" \
|
||||
"/usr/local/searxng/searxng-src"
|
||||
|
||||
RUN python3 -m venv "/usr/local/searxng/searx-pyenv"
|
||||
RUN "/usr/local/searxng/searx-pyenv/bin/pip" install --upgrade pip setuptools wheel pyyaml msgspec
|
||||
RUN cd "/usr/local/searxng/searxng-src" && \
|
||||
"/usr/local/searxng/searx-pyenv/bin/pip" install --use-pep517 --no-build-isolation -e .
|
||||
|
||||
USER root
|
||||
|
||||
WORKDIR /home/gooseek
|
||||
COPY docker/entrypoint.sh ./entrypoint.sh
|
||||
RUN chmod +x ./entrypoint.sh
|
||||
RUN sed -i 's/\r$//' ./entrypoint.sh || true
|
||||
|
||||
RUN echo "searxng ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
|
||||
|
||||
EXPOSE 3000 8080
|
||||
|
||||
ENV SEARXNG_API_URL=http://localhost:8080
|
||||
ENV DATA_DIR=/home/gooseek
|
||||
|
||||
CMD ["/home/gooseek/entrypoint.sh"]
|
||||
37
docker/Dockerfile.slim
Normal file
37
docker/Dockerfile.slim
Normal file
@@ -0,0 +1,37 @@
|
||||
FROM node:24.5.0-slim AS builder
|
||||
|
||||
RUN apt-get update && apt-get install -y python3 python3-pip sqlite3 && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
WORKDIR /home/gooseek
|
||||
|
||||
COPY package.json package-lock.json ./
|
||||
COPY apps/frontend/package.json ./apps/frontend/
|
||||
COPY apps/shared-types/package.json ./apps/shared-types/
|
||||
COPY apps/shared-utils/package.json ./apps/shared-utils/
|
||||
|
||||
RUN npm install
|
||||
|
||||
COPY apps ./apps
|
||||
|
||||
RUN mkdir -p /home/gooseek/apps/frontend/data
|
||||
ENV DATA_DIR=/home/gooseek/apps/frontend
|
||||
RUN npm run build
|
||||
|
||||
FROM node:24.5.0-slim
|
||||
|
||||
RUN apt-get update && apt-get install -y python3 python3-pip sqlite3 && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
WORKDIR /home/gooseek
|
||||
|
||||
COPY --from=builder /home/gooseek/apps/frontend/public ./public
|
||||
COPY --from=builder /home/gooseek/apps/frontend/.next/static ./public/_next/static
|
||||
COPY --from=builder /home/gooseek/apps/frontend/.next/standalone ./
|
||||
COPY --from=builder /home/gooseek/apps/frontend/drizzle ./drizzle
|
||||
|
||||
RUN mkdir -p /home/gooseek/data /home/gooseek/uploads
|
||||
|
||||
EXPOSE 3000
|
||||
|
||||
ENV DATA_DIR=/home/gooseek
|
||||
|
||||
CMD ["node", "server.js"]
|
||||
15
docker/docker-compose.yaml
Normal file
15
docker/docker-compose.yaml
Normal file
@@ -0,0 +1,15 @@
|
||||
services:
|
||||
gooseek:
|
||||
image: itzcrazykns1337/gooseek:latest
|
||||
build:
|
||||
context: ..
|
||||
dockerfile: docker/Dockerfile
|
||||
ports:
|
||||
- '3000:3000'
|
||||
volumes:
|
||||
- data:/home/gooseek/data
|
||||
restart: unless-stopped
|
||||
|
||||
volumes:
|
||||
data:
|
||||
name: 'gooseek-data'
|
||||
32
docker/entrypoint.sh
Normal file
32
docker/entrypoint.sh
Normal file
@@ -0,0 +1,32 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
echo "Starting SearXNG..."
|
||||
|
||||
sudo -H -u searxng bash -c "cd /usr/local/searxng/searxng-src && export SEARXNG_SETTINGS_PATH='/etc/searxng/settings.yml' && export FLASK_APP=searx/webapp.py && /usr/local/searxng/searx-pyenv/bin/python -m flask run --host=0.0.0.0 --port=8080" &
|
||||
SEARXNG_PID=$!
|
||||
|
||||
echo "Waiting for SearXNG to be ready..."
|
||||
sleep 5
|
||||
|
||||
COUNTER=0
|
||||
MAX_TRIES=30
|
||||
until curl -s http://localhost:8080 > /dev/null 2>&1; do
|
||||
COUNTER=$((COUNTER+1))
|
||||
if [ $COUNTER -ge $MAX_TRIES ]; then
|
||||
echo "Warning: SearXNG health check timeout, but continuing..."
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
|
||||
if curl -s http://localhost:8080 > /dev/null 2>&1; then
|
||||
echo "SearXNG started successfully (PID: $SEARXNG_PID)"
|
||||
else
|
||||
echo "SearXNG may not be fully ready, but continuing (PID: $SEARXNG_PID)"
|
||||
fi
|
||||
|
||||
cd /home/gooseek
|
||||
echo "Starting GooSeek..."
|
||||
|
||||
exec node server.js
|
||||
9
docker/searxng-config/settings.yml
Normal file
9
docker/searxng-config/settings.yml
Normal file
@@ -0,0 +1,9 @@
|
||||
use_default_settings: true
|
||||
|
||||
server:
|
||||
secret_key: "gooseek-local-dev-change-in-production"
|
||||
|
||||
search:
|
||||
formats:
|
||||
- html
|
||||
- json
|
||||
3
docker/searxng/limiter.toml
Normal file
3
docker/searxng/limiter.toml
Normal file
@@ -0,0 +1,3 @@
|
||||
[botdetection.ip_limit]
|
||||
# activate link_token method in the ip_limit method
|
||||
link_token = true
|
||||
17
docker/searxng/settings.yml
Normal file
17
docker/searxng/settings.yml
Normal file
@@ -0,0 +1,17 @@
|
||||
use_default_settings: true
|
||||
|
||||
general:
|
||||
instance_name: 'searxng'
|
||||
|
||||
search:
|
||||
autocomplete: 'google'
|
||||
formats:
|
||||
- html
|
||||
- json
|
||||
|
||||
server:
|
||||
secret_key: 'a2fb23f1b02e6ee83875b09826990de0f6bd908b6638e8c10277d415f6ab852b' # Is overwritten by ${SEARXNG_SECRET}
|
||||
|
||||
engines:
|
||||
- name: wolframalpha
|
||||
disabled: false
|
||||
50
docker/searxng/uwsgi.ini
Normal file
50
docker/searxng/uwsgi.ini
Normal file
@@ -0,0 +1,50 @@
|
||||
[uwsgi]
|
||||
# Who will run the code
|
||||
uid = searxng
|
||||
gid = searxng
|
||||
|
||||
# Number of workers (usually CPU count)
|
||||
# default value: %k (= number of CPU core, see Dockerfile)
|
||||
workers = %k
|
||||
|
||||
# Number of threads per worker
|
||||
# default value: 4 (see Dockerfile)
|
||||
threads = 4
|
||||
|
||||
# The right granted on the created socket
|
||||
chmod-socket = 666
|
||||
|
||||
# Plugin to use and interpreter config
|
||||
single-interpreter = true
|
||||
master = true
|
||||
plugin = python3
|
||||
lazy-apps = true
|
||||
enable-threads = 4
|
||||
|
||||
# Module to import
|
||||
module = searx.webapp
|
||||
|
||||
# Virtualenv and python path
|
||||
pythonpath = /usr/local/searxng/
|
||||
chdir = /usr/local/searxng/searx/
|
||||
|
||||
# automatically set processes name to something meaningful
|
||||
auto-procname = true
|
||||
|
||||
# Disable request logging for privacy
|
||||
disable-logging = true
|
||||
log-5xx = true
|
||||
|
||||
# Set the max size of a request (request-body excluded)
|
||||
buffer-size = 8192
|
||||
|
||||
# No keep alive
|
||||
# See https://github.com/searx/searx-docker/issues/24
|
||||
add-header = Connection: close
|
||||
|
||||
# uwsgi serves the static files
|
||||
static-map = /static=/usr/local/searxng/searx/static
|
||||
# expires set to one day
|
||||
static-expires = /* 86400
|
||||
static-gzip-all = True
|
||||
offload-threads = 4
|
||||
Reference in New Issue
Block a user