Compare commits

...

30 Commits

Author SHA1 Message Date
Markus Heiser
849975b3fd Merge pull request #293 from 0fficersally/0fficersally
Update `valkey:7-alpine` to `valkey:8-alpine` in `README.md`
2024-10-29 18:17:31 +01:00
Lysander Fontyn
65fa0f9cb6 Update valkey:7-alpine to valkey:8-alpine in README.md
This will update `valkey:7-alpine` to `valkey:8-alpine` in `README.md`, as it has not been updated yet. This is a follow-up on commit 61745b3bf1.
2024-10-29 18:00:07 +01:00
Bnyro
72cb934126 [refactor] readme: add hosting instructions for bringing own reverse proxy 2024-10-06 11:56:21 +02:00
Bnyro
f2b9efe33e feat: uwsgi workers / threads configuration options (#235) 2024-10-04 11:25:44 +02:00
stoXe
0667030a42 Explain required cap_drop removal on first run (#258)
Add instructions to the `README.md` for removing `cap_drop: - ALL` on the first run.

* **Explanation**: Add a note explaining that `cap_drop: - ALL` must be removed from the `docker-compose.yaml` file for the `searxng` service to successfully create `/etc/searxng/uwsgi.ini`.
* **Reason**: Explain that the `cap_drop: - ALL` directive removes all capabilities, including those required for the creation of the `uwsgi.ini` file.

---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/IAmStoxe/searxng-docker?shareId=XXXX-XXXX-XXXX-XXXX).
2024-10-04 11:24:33 +02:00
Ivan Gabaldon
61745b3bf1 Update to Valkey 8 (#273) 2024-09-22 18:41:39 +02:00
Ivan Gabaldon
35525c664b remove note about ARMv7 (#253) 2024-08-04 00:34:26 +02:00
Marco Perini
de09409572 docs(secret): add powershell script to generate secret (#249) 2024-08-01 12:22:08 +02:00
Markus Heiser
206682d230 Merge pull request #245 from jiangying000/patch-1
fix limiter.toml url
2024-07-13 07:53:59 +02:00
jiangying
157b0a3fb9 fix limiter.toml url 2024-07-13 13:32:31 +08:00
Émilien (perso)
fc4327cd50 note about armv7 2024-06-09 08:03:46 +00:00
Ivan Gabaldon
63f06f5db3 Replace with official Valkey image (#234)
* replace with official image

* use `7-alpine` tag

* prevent collision with other volumes

* Revert editing README formatting

---------

Co-authored-by: Émilien (perso) <4016501+unixfox@users.noreply.github.com>
2024-06-02 21:47:14 +02:00
Émilien (perso)
8546bf599b Add automatic restart of the services
close https://github.com/searxng/searxng-docker/pull/106
2024-05-13 15:43:18 +02:00
Ivan Gabaldon
a0e711191e Replace Redis with Valkey + reduce logging for containers caddy and redis (#230)
* replace redis w/valkey

* cleanup

* apply changes

* revert volume reuse

* fix valkey container

* revert remove `CAP_DROP` `CAP_ADD`

* revert switch from `redis` to `valkey`

* revert revert volume reuse

* update README

* apply changes

* add back useful stuff from README + keep structure + keep compat old docker compose

---------

Co-authored-by: Emilien Devos <4016501+unixfox@users.noreply.github.com>
2024-05-13 15:39:28 +02:00
Lemonade
83447b9435 Fixed searxng-docker.service.template issue (#225) 2024-04-17 14:02:09 +02:00
iacore
8e3220be09 Add docker.io prefix to container image names (#221)
Co-authored-by: iacore <noreply+gpg-stub@1a-insec.net>
2024-02-29 14:19:37 +01:00
Nicolas Bonduel
3ec746a2b4 Update README to use newer docker compose command (#205)
* Update README to use newer docker compose command

* Update README to add note about docker < 3.6.0 and docker-compose

* Update the docker compose install url
2024-01-08 21:45:10 +00:00
Ivan Gabaldon
6813aff4d4 allow persistent rdb (#198)
Signed-off-by: Inetol <igabaldon@inetol.net>
2023-11-28 18:35:40 +01:00
Émilien (perso)
47fad9cba6 remove duplicated limiter parameter 2023-10-25 10:44:24 +02:00
Émilien (perso)
d63d0c77a8 Simply the update process 2023-09-24 09:39:54 +00:00
Émilien (perso)
fa11493d8a update instructions for update docker-compose 2023-09-24 09:38:50 +00:00
Alexandre Flament
41ca45c87f Merge pull request #182 from dalf/enable_limiter
Enable limiter by default
2023-09-22 20:35:01 +02:00
Alexandre Flament
69eb81f031 Enable limiter by default
Related to https://github.com/searxng/searxng/pull/2832
2023-09-22 16:25:27 +00:00
Alexandre Flament
070b02e6da fix URL to documentation in searxng/settings.yml
Close #173
2023-08-25 08:11:09 +02:00
Alexandre Flament
9e42027c31 Merge pull request #162 from ChillyKitty/patch-1
Update Caddyfile to Add X-Real-IP to fix bot detection
2023-08-25 07:54:53 +02:00
ChillyKitty
8b2d017136 Update Caddyfile to Add X-Real-IP to fix bot detection
Bot detection complains about not having X-Real-IP which is required https://docs.searxng.org/src/searx.botdetection.html#id4 this adds the header and fixes the problem for me.
2023-06-20 02:45:04 +00:00
Alexandre Flament
e76656a162 Merge pull request #110 from searxng/dac_override
docker-compose.yaml: remove CAP_DAC_OVERRIDE
2022-12-31 18:35:37 +01:00
Alexandre Flament
12d726f4ff docker-compose.yaml: remove CAP_DAC_OVERRIDE
Close #30
2022-12-31 00:28:19 +00:00
Alexandre Flament
d4f06df911 Merge pull request #77 from searxng/remove_security_yml
Delete security.yml
2022-09-01 18:48:52 +02:00
Alexandre Flament
09742281df Delete security.yml
See https://github.com/searxng/searxng/pull/1730
2022-08-31 20:44:15 +02:00
8 changed files with 110 additions and 81 deletions

7
.env
View File

@@ -5,3 +5,10 @@
# SEARXNG_HOSTNAME=<host>
# LETSENCRYPT_EMAIL=<email>
# Optional:
# If you run a very small or a very large instance, you might want to change the amount of used uwsgi workers and threads per worker
# More workers (= processes) means that more search requests can be handled at the same time, but it also causes more resource usage
# SEARXNG_UWSGI_WORKERS=4
# SEARXNG_UWSGI_THREADS=4

View File

@@ -1,27 +0,0 @@
name: "Security checks"
on:
schedule:
- cron: "05 06 * * *"
workflow_dispatch:
jobs:
dockers:
name: Trivy ${{ matrix.image }}
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
image: ["searxng/searxng", "dalf/filtron", "dalf/morty"]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
with:
image-ref: '${{ matrix.image }}:latest'
format: 'table'
exit-code: '1'
ignore-unfixed: false
vuln-type: 'os,library'
severity: 'UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL'

View File

@@ -92,6 +92,7 @@
reverse_proxy localhost:8080 {
header_up X-Forwarded-Port {http.request.port}
header_up X-Forwarded-Proto {http.request.scheme}
header_up X-Real-IP {remote_host}
}
}

View File

@@ -1,37 +1,62 @@
# searxng-docker
Create a new SearXNG instance in five minutes using Docker
Create a new SearXNG instance in five minutes using Docker
## What is included ?
| Name | Description | Docker image | Dockerfile |
| -- | -- | -- | -- |
| [Caddy](https://github.com/caddyserver/caddy) | Reverse proxy (create a LetsEncrypt certificate automatically) | [caddy/caddy:2-alpine](https://hub.docker.com/_/caddy) | [Dockerfile](https://github.com/caddyserver/caddy-docker) |
| [SearXNG](https://github.com/searxng/searxng) | SearXNG by itself | [searxng/searxng:latest](https://hub.docker.com/r/searxng/searxng) | [Dockerfile](https://github.com/searxng/searxng/blob/master/Dockerfile) |
| [Redis](https://github.com/redis/redis) | In-memory database | [redis:alpine](https://hub.docker.com/_/redis) | [Dockerfile-alpine.template](https://github.com/docker-library/redis/blob/master/Dockerfile-alpine.template) |
| [Caddy](https://github.com/caddyserver/caddy) | Reverse proxy (create a LetsEncrypt certificate automatically) | [docker.io/library/caddy:2-alpine](https://hub.docker.com/_/caddy) | [Dockerfile](https://github.com/caddyserver/caddy-docker/blob/master/Dockerfile.tmpl) |
| [SearXNG](https://github.com/searxng/searxng) | SearXNG by itself | [docker.io/searxng/searxng:latest](https://hub.docker.com/r/searxng/searxng) | [Dockerfile](https://github.com/searxng/searxng/blob/master/Dockerfile) |
| [Valkey](https://github.com/valkey-io/valkey) | In-memory database | [docker.io/valkey/valkey:8-alpine](https://hub.docker.com/r/valkey/valkey) | [Dockerfile](https://github.com/valkey-io/valkey-container/blob/mainline/Dockerfile.template) |
## How to use it
- [Install docker](https://docs.docker.com/install/)
- [Install docker-compose](https://docs.docker.com/compose/install/) (be sure that docker-compose version is at least 1.9.0)
- Get searxng-docker
There are two ways to host SearXNG. The first one doesn't require any prior knowledge about self-hosting and thus is recommended for beginners. It includes caddy as a reverse proxy and automatically deals with the TLS certificates for you. The second one is recommended for more advanced users that already have their own reverse proxy (e.g. Nginx, HAProxy, ...) and probably some other services running on their machine. The first few steps are the same for both installation methods however.
1. [Install docker](https://docs.docker.com/install/)
2. Get searxng-docker
```sh
cd /usr/local
git clone https://github.com/searxng/searxng-docker.git
cd searxng-docker
```
- Edit the [.env](https://github.com/searxng/searxng-docker/blob/master/.env) file to set the hostname and an email
- Generate the secret key ```sed -i "s|ultrasecretkey|$(openssl rand -hex 32)|g" searxng/settings.yml```
- Edit the [searxng/settings.yml](https://github.com/searxng/searxng-docker/blob/master/searxng/settings.yml) file according to your need
- Check everything is working: ```docker-compose up```
- Run SearXNG in the background: ```docker-compose up -d```
3. Edit the [.env](https://github.com/searxng/searxng-docker/blob/master/.env) file to set the hostname and an email
4. Generate the secret key `sed -i "s|ultrasecretkey|$(openssl rand -hex 32)|g" searxng/settings.yml`
5. Edit [searxng/settings.yml](https://github.com/searxng/searxng-docker/blob/master/searxng/settings.yml) according to your needs
## How to access the logs
To access the logs from all the containers use: `docker-compose logs -f`.
> [!NOTE]
> On the first run, you must remove `cap_drop: - ALL` from the `docker-compose.yaml` file for the `searxng` service to successfully create `/etc/searxng/uwsgi.ini`. This is necessary because the `cap_drop: - ALL` directive removes all capabilities, including those required for the creation of the `uwsgi.ini` file. After the first run, you should re-add `cap_drop: - ALL` to the `docker-compose.yaml` file for security reasons.
> [!NOTE]
> Windows users can use the following powershell script to generate the secret key:
> ```powershell
> $randomBytes = New-Object byte[] 32
> (New-Object Security.Cryptography.RNGCryptoServiceProvider).GetBytes($randomBytes)
> $secretKey = -join ($randomBytes | ForEach-Object { "{0:x2}" -f $_ })
> (Get-Content searxng/settings.yml) -replace 'ultrasecretkey', $secretKey | Set-Content searxng/settings.yml
> ```
### Method 1: With Caddy included (recommended for beginners)
6. Run SearXNG in the background: `docker compose up -d`
### Method 2: Bring your own reverse proxy (experienced users)
6. Remove the caddy related parts in `docker-compose.yaml` such as the caddy service and its volumes.
7. Point your reverse proxy to the port set for the `searxng` service in `docker-compose.yml` (8080 by default).
8. Generate and configure the required TLS certificates with the reverse proxy of your choice.
9. Run SearXNG in the background: `docker compose up -d`
> [!NOTE]
> You can change the port `searxng` listens on inside the docker container (e.g. if you want to operate in `host` network mode) with the `BIND_ADDRESS` environment variable (defaults to `0.0.0.0:8080`). The environment variable can be set directly inside `docker-compose.yaml`.
## Troubleshooting - How to access the logs
To access the logs from all the containers use: `docker compose logs -f`.
To access the logs of one specific container:
- Caddy: `docker-compose logs -f caddy`
- SearXNG: `docker-compose logs -f searxng`
- Redis: `docker-compose logs -f redis`
- Caddy: `docker compose logs -f caddy`
- SearXNG: `docker compose logs -f searxng`
- Valkey: `docker compose logs -f redis`
### Start SearXNG with systemd
@@ -51,11 +76,12 @@ The SearXNG image proxy is activated by default.
The default [Content-Security-Policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy) allow the browser to access to ```${SEARXNG_HOSTNAME}``` and ```https://*.tile.openstreetmap.org;```.
If some users wants to disable the image proxy, you have to modify [./Caddyfile](https://github.com/searxng/searxng-docker/blob/master/Caddyfile). Replace the ```img-src 'self' data: https://*.tile.openstreetmap.org;``` by ```img-src * data:;```.
If some users want to disable the image proxy, you have to modify [./Caddyfile](https://github.com/searxng/searxng-docker/blob/master/Caddyfile). Replace the ```img-src 'self' data: https://*.tile.openstreetmap.org;``` by ```img-src * data:;```.
## Multi Architecture Docker images
Supported architecture:
- amd64
- arm64
- arm/v7
@@ -65,11 +91,15 @@ Supported architecture:
To update the SearXNG stack:
```sh
docker-compose pull
docker-compose down
docker-compose up
git pull
docker compose pull
docker compose up -d
```
To update this `docker-compose.yml` file:
Or the old way (with the old docker-compose version):
Check out the newest version on github: [searxng/searxng-docker](https://github.com/searxng/searxng-docker).
```sh
git pull
docker-compose pull
docker-compose up -d
```

View File

@@ -1,11 +1,11 @@
version: '3.7'
version: "3.7"
services:
caddy:
container_name: caddy
image: caddy:2-alpine
image: docker.io/library/caddy:2-alpine
network_mode: host
restart: unless-stopped
volumes:
- ./Caddyfile:/etc/caddy/Caddyfile:ro
- caddy-data:/data:rw
@@ -17,38 +17,24 @@ services:
- ALL
cap_add:
- NET_BIND_SERVICE
- DAC_OVERRIDE
logging:
driver: "json-file"
options:
max-size: "1m"
max-file: "1"
redis:
container_name: redis
image: "redis:alpine"
command: redis-server --save "" --appendonly "no"
image: docker.io/valkey/valkey:8-alpine
command: valkey-server --save 30 1 --loglevel warning
restart: unless-stopped
networks:
- searxng
tmpfs:
- /var/lib/redis
cap_drop:
- ALL
cap_add:
- SETGID
- SETUID
- DAC_OVERRIDE
searxng:
container_name: searxng
image: searxng/searxng:latest
networks:
- searxng
ports:
- "127.0.0.1:8080:8080"
volumes:
- ./searxng:/etc/searxng:rw
environment:
- SEARXNG_BASE_URL=https://${SEARXNG_HOSTNAME:-localhost}/
- valkey-data2:/data
cap_drop:
- ALL
cap_add:
- CHOWN
- SETGID
- SETUID
- DAC_OVERRIDE
@@ -57,11 +43,37 @@ services:
options:
max-size: "1m"
max-file: "1"
searxng:
container_name: searxng
image: docker.io/searxng/searxng:latest
restart: unless-stopped
networks:
- searxng
ports:
- "127.0.0.1:8080:8080"
volumes:
- ./searxng:/etc/searxng:rw
environment:
- SEARXNG_BASE_URL=https://${SEARXNG_HOSTNAME:-localhost}/
- UWSGI_WORKERS=${SEARXNG_UWSGI_WORKERS:-4}
- UWSGI_THREADS=${SEARXNG_UWSGI_THREADS:-4}
cap_drop:
- ALL
cap_add:
- CHOWN
- SETGID
- SETUID
logging:
driver: "json-file"
options:
max-size: "1m"
max-file: "1"
networks:
searxng:
ipam:
driver: default
volumes:
caddy-data:
caddy-config:
valkey-data2:

View File

@@ -9,8 +9,8 @@ Restart=on-failure
Environment=SEARXNG_DOCKERCOMPOSEFILE=docker-compose.yaml
WorkingDirectory=/usr/local/searxng-docker
ExecStart=/usr/local/bin/docker-compose -f ${SEARXNG_DOCKERCOMPOSEFILE} up --remove-orphans
ExecStop=/usr/local/bin/docker-compose -f ${SEARXNG_DOCKERCOMPOSEFILE} down
ExecStart=/usr/local/bin/docker compose -f ${SEARXNG_DOCKERCOMPOSEFILE} up --remove-orphans
ExecStop=/usr/local/bin/docker compose -f ${SEARXNG_DOCKERCOMPOSEFILE} down
[Install]
WantedBy=multi-user.target

6
searxng/limiter.toml Normal file
View File

@@ -0,0 +1,6 @@
# This configuration file updates the default configuration file
# See https://github.com/searxng/searxng/blob/master/searx/limiter.toml
[botdetection.ip_limit]
# activate link_token method in the ip_limit method
link_token = true

View File

@@ -1,4 +1,4 @@
# see https://docs.searxng.org/admin/engines/settings.html#use-default-settings
# see https://docs.searxng.org/admin/settings/settings.html#settings-use-default-settings
use_default_settings: true
server:
# base_url is defined in the SEARXNG_BASE_URL environment variable, see .env and docker-compose.yml