Merge pull request #2 from searxng/searxng

SearXNG
pull/5/head
Alexandre Flament 3 years ago committed by GitHub
commit c9762306a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,14 +1,14 @@
# By default listen on https://localhost
# To change this:
# * uncomment SEARX_HOSTNAME, and replace <host> by the searx hostname
# * uncomment SEARXNG_HOSTNAME, and replace <host> by the SearXNG hostname
# * uncomment LETSENCRYPT_EMAIL, and replace <email> by your email (require to create a Let's Encrypt certificate)
# SEARX_HOSTNAME=<host>
# SEARXNG_HOSTNAME=<host>
# LETSENCRYPT_EMAIL=<email>
# automatically update settings to the new version
# comment this line if you made / will make some modifications to the settings
SEARX_COMMAND=-f
SEARXNG_COMMAND=-f
# use openssl rand -base64 33
MORTY_KEY=ReplaceWithARealKey!

2
.gitignore vendored

@ -1,6 +1,6 @@
*~
searx-docker.service
searxng-docker.service
caddy
srv
searx

@ -2,12 +2,12 @@
admin off
}
{$SEARX_HOSTNAME} {
{$SEARXNG_HOSTNAME} {
log {
output discard
}
tls {$SEARX_TLS}
tls {$SEARXNG_TLS}
@api {
path /config

@ -1,54 +1,54 @@
# searx-docker
# searxng-docker
Create a new searx instance in five minutes using Docker (see https://github.com/asciimoo/searx/issues/1561 )
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) |
| [Filtron](https://github.com/asciimoo/filtron) | Filtering reverse HTTP proxy, bot and abuse protection | [dalf/filtron:latest](https://hub.docker.com/r/dalf/filtron) | See [asciimoo/filtron#4](https://github.com/asciimoo/filtron/pull/4) |
| [Searx](https://github.com/asciimoo/searx) | searx by itself | [searx/searx:latest](https://hub.docker.com/r/searx/searx) | [Dockerfile](https://github.com/searx/searx/blob/master/Dockerfile) |
| [Morty](https://github.com/asciimoo/morty) | Privacy aware web content sanitizer proxy as a service. | [dalf/morty:latest](https://hub.docker.com/r/dalf/morty) | [Dockerfile](https://github.com/dalf/morty/blob/master/Dockerfile) |
| [Filtron](https://github.com/dalf/filtron) | Filtering reverse HTTP proxy, bot and abuse protection | [dalf/filtron:latest](https://hub.docker.com/r/dalf/filtron) | See [asciimoo/filtron#4](https://github.com/asciimoo/filtron/pull/4) |
| [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) |
| [Morty](https://github.com/dalf/morty) | Privacy aware web content sanitizer proxy as a service. | [dalf/morty:latest](https://hub.docker.com/r/dalf/morty) | [Dockerfile](https://github.com/dalf/morty/blob/master/Dockerfile) |
## 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).
- only on MacOSX: ```brew install coreutils``` to install ```greadlink```
- Get searx-docker
- Get searxng-docker
```sh
cd /usr/local
git clone https://github.com/searx/searx-docker.git
cd searx-docker
git clone https://github.com/searxng/searxng-docker.git
cd searxng-docker
```
- Generate MORTY_KEY ```sed -i "s|ReplaceWithARealKey\!|$(openssl rand -base64 33)|g" .env```
- Edit the other settings in [.env](https://github.com/searx/searx-docker/blob/master/.env) file according to your need
- Edit the other settings in [.env](https://github.com/searxng/searxng-docker/blob/master/.env) file according to your need
- Check everything is working: ```./start.sh```,
- ```cp searx-docker.service.template searx-docker.service```
- edit the content of ```WorkingDirectory``` in the ```searx-docker.service``` file (only if the installation path is different from /usr/local/searx-docker)
- ```cp searxng-docker.service.template searxng-docker.service```
- edit the content of ```WorkingDirectory``` in the ```searxng-docker.service``` file (only if the installation path is different from /usr/local/searxng-docker)
- Install the systemd unit :
```sh
systemctl enable $(pwd)/searx-docker.service
systemctl start searx-docker.service
systemctl enable $(pwd)/searxng-docker.service
systemctl start searxng-docker.service
```
## Note on the image proxy feature
The searx image proxy is activated by default using [Morty](https://github.com/asciimoo/morty).
The SearXNG image proxy is activated by default using [Morty](https://github.com/dalf/morty).
The default [Content-Security-Policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy) allow the browser to access to {SEARX_HOSTNAME} and ```https://*.tile.openstreetmap.org;```.
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/searx/searx-docker/blob/master/Caddyfile). Replace the ```img-src 'self' data: https://*.tile.openstreetmap.org;``` by ```img-src * data:;```
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:;```
## Custom docker-compose.yaml
Do not modify docker-compose.yaml otherwise you won't be able to update easily from the git repository.
It is possible to the [extend feature](https://docs.docker.com/compose/extends/) of docker-compose :
- stop the service : ```systemctl stop searx-docker.service```
- stop the service : ```systemctl stop searxng-docker.service```
- create a new docker-compose-extend.yaml, check with ```start.sh```
- update searx-docker.service (see SEARX_DOCKERCOMPOSEFILE)
- restart the servie : ```systemctl restart searx-docker.service```
- update searxng-docker.service (see SEARXNG_DOCKERCOMPOSEFILE)
- restart the servie : ```systemctl restart searxng-docker.service```
## Multi Architecture Docker images
@ -56,11 +56,11 @@ For now only the amd64 platform is supported.
## How to update ?
Check the content of [```update.sh```](https://github.com/searx/searx-docker/blob/master/update.sh)
Check the content of [```update.sh```](https://github.com/searxng/searxng-docker/blob/master/update.sh)
## Access to the Filtron API
The [Filtron API](https://github.com/asciimoo/filtron#api) is available on ```http://localhost:4041```
The [Filtron API](https://github.com/dalf/filtron#api) is available on ```http://localhost:4041```
For example, to display the loaded rules:
```

@ -12,8 +12,8 @@ services:
- caddy-data:/data:rw
- caddy-config:/config:rw
environment:
- SEARX_HOSTNAME=${SEARX_HOSTNAME:-localhost}
- SEARX_TLS=${LETSENCRYPT_EMAIL:-internal}
- SEARXNG_HOSTNAME=${SEARXNG_HOSTNAME:-localhost}
- SEARXNG_TLS=${LETSENCRYPT_EMAIL:-internal}
cap_drop:
- ALL
cap_add:
@ -28,27 +28,27 @@ services:
- "127.0.0.1:4040:4040"
- "127.0.0.1:4041:4041"
networks:
- searx
command: -listen 0.0.0.0:4040 -api 0.0.0.0:4041 -target searx:8080
- searxng
command: -listen 0.0.0.0:4040 -api 0.0.0.0:4041 -target searxng:8080
volumes:
- ./rules.json:/etc/filtron/rules.json:rw
read_only: true
cap_drop:
- ALL
searx:
container_name: searx
image: searx/searx:latest
searxng:
container_name: searxng
image: searxng/searxng:latest
restart: always
networks:
- searx
command: ${SEARX_COMMAND:-}
- searxng
command: ${SEARXNG_COMMAND:-}
volumes:
- ./searx:/etc/searx:rw
environment:
- BIND_ADDRESS=0.0.0.0:8080
- BASE_URL=https://${SEARX_HOSTNAME:-localhost}/
- MORTY_URL=https://${SEARX_HOSTNAME:-localhost}/morty/
- BASE_URL=https://${SEARXNG_HOSTNAME:-localhost}/
- MORTY_URL=https://${SEARXNG_HOSTNAME:-localhost}/morty/
- MORTY_KEY=${MORTY_KEY}
cap_drop:
- ALL
@ -65,7 +65,7 @@ services:
ports:
- "127.0.0.1:3000:3000"
networks:
- searx
- searxng
command: -timeout 6 -ipv6
environment:
- MORTY_KEY=${MORTY_KEY}
@ -77,7 +77,7 @@ services:
- ALL
networks:
searx:
searxng:
ipam:
driver: default

@ -1,16 +0,0 @@
[Unit]
Description=searx service
Requires=docker.service
After=docker.service
[Service]
Restart=always
Environment=SEARX_DIR=/usr/local/searx-docker
Environment=SEARX_DOCKERCOMPOSEFILE=docker-compose.yaml
ExecStart=/bin/sh -c "${SEARX_DIR}/start.sh"
ExecStop=/bin/sh -c "${SEARX_DIR}/stop.sh"
[Install]
WantedBy=multi-user.target

@ -0,0 +1,16 @@
[Unit]
Description=SearXNG service
Requires=docker.service
After=docker.service
[Service]
Restart=always
Environment=SEARXNG_DIR=/usr/local/searxng-docker
Environment=SEARXNG_DOCKERCOMPOSEFILE=docker-compose.yaml
ExecStart=/bin/sh -c "${SEARXNG_DIR}/start.sh"
ExecStop=/bin/sh -c "${SEARXNG_DIR}/stop.sh"
[Install]
WantedBy=multi-user.target

@ -4,7 +4,7 @@
#
# change if require
SERVICE_NAME="searx-docker.service"
SERVICE_NAME="searxng-docker.service"
# change if require :
# fastforward : only fast-forward
@ -46,7 +46,7 @@ if [ "$current_commit" = "$origin_master_commit" ]; then
fi
# docker stuff
SEARX_DOCKERCOMPOSE=$(grep "Environment=SEARX_DOCKERCOMPOSEFILE=" "$SERVICE_NAME" | awk -F\= '{ print $3 }')
SEARXNG_DOCKERCOMPOSE=$(grep "Environment=SEARXNG_DOCKERCOMPOSEFILE=" "$SERVICE_NAME" | awk -F\= '{ print $3 }')
. ./util.sh
if [ ! -x "$(which systemctl)" ]; then
@ -78,16 +78,16 @@ else
# remove dangling images
docker rmi $(docker images -f "dangling=true" -q)
# display searx version
SEARX_IMAGE=$(cat $DOCKERCOMPOSEFILE | grep "searx/searx" | grep -v "searx-checker" | awk '{ print $2 }')
SEARX_VERSION=$(docker inspect -f '{{index .Config.Labels "org.label-schema.version"}}' $SEARX_IMAGE)
echo "Searx version: $SEARX_VERSION"
docker images --digests "searx/*:latest"
# display SearxNG version
SEARXNG_IMAGE=$(cat $DOCKERCOMPOSEFILE | grep "searxng/searxng" | awk '{ print $2 }')
SEARXNG_VERSION=$(docker inspect -f '{{index .Config.Labels "org.label-schema.version"}}' $SEARXNG_IMAGE)
echo "SearXNG version: $SEARXNG_VERSION"
docker images --digests "searxng/*:latest"
# update searx configuration
# update SearxNG configuration
source ./.env
docker-compose -f $DOCKERCOMPOSEFILE run searx ${SEARX_COMMAND} -d
docker-compose -f $DOCKERCOMPOSEFILE run searxng ${SEARXNG_COMMAND} -d
# let the user see
echo "Use\nsystemctl start \"${SERVICE_NAME}\"\nto restart searx"
echo "Use\nsystemctl start \"${SERVICE_NAME}\"\nto restart SearXNG"
fi

Loading…
Cancel
Save