version: '3.6' services: #https://github.com/jakubhajek/elasticsearch-docker-swarm/blob/master/stack-elastic.yml # elasticsearch coordinating node # /etc/security/limits.conf # * hard memlock unlimited # * soft memlock unlimited # * hard nofile 65536 # * soft nofile 65536 # * hard nproc 65536 # * soft nproc 65536 # sysctl -w vm.max_map_count=262144 # /etc/sysctl.conf # vm.max_map_count=262144 # /lib/systemd/system/docker.service # LimitMEMLOCK=infinity #apt update #apt install apt-transport-https ca-certificates curl software-properties-common #curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - #add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable" #apt update #apt-cache policy docker-ce #apt install docker-ce=18.06.3~ce~3-0~ubuntu #apt-get install nfs-common #docker swarm join-token worker #docker swarm join --token SWMTKN-1-1fd9zytidyai9bfelii0vt5nee6l43ibedvwjztbgncxfil2oi-0ungbwdty6jaihk5g7usk5pv9 192.168.25.46:2377 # elasticsearch master node es-master-01: image: docker.elastic.co/elasticsearch/elasticsearch:${ELKVERSION:-7.9.2} hostname: es-master-01 volumes: #- es-master-01-data:/usr/share/elasticsearch/data - type: volume source: es-master-01-data target: /usr/share/elasticsearch/data volume: nocopy: true - /etc/timezone:/etc/timezone:ro - /etc/localtime:/etc/localtime:ro environment: &es-master-env cluster.name: es-swarm-cluster node.name: "es-master-01" discovery.seed_hosts: "es-master-01,es-master-02,es-master-03" cluster.initial_master_nodes: "es-master-01,es-master-02,es-master-03" node.master: "true" node.voting_only: "false" node.data: "true" node.ingest: "false" node.ml: "false" xpack.ml.enabled: "true" cluster.remote.connect: "false" MAX_LOCKED_MEMORY: unlimited bootstrap.memory_lock: "true" ES_JAVA_OPTS: "-Xms2g -Xmx2g" configs: &es-limits-conf - source: es-limits.conf target: /etc/security/limits.conf networks: &efk-network - efk deploy: &efk-deploy endpoint_mode: dnsrr mode: replicated replicas: 1 placement: constraints: - node.role != manager logging: &default-logging driver: "json-file" options: max-file: "5" max-size: "100m" # elasticsearch master node es-master-02: image: docker.elastic.co/elasticsearch/elasticsearch:${ELKVERSION:-7.9.2} hostname: es-master-02 volumes: #- es-master-02-data:/usr/share/elasticsearch/data - type: volume source: es-master-02-data target: /usr/share/elasticsearch/data volume: nocopy: true - /etc/timezone:/etc/timezone:ro - /etc/localtime:/etc/localtime:ro environment: cluster.name: es-swarm-cluster node.name: "es-master-02" discovery.seed_hosts: "es-master-01,es-master-02,es-master-03" cluster.initial_master_nodes: "es-master-01,es-master-02,es-master-03" node.master: "true" node.voting_only: "false" node.data: "true" node.ingest: "false" node.ml: "false" xpack.ml.enabled: "true" cluster.remote.connect: "false" MAX_LOCKED_MEMORY: unlimited bootstrap.memory_lock: "true" ES_JAVA_OPTS: "-Xms2g -Xmx2g" configs: *es-limits-conf networks: *efk-network deploy: *efk-deploy logging: *default-logging es-master-03: image: docker.elastic.co/elasticsearch/elasticsearch:${ELKVERSION:-7.9.2} hostname: es-master-03 volumes: #- es-master-03-data:/usr/share/elasticsearch/data - type: volume source: es-master-03-data target: /usr/share/elasticsearch/data volume: nocopy: true - /etc/timezone:/etc/timezone:ro - /etc/localtime:/etc/localtime:ro environment: &es-master-env cluster.name: es-swarm-cluster node.name: "es-master-03" discovery.seed_hosts: "es-master-01,es-master-02,es-master-03" cluster.initial_master_nodes: "es-master-01,es-master-02,es-master-03" node.master: "true" node.voting_only: "false" node.data: "true" node.ingest: "false" node.ml: "false" xpack.ml.enabled: "true" cluster.remote.connect: "false" MAX_LOCKED_MEMORY: unlimited bootstrap.memory_lock: "true" ES_JAVA_OPTS: "-Xms2g -Xmx2g" configs: *es-limits-conf networks: *efk-network deploy: *efk-deploy logging: *default-logging es-coordinating: image: docker.elastic.co/elasticsearch/elasticsearch:${ELKVERSION:-7.9.2} hostname: es-coordinating ports: - 9200:9200 volumes: - /etc/timezone:/etc/timezone:ro - /etc/localtime:/etc/localtime:ro environment: ES_JAVA_OPTS: "-Xms4g -Xmx4g" cluster.name: es-swarm-cluster discovery.seed_hosts: "es-master-01,es-master-02,es-master-03" node.name: "es-coordinating" node.master: "false" node.voting_only: "false" node.data: "false" node.ingest: "false" node.ml: "false" cluster.remote.connect: "false" MAX_LOCKED_MEMORY: unlimited bootstrap.memory_lock: "true" xpack.monitoring.collection.enabled: "false" depends_on: - es-master-01 - es-master-02 - es-master-03 configs: *es-limits-conf networks: *efk-network deploy: &default-deploy mode: replicated replicas: 1 placement: constraints: [node.role!=manager] logging: *default-logging elastichq: image: elastichq/elasticsearch-hq environment: - HQ_DEFAULT_URL=http://es-coordinating:9200 - HQ_DEBUG=True - HQ_ENABLE_SSL=False - HQ_VERIFY_CERTS=False ports: - 5050:5000 networks: *efk-network deploy: *default-deploy logging: *default-logging kibana: image: docker.elastic.co/kibana/kibana:${ELKVERSION:-7.9.2} hostname: kibana ports: - 5601:5601 volumes: - /etc/timezone:/etc/timezone:ro - /etc/localtime:/etc/localtime:ro environment: - "ELASTICSEARCH_URL=http://es-coordinating:9200" - "ELASTICSEARCH_HOSTS=http://es-coordinating:9200" depends_on: - es-coordinating networks: *efk-network deploy: *default-deploy logging: *default-logging logstash: image: docker.elastic.co/logstash/logstash:${ELKVERSION:-7.9.2} ports: - "5000:5000" - "9600:9600" - "5044:5044" configs: - source: logstash_config target: /usr/share/logstash/config/logstash.yml - source: logstash_pipeline target: /usr/share/logstash/pipeline/logstash.conf environment: - "LS_JAVA_OPTS=-Xmx2g -Xms2g" depends_on: - kibana networks: *efk-network deploy: *default-deploy logging: *default-logging #https://gist.github.com/dkurzaj/2a899de8cb5ae698919f0a9bbf7685f0 zookeeper1: image: wurstmeister/zookeeper:3.4.6 ports: - "2181:2181" environment: - ZOO_SERVER_ID=1 - ALLOW_ANONYMOUS_LOGIN=yes - ZOO_SERVERS=zookeeper1:2888:3888,zookeeper2:2888:3888,zookeeper3:2888:3888 deploy: *default-deploy networks: *efk-network logging: *default-logging zookeeper2: image: wurstmeister/zookeeper:3.4.6 ports: - "2182:2181" environment: - ZOO_SERVER_ID=2 - ALLOW_ANONYMOUS_LOGIN=yes - ZOO_SERVERS=zookeeper1:2888:3888,zookeeper2:2888:3888,zookeeper3:2888:3888 deploy: *default-deploy networks: *efk-network logging: *default-logging zookeeper3: image: wurstmeister/zookeeper:3.4.6 ports: - "2183:2181" environment: - ZOO_SERVER_ID=3 - ALLOW_ANONYMOUS_LOGIN=yes - ZOO_SERVERS=zookeeper1:2888:3888,zookeeper2:2888:3888,zookeeper3:2888:3888 deploy: *default-deploy networks: *efk-network logging: *default-logging kafka1: image: wurstmeister/kafka:2.12-2.3.0 ports: - "9095:9092" volumes: - kafka1-data:/kafka - /var/run/docker.sock:/var/run/docker.sock environment: KAFKA_BROKER_ID: 1 KAFKA_ZOOKEEPER_CONNECT: zookeeper1:2181,zookeeper2:2182,zookeeper3:2183 JMX_PORT: 9093 KAFKA_JMX_OPTS: -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=kafka1 -Dcom.sun.management.jmxremote.rmi.port=9093 KAFKA_ADVERTISED_HOST_NAME: kafka1 KAFKA_ADVERTISED_PORT: 9092 KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka1:9092 KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 2 depends_on: - zookeeper1 - zookeeper2 - zookeeper3 deploy: *default-deploy networks: *efk-network logging: *default-logging kafka2: image: wurstmeister/kafka:2.12-2.3.0 ports: - "9096:9092" volumes: - kafka2-data:/kafka - /var/run/docker.sock:/var/run/docker.sock environment: KAFKA_BROKER_ID: 2 KAFKA_ZOOKEEPER_CONNECT: zookeeper1:2181,zookeeper2:2182,zookeeper3:2183 JMX_PORT: 9093 KAFKA_JMX_OPTS: -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=kafka2 -Dcom.sun.management.jmxremote.rmi.port=9093 KAFKA_ADVERTISED_HOST_NAME: kafka2 KAFKA_ADVERTISED_PORT: 9092 KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka2:9092 KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 2 depends_on: - zookeeper1 - zookeeper2 - zookeeper3 deploy: *default-deploy networks: *efk-network logging: *default-logging kafka3: image: wurstmeister/kafka:2.12-2.3.0 ports: - "9097:9092" volumes: - kafka3-data:/kafka - /var/run/docker.sock:/var/run/docker.sock environment: KAFKA_BROKER_ID: 3 KAFKA_ZOOKEEPER_CONNECT: zookeeper1:2181,zookeeper2:2182,zookeeper3:2183 JMX_PORT: 9093 KAFKA_JMX_OPTS: -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=kafka3 -Dcom.sun.management.jmxremote.rmi.port=9093 KAFKA_ADVERTISED_HOST_NAME: kafka3 KAFKA_ADVERTISED_PORT: 9092 KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka3:9092 KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 2 depends_on: - zookeeper1 - zookeeper2 - zookeeper3 deploy: *default-deploy networks: *efk-network logging: *default-logging # https://github.com/hleb-albau/kafka-manager-docker kafka-manager: image: hlebalbau/kafka-manager:2.0.0.2 depends_on: - kafka1 - kafka2 - kafka3 environment: ZK_HOSTS: zookeeper1:2181,zookeeper2:2182,zookeeper3:2183 APPLICATION_SECRET: "random-secret" KM_ARGS: -Djava.net.preferIPv4Stack=true ports: - "8282:9000" deploy: *default-deploy networks: *efk-network logging: *default-logging apm-server: image: docker.elastic.co/apm/apm-server:${ELKVERSION:-7.9.2} ports: - "8200:8200" depends_on: - kafka-manager configs: - source: apmserver.conf target: /usr/share/apm-server/apm-server.yml deploy: *default-deploy networks: *efk-network logging: *default-logging influxdb: image: influxdb:1.7.10 ports: - 18086:8086 - 18083:8083 - 18089:8089/udp configs: - source: influxdb.conf target: /etc/influxdb/influxdb.conf volumes: - influxdb-data:/var/lib/influxdb deploy: *default-deploy networks: *efk-network logging: *default-logging chronograf: image: chronograf:1.7.17 ports: - 8888:8888 volumes: - chronograf:/var/lib/chronograf depends_on: - influxdb environment: INFLUXDB_URL: http://influxdb:8086 deploy: *default-deploy networks: *efk-network logging: *default-logging grafana: image: grafana/grafana:6.7.4 user: "$UID:$GID" ports: - 3000:3000 environment: - GF_AUTH_ANONYMOUS_ENABLED=true - GF_SECURITY_ALLOW_EMBEDDING=true depends_on: - chronograf volumes: - grafanavar:/var/lib/grafana - grafanaetc:/etc/grafana deploy: *default-deploy networks: *efk-network logging: *default-logging scouter: image : scouterapm/scouter-server:2.7.0 environment: - SC_SERVER_ID=SCCOUTER-COLLECTOR - NET_HTTP_SERVER_ENABLED=true - NET_HTTP_API_SWAGGER_ENABLED=true - NET_HTTP_API_ENABLED=true - MGR_PURGE_PROFILE_KEEP_DAYS=2 - MGR_PURGE_XLOG_KEEP_DAYS=5 - MGR_PURGE_COUNTER_KEEP_DAYS=15 - JAVA_OPT=-Xms1024m -Xmx1024m volumes: - sc-logs:/home/scouter-server/logs - sc-data:/home/scouter-server/database - sc-libs:/home/scouter-server/lib - sc-conf:/home/scouter-server/conf - sc-extweb:/home/scouter-server/extweb depends_on: - influxdb ports: - 6180:6180 - 6100:6100 - 6100:6100/udp deploy: *default-deploy networks: *efk-network logging: *default-logging www313cokr: image: 313devgrp/jstree-service-framework-backend-app:21.04.03 ports: - "31313:8080" depends_on: - scouter extra_hosts: - "313.co.kr:192.168.25.42" - "db.313.co.kr:192.168.25.40" - "nas.313.co.kr:192.168.25.42" - "www.313.co.kr:192.168.25.42" - "ubuntu.313.co.kr:192.168.25.46" deploy: *default-deploy networks: *efk-network logging: *default-logging configs: apmserver.conf: file: ./allinone/apm-server.yml influxdb.conf: file: ./allinone/influxdb.conf es-limits.conf: file: ./allinone/es-limits.conf logstash_config: file: ./allinone/logstash.yml logstash_pipeline: file: ./allinone/logstash.conf volumes: kafka3-data: driver: local driver_opts: type: "nfs" o: "addr=${NFSSERVER:-1.2.3.4},nolock,soft,rw,sync" device: ":${NFSPATH:-/nfspath}/allinone/kafka3" kafka2-data: driver: local driver_opts: type: "nfs" o: "addr=${NFSSERVER:-1.2.3.4},nolock,soft,rw,sync" device: ":${NFSPATH:-/nfspath}/allinone/kafka2" kafka1-data: driver: local driver_opts: type: "nfs" o: "addr=${NFSSERVER:-1.2.3.4},nolock,soft,rw,sync" device: ":${NFSPATH:-/nfspath}/allinone/kafka1" chronograf: driver: local driver_opts: type: "nfs" o: "addr=${NFSSERVER:-1.2.3.4},nolock,soft,rw,sync" device: ":${NFSPATH:-/nfspath}/allinone/chronograf" grafanavar: driver: local driver_opts: type: "nfs" o: "addr=${NFSSERVER:-1.2.3.4},nolock,soft,rw,sync" device: ":${NFSPATH:-/nfspath}/allinone/grafana/var" grafanaetc: driver: local driver_opts: type: "nfs" o: "addr=${NFSSERVER:-1.2.3.4},nolock,soft,rw,sync" device: ":${NFSPATH:-/nfspath}/allinone/grafana/etc" sc-extweb: driver: local driver_opts: type: "nfs" o: "addr=${NFSSERVER:-1.2.3.4},nolock,soft,rw,sync" device: ":${NFSPATH:-/nfspath}/allinone/scouter/extweb" sc-conf: driver: local driver_opts: type: "nfs" o: "addr=${NFSSERVER:-1.2.3.4},nolock,soft,rw,sync" device: ":${NFSPATH:-/nfspath}/allinone/scouter/conf" sc-libs: driver: local driver_opts: type: "nfs" o: "addr=${NFSSERVER:-1.2.3.4},nolock,soft,rw,sync" device: ":${NFSPATH:-/nfspath}/allinone/scouter/libs" sc-data: driver: local driver_opts: type: "nfs" o: "addr=${NFSSERVER:-1.2.3.4},nolock,soft,rw,sync" device: ":${NFSPATH:-/nfspath}/allinone/scouter/data" sc-logs: driver: local driver_opts: type: "nfs" o: "addr=${NFSSERVER:-1.2.3.4},nolock,soft,rw,sync" device: ":${NFSPATH:-/nfspath}/allinone/scouter/logs" influxdb-data: driver: local driver_opts: type: "nfs" o: "addr=${NFSSERVER:-1.2.3.4},nolock,soft,rw,sync" device: ":${NFSPATH:-/nfspath}/allinone/influxdb" es-master-01-data: driver: local driver_opts: type: "nfs" o: "addr=${NFSSERVER:-1.2.3.4},nolock,soft,rw,sync" device: ":${NFSPATH:-/nfspath}/allinone/es-master-01" es-master-02-data: driver: local driver_opts: type: "nfs" o: "addr=${NFSSERVER:-1.2.3.4},nolock,soft,rw,sync" device: ":${NFSPATH:-/nfspath}/allinone/es-master-02" es-master-03-data: driver: local driver_opts: type: "nfs" o: "addr=${NFSSERVER:-1.2.3.4},nolock,soft,rw,sync" device: ":${NFSPATH:-/nfspath}/allinone/es-master-03" networks: efk: attachable: true