samjaninf
5/29/2019 - 9:18 PM

docker swarm erxes

version: "3"

volumes:
  redisdata: {}
  mongodata: {}
networks:
  front-external:
    driver: overlay
    external: true
    
services:
  erxes:
    image: erxes/erxes:docker-latest
    container_name: erxes
    environment:
      REACT_APP_CDN_HOST: https://erxes-widgets.app.pegascloud.com
      REACT_APP_API_URL: https://erxes-api.app.pegascloud.com
      REACT_APP_API_SUBSCRIPTION_URL: wss://erxes-api.app.pegascloud.com/subscriptions
      NGINX_HOST: erxes.app.pegascloud.com
    ports:
      - "80"
    networks:
      - default
      - front-external
    deploy:
      labels:
        - "traefik.enable=true"
        - "traefik.backend=erxes"
        - "traefik.frontend.rule=Host:erxes.app.pegascloud.com"
        - "traefik.port=80"
        - "traefik.protocol=http"
        - "traefik.docker.network=front-external"
        - "traefik.frontend.headers.customResponseHeaders=Access-Control-Allow-Origin: *"

  erxes-widgets-api:
    image: erxes/erxes-widgets-api:develop-latest
    container_name: erxes-widgets-api
    environment:
      NODE_ENV: production
      MAIN_API_URL: http://erxes-api:3300
      MONGO_URL: mongodb://mongo/erxes
    ports:
      - "3100"
    depends_on:
      - mongo
    networks:
      - default
      - front-external
    deploy:
      labels:
        - "traefik.enable=true"
        - "traefik.backend=erxes-widges-api"
        - "traefik.frontend.rule=Host:erxes-widgets-api.app.pegascloud.com"
        - "traefik.port=3100"
        - "traefik.protocol=http"
        - "traefik.docker.network=front-external"
        - "traefik.frontend.headers.customResponseHeaders=Access-Control-Allow-Origin: *"
        
  erxes-api:
    image: erxes/erxes-api:develop-latest
    container_name: erxes-api
    environment:
      REDIS_HOST: redis
      NODE_ENV: production
      MONGO_URL: mongodb://mongo/erxes
      MAIN_APP_DOMAIN: https://erxes.app.pegascloud.com
      DOMAIN: https://erxes-api.app.pegascloud.com
    ports:
      - "3300"
    depends_on:
      - mongo
      - redis
    networks:
      - default
      - front-external
    deploy:
      labels:
        - "traefik.enable=true"
        - "traefik.backend=erxes-api"
        - "traefik.frontend.rule=Host:erxes-api.app.pegascloud.com"
        - "traefik.port=3300"
        - "traefik.protocol=http"
        - "traefik.docker.network=front-external"

  erxes-widgets:
    image: erxes/erxes-widgets:develop-latest
    container_name: erxes-widgets
    environment:
      MAIN_API_URL: http://erxes-api:3300
      API_SUBSCRIPTIONS_URL: wss://erxes-api.app.pegascloud.com/subscriptions
      API_GRAPHQL_URL: https://erxes-widgets-api.app.pegascloud.com/graphql
    ports:
      - "3200"
    networks:
      - default
      - front-external
    deploy:
      labels:
        - "traefik.enable=true"
        - "traefik.backend=erxes-widgets"
        - "traefik.frontend.rule=Host:erxes-widgets.app.pegascloud.com"
        - "traefik.port=3200"
        - "traefik.protocol=http"
        - "traefik.docker.network=front-external"
        - "traefik.frontend.headers.customResponseHeaders=Access-Control-Allow-Origin: *"

  redis:
    image: redis:4-alpine
    container_name: redis
    ports:
      - "6379"
    networks:
      - default
    volumes:
      - redisdata:/data

  mongo:
    image: mongo:3.4
    container_name: mongo
    ports:
      - "27017"
    networks:
      - default
    volumes:
      - mongodata:/data/db