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

Commit 15c37643 authored by Nicolas Gelot's avatar Nicolas Gelot
Browse files

Introduce filtron to ban botnet

Ref: #44
parent ecddc080
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -3,3 +3,5 @@ SPOT_DOCKER_IMG=registry.gitlab.e.foundation:5000/e/cloud/my-spot
SPOT_DOCKER_TAG=latest
SPOT_NGINX_DOCKER_IMG=registry.gitlab.e.foundation:5000/e/cloud/my-spot/nginx
SPOT_NGINX_DOCKER_TAG=latest
SPOT_FILTRON_DOCKER_IMG=registry.gitlab.e.foundation:5000/e/cloud/my-spot/filtron
SPOT_FILTRON_DOCKER_TAG=latest
+5 −1
Original line number Diff line number Diff line
@@ -35,6 +35,8 @@ build:web:
    - docker push $CI_REGISTRY_IMAGE
    - docker build -t $CI_REGISTRY_IMAGE/nginx -f nginx.Dockerfile .
    - docker push $CI_REGISTRY_IMAGE/nginx
    - docker build -t $CI_REGISTRY_IMAGE/filtron -f filtron.Dockerfile .
    - docker push $CI_REGISTRY_IMAGE/filtron

build:docker:master:
  extends: .build:docker
@@ -48,6 +50,8 @@ build:docker:tags:
    - docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
    - 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 build -t $CI_REGISTRY_IMAGE/filtron:$CI_COMMIT_REF_SLUG -f filtron.Dockerfile .
    - docker push $CI_REGISTRY_IMAGE/filtron:$CI_COMMIT_REF_SLUG
  only:
    - tags

@@ -83,6 +87,7 @@ deploy:spot.test.cloud.global:
    DOCKER_HOST: ssh://root@spot.test.ecloud.global
    SPOT_HOSTNAME: spot.test.ecloud.global
    COMPOSE_PROJECT_NAME: my-spot
    COMPOSE_FILE: docker-compose.yml:docker-compose-build.yml
    SSH_PRIVATE_KEY: ${SSH_PRIVATE_KEY_TEST}
  script:
    - docker-compose up -d --build
@@ -98,7 +103,6 @@ deploy:spot.cloud.global:
    DOCKER_HOST: ssh://root@spot.ecloud.global
    SPOT_HOSTNAME: spot.ecloud.global
    COMPOSE_PROJECT_NAME: my-spot
    COMPOSE_FILE: docker-compose.yml:docker-compose-prod.yml
    SPOT_DOCKER_TAG: ${CI_COMMIT_REF_SLUG}
    SPOT_NGINX_DOCKER_TAG: ${CI_COMMIT_REF_SLUG}
    SSH_PRIVATE_KEY: ${SSH_PRIVATE_KEY_PROD}
+5 −5
Original line number Diff line number Diff line
@@ -20,17 +20,17 @@ below to run spot for production or local environment.

### Like production

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

* 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 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 nginx service and go to `http://<nginx-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
+15 −0
Original line number Diff line number Diff line
version: '3.6'

services:
  spot:
    build: .

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

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

docker-compose-prod.yml

deleted100644 → 0
+0 −9
Original line number Diff line number Diff line
version: '3.6'

services:
  spot:
    image: ${SPOT_DOCKER_IMG}:${SPOT_DOCKER_TAG}

  nginx:
    image: ${SPOT_NGINX_DOCKER_IMG}:${SPOT_NGINX_DOCKER_TAG}
Loading