Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e16bf4cf authored by Nicolas Gelot's avatar Nicolas Gelot
Browse files

Merge branch 'dev' into 'master'

Full CSP support and filter bot with filtron service

Closes #44

See merge request e/cloud/my-spot!57
parents ecddc080 4e9940a3
Loading
Loading
Loading
Loading

.dockerignore

deleted100644 → 0
+0 −37
Original line number Original line Diff line number Diff line
*~
*/*~
*/*/*~
*/*/*/*~
*/*/*/*/*~

# CI
.codeclimate.yml
.travis.yml
.taskcluster.yml

# Byte-compiled / optimized / DLL files
__pycache__/
*/__pycache__/
*/*/__pycache__/
*/*/*/__pycache__/
*.py[cod]
*/*.py[cod]
*/*/*.py[cod]
*/*/*/*.py[cod]

# to sync with .gitignore
.coverage
coverage/
.installed.cfg
engines.cfg
env
searx-ve
robot_log.html
robot_output.xml
robot_report.html
test_basic/
setup.cfg

node_modules/

.tx/
 No newline at end of file
+6 −0
Original line number Original line Diff line number Diff line
SPOT_HOSTNAME=localhost
SPOT_HOSTNAME=localhost
SPOT_MORTY_HOSTNAME=proxy.localhost
SPOT_MORTY_URL=http://morty.docker
SPOT_DOCKER_IMG=registry.gitlab.e.foundation:5000/e/cloud/my-spot
SPOT_DOCKER_IMG=registry.gitlab.e.foundation:5000/e/cloud/my-spot
SPOT_DOCKER_TAG=latest
SPOT_DOCKER_TAG=latest
SPOT_NGINX_DOCKER_IMG=registry.gitlab.e.foundation:5000/e/cloud/my-spot/nginx
SPOT_NGINX_DOCKER_IMG=registry.gitlab.e.foundation:5000/e/cloud/my-spot/nginx
SPOT_NGINX_DOCKER_TAG=latest
SPOT_NGINX_DOCKER_TAG=latest
SPOT_FILTRON_DOCKER_IMG=registry.gitlab.e.foundation:5000/e/cloud/my-spot/filtron
SPOT_FILTRON_DOCKER_TAG=latest
SPOT_MORTY_DOCKER_IMG=registry.gitlab.e.foundation:5000/e/cloud/my-spot/morty
SPOT_MORTY_DOCKER_TAG=latest
+14 −1
Original line number Original line Diff line number Diff line
@@ -35,6 +35,11 @@ build:web:
    - docker push $CI_REGISTRY_IMAGE
    - docker push $CI_REGISTRY_IMAGE
    - docker build -t $CI_REGISTRY_IMAGE/nginx -f nginx.Dockerfile .
    - docker build -t $CI_REGISTRY_IMAGE/nginx -f nginx.Dockerfile .
    - docker push $CI_REGISTRY_IMAGE/nginx
    - docker push $CI_REGISTRY_IMAGE/nginx
    - docker build -t $CI_REGISTRY_IMAGE/filtron -f filtron.Dockerfile .
    - docker push $CI_REGISTRY_IMAGE/filtron
    - docker build -t $CI_REGISTRY_IMAGE/morty -f morty.Dockerfile .
    - docker push $CI_REGISTRY_IMAGE/morty



build:docker:master:
build:docker:master:
  extends: .build:docker
  extends: .build:docker
@@ -48,6 +53,10 @@ build:docker:tags:
    - docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
    - docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
    - docker build -t $CI_REGISTRY_IMAGE/nginx:$CI_COMMIT_REF_SLUG -f nginx.Dockerfile .
    - docker build -t $CI_REGISTRY_IMAGE/nginx:$CI_COMMIT_REF_SLUG -f nginx.Dockerfile .
    - docker push $CI_REGISTRY_IMAGE/nginx:$CI_COMMIT_REF_SLUG
    - docker push $CI_REGISTRY_IMAGE/nginx:$CI_COMMIT_REF_SLUG
    - docker build -t $CI_REGISTRY_IMAGE/filtron:$CI_COMMIT_REF_SLUG -f filtron.Dockerfile .
    - docker push $CI_REGISTRY_IMAGE/filtron:$CI_COMMIT_REF_SLUG
    - docker build -t $CI_REGISTRY_IMAGE/morty:$CI_COMMIT_REF_SLUG -f morty.Dockerfile .
    - docker push $CI_REGISTRY_IMAGE/morty:$CI_COMMIT_REF_SLUG
  only:
  only:
    - tags
    - tags


@@ -82,7 +91,10 @@ deploy:spot.test.cloud.global:
  variables:
  variables:
    DOCKER_HOST: ssh://root@spot.test.ecloud.global
    DOCKER_HOST: ssh://root@spot.test.ecloud.global
    SPOT_HOSTNAME: spot.test.ecloud.global
    SPOT_HOSTNAME: spot.test.ecloud.global
    SPOT_MORTY_HOSTNAME: proxy.spot.test.ecloud.global
    SPOT_MORTY_URL: https://proxy.spot.test.ecloud.global
    COMPOSE_PROJECT_NAME: my-spot
    COMPOSE_PROJECT_NAME: my-spot
    COMPOSE_FILE: docker-compose.yml:docker-compose-build.yml
    SSH_PRIVATE_KEY: ${SSH_PRIVATE_KEY_TEST}
    SSH_PRIVATE_KEY: ${SSH_PRIVATE_KEY_TEST}
  script:
  script:
    - docker-compose up -d --build
    - docker-compose up -d --build
@@ -97,8 +109,9 @@ deploy:spot.cloud.global:
  variables:
  variables:
    DOCKER_HOST: ssh://root@spot.ecloud.global
    DOCKER_HOST: ssh://root@spot.ecloud.global
    SPOT_HOSTNAME: spot.ecloud.global
    SPOT_HOSTNAME: spot.ecloud.global
    SPOT_MORTY_HOSTNAME: proxy.spot.ecloud.global
    SPOT_MORTY_URL: https://proxy.spot.ecloud.global
    COMPOSE_PROJECT_NAME: my-spot
    COMPOSE_PROJECT_NAME: my-spot
    COMPOSE_FILE: docker-compose.yml:docker-compose-prod.yml
    SPOT_DOCKER_TAG: ${CI_COMMIT_REF_SLUG}
    SPOT_DOCKER_TAG: ${CI_COMMIT_REF_SLUG}
    SPOT_NGINX_DOCKER_TAG: ${CI_COMMIT_REF_SLUG}
    SPOT_NGINX_DOCKER_TAG: ${CI_COMMIT_REF_SLUG}
    SSH_PRIVATE_KEY: ${SSH_PRIVATE_KEY_PROD}
    SSH_PRIVATE_KEY: ${SSH_PRIVATE_KEY_PROD}
+27 −7
Original line number Original line Diff line number Diff line
@@ -12,6 +12,27 @@ Spot was forked from searx: read [documentation](https://asciimoo.github.io/sear
* docker packaging thinking to be production ready
* docker packaging thinking to be production ready
* better locale support
* better locale support


## Architecture

5 services are used for production:

* [traefik](https://docs.traefik.io/) as edge router to publish services.
* [filtron](https://github.com/asciimoo/filtron) as reverse HTTP proxy to filter requests by different rules.
* [morty](https://github.com/asciimoo/morty) as proxy to serve thumbnails.
* [nginx](https://www.nginx.com/) as http server to serve static files.
* Spot the meta search engine.


```mermaid
graph TD
  A(traefik) --> |https://spot.ecloud.global| B(filtron)
  A(traefik) --> |https://proxy.spot.ecloud.global| C(morty)
  C --> |image link| C
  B --> D(nginx)
  D --> |static file| D
  D --> |API| E(spot)
```

## Getting Started
## Getting Started


You can run spot with docker-compose. First of all you have to install
You can run spot with docker-compose. First of all you have to install
@@ -20,17 +41,16 @@ below to run spot for production or local environment.


### Like production
### Like production


3 containes are used for production, traefik as edge router,
nginx to server static files and spot as backend.

* Run the docker-compose up command to start the project 
* Run the docker-compose up command to start the project 
```
```
docker-compose up --build spot nginx
COMPOSE_FILE=docker-compose.yml:docker-compose-build.yml docker-compose up --build morty
SPOT_MORTY_URL=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' my-spot_morty_1)
COMPOSE_FILE=docker-compose.yml:docker-compose-build.yml docker-compose up --build spot nginx filtron
```
```


* Getting the ip of the nginx service and go to `http://<nginx-ip>`, below the docker way to get the IP of the nginx container
* Getting the ip of the filtron service and go to `http://<ip>`, below the docker way to get the IP of the filtron container
```
```
docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' my-spot_nginx_1
docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' my-spot_filtron_1
```
```


### For developer
### For developer
@@ -43,4 +63,4 @@ docker run -it --rm -v $(pwd):/ws -w /ws registry.gitlab.e.foundation:5000/e/clo
SEARX_DEBUG=1 python -X dev searx/webapp.py
SEARX_DEBUG=1 python -X dev searx/webapp.py
```
```


Then go open your browser and navigate to the container IP.
Then, open your browser and navigate to the container IP.
+20 −0
Original line number Original line Diff line number Diff line
version: '3.6'

services:
  spot:
    build: .

  nginx:
    build:
      context: .
      dockerfile: nginx.Dockerfile

  filtron:
    build:
      context: .
      dockerfile: filtron.Dockerfile

  morty:
    build:
      context: .
      dockerfile: morty.Dockerfile
Loading