Feat : integration of searxng for private, api free web search
This commit is contained in:
@@ -0,0 +1 @@
|
||||
SEARXNG_BASE_URL="http://127.0.0.1:8080"
|
||||
@@ -0,0 +1,44 @@
|
||||
services:
|
||||
redis:
|
||||
container_name: redis
|
||||
image: docker.io/valkey/valkey:8-alpine
|
||||
command: valkey-server --save 30 1 --loglevel warning
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- redis-data:/data
|
||||
cap_drop:
|
||||
- ALL
|
||||
cap_add:
|
||||
- SETGID
|
||||
- SETUID
|
||||
- DAC_OVERRIDE
|
||||
logging:
|
||||
driver: "json-file"
|
||||
options:
|
||||
max-size: "1m"
|
||||
max-file: "1"
|
||||
|
||||
searxng:
|
||||
container_name: searxng
|
||||
image: docker.io/searxng/searxng:latest
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "8080:8080"
|
||||
volumes:
|
||||
- ./searxng:/etc/searxng:rw
|
||||
environment:
|
||||
- SEARXNG_BASE_URL=http://localhost:8080/
|
||||
- UWSGI_WORKERS=4
|
||||
- UWSGI_THREADS=4
|
||||
cap_add:
|
||||
- CHOWN
|
||||
- SETGID
|
||||
- SETUID
|
||||
logging:
|
||||
driver: "json-file"
|
||||
options:
|
||||
max-size: "1m"
|
||||
max-file: "1"
|
||||
|
||||
volumes:
|
||||
redis-data:
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,52 @@
|
||||
[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 = 4
|
||||
|
||||
# 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
|
||||
|
||||
# Follow SIGTERM convention
|
||||
# See https://github.com/searxng/searxng/issues/3427
|
||||
die-on-term
|
||||
|
||||
# uwsgi serves the static files
|
||||
static-map = /static=/usr/local/searxng/searx/static
|
||||
static-gzip-all = True
|
||||
offload-threads = 4
|
||||
File diff suppressed because it is too large
Load Diff
Executable
+102
@@ -0,0 +1,102 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Script to automate SearXNG setup and deployment with Docker Compose
|
||||
|
||||
command_exists() {
|
||||
command -v "$1" &> /dev/null
|
||||
}
|
||||
|
||||
# Check if Docker is installed
|
||||
if ! command_exists docker; then
|
||||
echo "Error: Docker is not installed. Please install Docker first."
|
||||
echo "On Ubuntu: sudo apt install docker.io"
|
||||
echo "On macOS/Windows: Install Docker Desktop from https://www.docker.com/get-started/"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if Docker daemon is running
|
||||
echo "Checking if Docker daemon is running..."
|
||||
if ! docker info &> /dev/null; then
|
||||
echo "Error: Docker daemon is not running or inaccessible."
|
||||
if [ "$(uname)" = "Linux" ]; then
|
||||
echo "Trying to start Docker service (may require sudo)..."
|
||||
if sudo systemctl start docker &> /dev/null; then
|
||||
echo "Docker started successfully."
|
||||
else
|
||||
echo "Failed to start Docker. Possible issues:"
|
||||
echo "1. Run this script with sudo: sudo bash setup_searxng.sh"
|
||||
echo "2. Check Docker installation: sudo systemctl status docker"
|
||||
echo "3. Add your user to the docker group: sudo usermod -aG docker $USER (then log out and back in)"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "Please start Docker manually:"
|
||||
echo "- On macOS/Windows: Open Docker Desktop."
|
||||
echo "- On Linux: Run 'sudo systemctl start docker' or check your distro's docs."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "Docker daemon is running."
|
||||
fi
|
||||
|
||||
# Check if Docker Compose is installed
|
||||
if ! command_exists docker-compose; then
|
||||
echo "Error: Docker Compose is not installed. Please install it first."
|
||||
echo "On Ubuntu: sudo apt install docker-compose"
|
||||
echo "Or via pip: pip install docker-compose"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Create a directory for SearXNG config if it doesn’t exist
|
||||
mkdir -p searxng
|
||||
cd . || exit
|
||||
|
||||
# Check if docker-compose.yml exists
|
||||
if [ ! -f "docker-compose.yml" ]; then
|
||||
echo "Error: docker-compose.yml not found in the current directory."
|
||||
echo "Please create it before running this script."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Start containers to generate initial config files
|
||||
echo "Starting containers for initial setup..."
|
||||
if ! docker-compose up -d; then
|
||||
echo "Error: Failed to start containers. Check Docker logs with 'docker compose logs'."
|
||||
echo "Possible fixes: Run with sudo or ensure port 8080 is free."
|
||||
exit 1
|
||||
fi
|
||||
sleep 10
|
||||
|
||||
# Generate a secret key and update settings
|
||||
SECRET_KEY=$(openssl rand -hex 32)
|
||||
if [ -f "searxng/settings.yml" ]; then
|
||||
if [ "$(uname)" = "Darwin" ]; then
|
||||
sed -i '' "s/ultrasecretkey/$SECRET_KEY/g" searxng/settings.yml || {
|
||||
echo "Warning: Failed to update settings.yml with secret key. Please check the file manually."
|
||||
}
|
||||
else
|
||||
sed -i "s/ultrasecretkey/$SECRET_KEY/g" searxng/settings.yml || {
|
||||
echo "Warning: Failed to update settings.yml with secret key. Please check the file manually."
|
||||
}
|
||||
fi
|
||||
else
|
||||
echo "Error: settings.yml not found. Initial setup may have failed."
|
||||
docker-compose logs searxng
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Stop containers
|
||||
echo "Stopping containers to apply security settings..."
|
||||
docker-compose down
|
||||
|
||||
# Start containers again with secure settings
|
||||
echo "Deploying SearXNG with secure settings..."
|
||||
if ! docker-compose up -d; then
|
||||
echo "Error: Failed to deploy SearXNG. Check logs with 'docker compose logs'."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Display status and access instructions
|
||||
echo "SearXNG setup complete!"
|
||||
docker ps -a --filter "name=searxng" --filter "name=redis"
|
||||
echo "Access SearXNG at: http://localhost:8080"
|
||||
Reference in New Issue
Block a user