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

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

Simplify docker setup

parent 840124cc
Loading
Loading
Loading
Loading
+5 −9
Original line number Diff line number Diff line
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_HOSTNAME=spot.ecloud.global
SPOT_MORTY_HOSTNAME=proxy.spot.ecloud.global
SPOT_MORTY_URL=http://localhost:8089
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
SPOT_MORTY_DOCKER_IMG=registry.gitlab.e.foundation:5000/e/cloud/my-spot/morty
SPOT_MORTY_DOCKER_TAG=latest
SPOT_SECRET=":@)%NN0+OqNdy:{prWQlZ{p9|oO9p-UyJq@%V!~G:arrSx6fXz.{jd%=XF44ncj"
MORTY_KEY="taKB1WGTa63LEI6RdjWWKshS4oYSHQWGu9Eyjr1OlpQ="
+2 −12
Original line number Diff line number Diff line
@@ -36,10 +36,6 @@ 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
    - docker build -t $CI_REGISTRY_IMAGE/morty -f morty.Dockerfile .
    - docker push $CI_REGISTRY_IMAGE/morty

build:docker:master:
  extends: .build:docker
@@ -53,10 +49,6 @@ 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
    - 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:
    - tags

@@ -92,7 +84,6 @@ deploy:spot.test.cloud.global:
    SPOT_MORTY_HOSTNAME: proxy.spot.test.ecloud.global
    SPOT_MORTY_URL: https://proxy.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 --scale tor=5
@@ -112,9 +103,8 @@ deploy:spot.cloud.global:
    COMPOSE_PROJECT_NAME: my-spot
    SPOT_DOCKER_TAG: ${CI_COMMIT_REF_SLUG}
    SPOT_NGINX_DOCKER_TAG: ${CI_COMMIT_REF_SLUG}
    SPOT_FILTRON_DOCKER_TAG: ${CI_COMMIT_REF_SLUG}
    SPOT_MORTY_DOCKER_TAG: ${CI_COMMIT_REF_SLUG}
    SSH_PRIVATE_KEY: ${SSH_PRIVATE_KEY_PROD}
  script:
    - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
    - docker-compose up -d --build --scale tor=5
    - docker-compose pull
    - docker-compose up -d --scale tor=5
+4 −8
Original line number Diff line number Diff line
@@ -46,18 +46,14 @@ below to run spot for production or local environment.

### Like production

* Run the docker-compose up command to start the project 
```
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 tor
```
Run the docker-compose to start the project

* 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_filtron_1
docker-compose up -d
```

Then go to http://localhost:8088.

### For developer

You can directly run spot, with a python command inside a docker container which

docker-compose-build.yml

deleted100644 → 0
+0 −20
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

  morty:
    build:
      context: .
      dockerfile: morty.Dockerfile
+25 −13
Original line number Diff line number Diff line
@@ -12,19 +12,19 @@ services:
    image: redis:5.0.7-alpine
    logging: *default-logging
    restart: unless-stopped
    command:
      - "redis-server"
      - "--maxmemory 8G"
      - "--maxmemory-policy allkeys-lru"
    command: redis-server --maxmemory 8G --maxmemory-policy allkeys-lru

  spot:
    image: ${SPOT_DOCKER_IMG}:${SPOT_DOCKER_TAG}
    image: registry.gitlab.e.foundation:5000/e/cloud/my-spot:${SPOT_DOCKER_TAG}
    build:
      context: .
      dockerfile: Dockerfile
    logging: *default-logging
    restart: unless-stopped
    environment:
      SEARX_SECRET: ":@)%NN0+OqNdy:{prWQlZ{p9|oO9p-UyJq@%V!~G:arrSx6fXz.{jd%=XF44ncj"
      SEARX_SECRET: "${SPOT_SECRET}"
      SEARX_MORTY_URL: "${SPOT_MORTY_URL}"
      SEARX_MORTY_KEY: "${SEARX_MORTY_KEY:-KHN0ZGluKT0gNWNmNzQ0Y2JlNjI4MDRjODAwZGUyMGY5ZjZlZTFmZWI1NTg2YTg5OAo=}"
      SEARX_MORTY_KEY: "${MORTY_KEY}"
      SEARX_PROXY_HTTP: "socks5://tor:9050"
      SEARX_PROXY_HTTPS: "socks5://tor:9050"
      SEARX_REDIS_HOST: "redis"
@@ -32,29 +32,41 @@ services:
      GUNICORN_LEVEL: INFO

  nginx:
    image: ${SPOT_NGINX_DOCKER_IMG}:${SPOT_NGINX_DOCKER_TAG}
    image: registry.gitlab.e.foundation:5000/e/cloud/my-spot/nginx:${SPOT_NGINX_DOCKER_TAG}
    build:
      context: .
      dockerfile: nginx.Dockerfile
    logging: *default-logging
    restart: unless-stopped
    environment:
      SPOT_MORTY_URL: "${SPOT_MORTY_URL}"

  filtron:
    image: ${SPOT_FILTRON_DOCKER_IMG}:${SPOT_FILTRON_DOCKER_TAG}
    image: dalf/filtron:latest
    logging: *default-logging
    restart: unless-stopped
    command: -listen :3000 -rules /etc/filtron/rules.json -target nginx
    ports:
      - "8088:3000"
    volumes:
      - ./etc/filtron/rules.json:/etc/filtron/rules.json
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.spot.rule=Host(`${SPOT_HOSTNAME}`)"
      - "traefik.http.routers.filtron.rule=Host(`${SPOT_HOSTNAME}`)"

  morty:
    image: ${SPOT_MORTY_DOCKER_IMG}:${SPOT_MORTY_DOCKER_TAG}
    image: dalf/morty:latest
    logging: *default-logging
    restart: unless-stopped
    ports:
      - "8089:3000"
    environment:
      SEARX_MORTY_KEY: "${SEARX_MORTY_KEY:-KHN0ZGluKT0gNWNmNzQ0Y2JlNjI4MDRjODAwZGUyMGY5ZjZlZTFmZWI1NTg2YTg5OAo=}"
      DEBUG: "false"
      MORTY_ADDRESS: ":3000"
      MORTY_KEY: "${MORTY_KEY}"
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.spot_proxy.rule=Host(`${SPOT_MORTY_HOSTNAME}`)"
      - "traefik.http.routers.morty.rule=Host(`${SPOT_MORTY_HOSTNAME}`)"

  tor:
    image: osminogin/tor-simple
Loading