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 # By default listen on https://localhost
# To change this: # 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) # * 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> # LETSENCRYPT_EMAIL=<email>
# automatically update settings to the new version # automatically update settings to the new version
# comment this line if you made / will make some modifications to the settings # comment this line if you made / will make some modifications to the settings
SEARX_COMMAND=-f SEARXNG_COMMAND=-f
# use openssl rand -base64 33 # use openssl rand -base64 33
MORTY_KEY=ReplaceWithARealKey! MORTY_KEY=ReplaceWithARealKey!

2
.gitignore vendored

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

@ -2,12 +2,12 @@
admin off admin off
} }
{$SEARX_HOSTNAME} { {$SEARXNG_HOSTNAME} {
log { log {
output discard output discard
} }
tls {$SEARX_TLS} tls {$SEARXNG_TLS}
@api { @api {
path /config 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 ? ## What is included ?
| Name | Description | Docker image | Dockerfile | | 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) | | [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) | | [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) |
| [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) | | [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/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) | | [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 ## How to use it
- [Install docker](https://docs.docker.com/install/) - [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). - [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``` - only on MacOSX: ```brew install coreutils``` to install ```greadlink```
- Get searx-docker - Get searxng-docker
```sh ```sh
cd /usr/local cd /usr/local
git clone https://github.com/searx/searx-docker.git git clone https://github.com/searxng/searxng-docker.git
cd searx-docker cd searxng-docker
``` ```
- Generate MORTY_KEY ```sed -i "s|ReplaceWithARealKey\!|$(openssl rand -base64 33)|g" .env``` - 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```, - Check everything is working: ```./start.sh```,
- ```cp searx-docker.service.template searx-docker.service``` - ```cp searxng-docker.service.template searxng-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) - 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 : - Install the systemd unit :
```sh ```sh
systemctl enable $(pwd)/searx-docker.service systemctl enable $(pwd)/searxng-docker.service
systemctl start searx-docker.service systemctl start searxng-docker.service
``` ```
## Note on the image proxy feature ## 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 ## Custom docker-compose.yaml
Do not modify docker-compose.yaml otherwise you won't be able to update easily from the git repository. 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 : 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``` - create a new docker-compose-extend.yaml, check with ```start.sh```
- update searx-docker.service (see SEARX_DOCKERCOMPOSEFILE) - update searxng-docker.service (see SEARXNG_DOCKERCOMPOSEFILE)
- restart the servie : ```systemctl restart searx-docker.service``` - restart the servie : ```systemctl restart searxng-docker.service```
## Multi Architecture Docker images ## Multi Architecture Docker images
@ -56,11 +56,11 @@ For now only the amd64 platform is supported.
## How to update ? ## 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 ## 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: For example, to display the loaded rules:
``` ```

@ -12,8 +12,8 @@ services:
- caddy-data:/data:rw - caddy-data:/data:rw
- caddy-config:/config:rw - caddy-config:/config:rw
environment: environment:
- SEARX_HOSTNAME=${SEARX_HOSTNAME:-localhost} - SEARXNG_HOSTNAME=${SEARXNG_HOSTNAME:-localhost}
- SEARX_TLS=${LETSENCRYPT_EMAIL:-internal} - SEARXNG_TLS=${LETSENCRYPT_EMAIL:-internal}
cap_drop: cap_drop:
- ALL - ALL
cap_add: cap_add:
@ -28,27 +28,27 @@ services:
- "127.0.0.1:4040:4040" - "127.0.0.1:4040:4040"
- "127.0.0.1:4041:4041" - "127.0.0.1:4041:4041"
networks: networks:
- searx - searxng
command: -listen 0.0.0.0:4040 -api 0.0.0.0:4041 -target searx:8080 command: -listen 0.0.0.0:4040 -api 0.0.0.0:4041 -target searxng:8080
volumes: volumes:
- ./rules.json:/etc/filtron/rules.json:rw - ./rules.json:/etc/filtron/rules.json:rw
read_only: true read_only: true
cap_drop: cap_drop:
- ALL - ALL
searx: searxng:
container_name: searx container_name: searxng
image: searx/searx:latest image: searxng/searxng:latest
restart: always restart: always
networks: networks:
- searx - searxng
command: ${SEARX_COMMAND:-} command: ${SEARXNG_COMMAND:-}
volumes: volumes:
- ./searx:/etc/searx:rw - ./searx:/etc/searx:rw
environment: environment:
- BIND_ADDRESS=0.0.0.0:8080 - BIND_ADDRESS=0.0.0.0:8080
- BASE_URL=https://${SEARX_HOSTNAME:-localhost}/ - BASE_URL=https://${SEARXNG_HOSTNAME:-localhost}/
- MORTY_URL=https://${SEARX_HOSTNAME:-localhost}/morty/ - MORTY_URL=https://${SEARXNG_HOSTNAME:-localhost}/morty/
- MORTY_KEY=${MORTY_KEY} - MORTY_KEY=${MORTY_KEY}
cap_drop: cap_drop:
- ALL - ALL
@ -65,7 +65,7 @@ services:
ports: ports:
- "127.0.0.1:3000:3000" - "127.0.0.1:3000:3000"
networks: networks:
- searx - searxng
command: -timeout 6 -ipv6 command: -timeout 6 -ipv6
environment: environment:
- MORTY_KEY=${MORTY_KEY} - MORTY_KEY=${MORTY_KEY}
@ -77,7 +77,7 @@ services:
- ALL - ALL
networks: networks:
searx: searxng:
ipam: ipam:
driver: default 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 # change if require
SERVICE_NAME="searx-docker.service" SERVICE_NAME="searxng-docker.service"
# change if require : # change if require :
# fastforward : only fast-forward # fastforward : only fast-forward
@ -46,7 +46,7 @@ if [ "$current_commit" = "$origin_master_commit" ]; then
fi fi
# docker stuff # 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 . ./util.sh
if [ ! -x "$(which systemctl)" ]; then if [ ! -x "$(which systemctl)" ]; then
@ -78,16 +78,16 @@ else
# remove dangling images # remove dangling images
docker rmi $(docker images -f "dangling=true" -q) docker rmi $(docker images -f "dangling=true" -q)
# display searx version # display SearxNG version
SEARX_IMAGE=$(cat $DOCKERCOMPOSEFILE | grep "searx/searx" | grep -v "searx-checker" | awk '{ print $2 }') SEARXNG_IMAGE=$(cat $DOCKERCOMPOSEFILE | grep "searxng/searxng" | awk '{ print $2 }')
SEARX_VERSION=$(docker inspect -f '{{index .Config.Labels "org.label-schema.version"}}' $SEARX_IMAGE) SEARXNG_VERSION=$(docker inspect -f '{{index .Config.Labels "org.label-schema.version"}}' $SEARXNG_IMAGE)
echo "Searx version: $SEARX_VERSION" echo "SearXNG version: $SEARXNG_VERSION"
docker images --digests "searx/*:latest" docker images --digests "searxng/*:latest"
# update searx configuration # update SearxNG configuration
source ./.env source ./.env
docker-compose -f $DOCKERCOMPOSEFILE run searx ${SEARX_COMMAND} -d docker-compose -f $DOCKERCOMPOSEFILE run searxng ${SEARXNG_COMMAND} -d
# let the user see # let the user see
echo "Use\nsystemctl start \"${SERVICE_NAME}\"\nto restart searx" echo "Use\nsystemctl start \"${SERVICE_NAME}\"\nto restart SearXNG"
fi fi

Loading…
Cancel
Save