docker-compose.yml 1.7 KB
Newer Older
wafwerar's avatar
wafwerar 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
version: "3"

networks:
  inter:
  api:

services:
  arbitrator:
    image: tdengine/tdengine:$VERSION
    command: tarbitrator
    networks:
      - inter
  td-1:
    image: tdengine/tdengine:$VERSION
    networks:
      - inter
    environment:
      TAOS_FQDN: "td-1"
      TAOS_FIRST_EP: "td-1"
      TAOS_NUM_OF_MNODES: "2"
      TAOS_REPLICA: "2"
      TAOS_ARBITRATOR: arbitrator:6042
    volumes:
      - taosdata-td1:/var/lib/taos/
      - taoslog-td1:/var/log/taos/
  td-2:
    image: tdengine/tdengine:$VERSION
    networks:
      - inter
    environment:
      TAOS_FQDN: "td-2"
      TAOS_FIRST_EP: "td-1"
      TAOS_NUM_OF_MNODES: "2"
      TAOS_REPLICA: "2"
      TAOS_ARBITRATOR: arbitrator:6042
    volumes:
      - taosdata-td2:/var/lib/taos/
      - taoslog-td2:/var/log/taos/
  adapter:
    image: tdengine/tdengine:$VERSION
    command: taosadapter
    networks:
      - inter
    environment:
      TAOS_FIRST_EP: "td-1"
      TOAS_SECOND_EP: "td-2"
    deploy:
      replicas: 4
      update_config:
        parallelism: 4
  nginx:
    image: nginx
    depends_on:
      - adapter
    networks:
      - inter
      - api
    ports:
      - 6041:6041
      - 6044:6044/udp
    command: [
        "sh",
        "-c",
        "while true;
        do curl -s http://adapter:6041/-/ping >/dev/null && break;
        done;
        printf 'server{listen 6041;location /{proxy_pass http://adapter:6041;}}'
        > /etc/nginx/conf.d/rest.conf;
        printf 'stream{server{listen 6044 udp;proxy_pass adapter:6044;}}'
        >> /etc/nginx/nginx.conf;cat /etc/nginx/nginx.conf;
        nginx -g 'daemon off;'",
      ]
volumes:
  taosdata-td1:
  taoslog-td1:
  taosdata-td2:
  taoslog-td2: