├── .gitignore ├── Installation.md ├── LICENSE ├── README.md ├── _config.yml ├── ansible ├── info │ ├── aws-credentials.yml │ └── specs.yml ├── provision.yml └── vpc-provision.yml ├── demo ├── demo-info.sh └── demo.sh ├── deploy └── ec2-configure.yml └── docker ├── app ├── app-deploy.yml └── app1 │ └── docker-compose.app.yml └── elk ├── elk-deploy.yml └── elk1 └── docker-compose.yml /.gitignore: -------------------------------------------------------------------------------- 1 | ansible/*.retry 2 | -------------------------------------------------------------------------------- /Installation.md: -------------------------------------------------------------------------------- 1 | # Installation 2 | 3 | ## Docker-Compose 4 | 5 | 1. sudo curl -L https://github.com/docker/compose/releases/download/1.18.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose 6 | 7 | 2. sudo chmod +x /usr/local/bin/docker-compose 8 | 9 | [Ref](https://docs.docker.com/compose/install/) 10 | 11 | ## Docker 12 | 13 | 1. sudo apt-get remove docker docker-engine docker.io 14 | 15 | 2. sudo apt-get update 16 | 17 | 3. sudo apt-get install \ 18 | apt-transport-https \ 19 | ca-certificates \ 20 | curl \ 21 | software-properties-common 22 | 23 | 4. curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - 24 | 25 | 5. sudo add-apt-repository \ 26 | "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ 27 | $(lsb_release -cs) \ 28 | stable" 29 | 30 | 6. sudo apt-get update 31 | 32 | 7. sudo apt-get install docker-ce 33 | 34 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Ramit Surana 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Ansible-ec2-docker-deployment 2 | Using Ansible to setup Wordpress, MariaDB & ELK Stack to an AWS EC2 instance with Docker Compose 3 | 4 | ## Prerequisites 5 | 6 | * Pythonv2.7 7 | * Ansible 8 | * Python Boto 9 | * Git 10 | 11 | ( For Manual Installation - https://github.com/ramitsurana/ansible-ec2-docker-deployment/blob/master/Installation.md) 12 | 13 | ## Design 14 | 15 | ![arch](https://user-images.githubusercontent.com/8342133/27880020-2d11dfce-61e1-11e7-800e-9af806aa4903.png) 16 | 17 | The design of the model is to deploy the ELK stack,Wordpress and Redis on top of the docker in an EC2 instance.This is done using docker compose and dockerfiles.The provisioning of the system is done using ansible.The base os is Ubuntu 14.04.For successful results,please avoid Ubuntu 16.04 as it does not contain pre-installed python. For the same, you can use: 18 | 19 | ```` 20 | $ sudo apt-get install python-minimal -y 21 | ```` 22 | 23 | [Ref](https://github.com/ansible/ansible/issues/19584) 24 | 25 | The file structure is as follows: 26 | 27 | * Docker 28 | - app 29 | - app1 30 | - docker-compose.app.yml 31 | - app-deploy.yml 32 | - elk 33 | - elk1 34 | - docker-compose.yml 35 | - elk-deploy.yml 36 | 37 | * Deploy 38 | - ec2-configure.yml 39 | 40 | * Ansible 41 | - Info 42 | - aws-credentials.yml 43 | - specs.yml 44 | - provision.yml 45 | - vpc-provision.yml 46 | - hosts 47 | 48 | ## Steps: 49 | 50 | ``` 51 | $ git clone https://github.com/ramitsurana/ansible-ec2-docker-deployment/ 52 | $ cd ansible-ec2-docker-deployment/ 53 | ``` 54 | 55 | ### Configuring Hosts 56 | 57 | Please create and add the following lines at **/etc/ansible/hosts** file : 58 | 59 | ```` 60 | [local] 61 | 127.0.0.1 62 | 63 | [ec2] 64 | ansible_user=ubuntu 65 | ```` 66 | 67 | You can choose the EC2 IP by choosing an elastic Ip for your instance.This is good way to fix an IP as it may change after a reboot of EC2 instance. This setting can be observed at EC2 Dashboard > Elastic IP. 68 | 69 | Similarly you should also create another file at /etc/ansible/ansible.cfg.This is the main configuration file for ansible to run.You can uncomment add some sections in it as represented below: 70 | 71 | ```` 72 | [defaults] 73 | 74 | # some basic default values... 75 | 76 | inventory = /etc/ansible/hosts 77 | library = /usr/share/my_modules/ 78 | remote_tmp = $HOME/.ansible/tmp 79 | local_tmp = $HOME/.ansible/tmp 80 | forks = 5 81 | poll_interval = 15 82 | sudo_user = root 83 | #ask_sudo_pass = True 84 | #ask_pass = True 85 | #transport = smart 86 | remote_port = 22 87 | #module_lang = C 88 | #module_set_locale = True 89 | 90 | ```` 91 | ### Creating VPC 92 | 93 | This can be done using the vpc-provision.yml file present in the ansible dir.It requires you to put your aws credentials [here](https://github.com/ramitsurana/ansible-ec2-docker-deployment/blob/master/ansible/info/aws-credentials.yml).The [specs.yml](https://github.com/ramitsurana/ansible-ec2-docker-deployment/blob/master/ansible/info/specs.yml) file is already configured. The command to run the ansible playbook is as follows: 94 | 95 | ```` 96 | $ sudo ansible-playbook vpc-provision.yml -i hosts -vv 97 | ```` 98 | 99 | ### Creating EC2 100 | 101 | This can be done using the provision.yml file present in the ansible dir.It requires you to put your aws credentials [here](https://github.com/ramitsurana/ansible-ec2-docker-deployment/blob/master/ansible/info/aws-credentials.yml).The [specs.yml](https://github.com/ramitsurana/ansible-ec2-docker-deployment/blob/master/ansible/info/specs.yml) file stated the region,ami and instance type.The command to run the ansible playbook is as follows: 102 | 103 | ```` 104 | $ sudo ansible-playbook provision.yml -i hosts -vv 105 | ```` 106 | 107 | Remember to associate your Elastic IP with the EC2 instance.This can be observed under Elastic IP > Associate. 108 | 109 | ### Configuring EC2 110 | 111 | We can start configuring our EC2 instance by running some basic commands such as: 112 | 113 | ```` 114 | //Installing Docker 115 | $ sudo apt-get clean && update -y 116 | $ apt-get install apt-transport-https ca-certificates curl software-properties-common -y 117 | $ apt-get install curl -y 118 | $ sudo apt-get install docker.io -y 119 | $ sudo usermod -aG docker ${USER} 120 | $ sudo service docker restart 121 | 122 | //Installing docker compose 123 | $ sudo sudo apt-get install python-pip python-dev build-essential -y 124 | $ sudo pip install docker-compose==1.3.0 125 | ```` 126 | 127 | This can be done using the ec2-configure.yml file present in the repo.The command would be: 128 | 129 | ```` 130 | $ sudo ansible-playbook ec2-configure.yml -vv --private-key 131 | ```` 132 | 133 | ### Deploying ELK Stack using Docker Compose 134 | 135 | It can be done using the ansible playbook. 136 | 137 | ```` 138 | $ sudo ansible-playbook elk-deploy.yml -vv --private-key 139 | ```` 140 | 141 | The playbook consists of the below commands: 142 | 143 | ```` 144 | $ cp elk1/docker-compose.yml ~/home/ubuntu/ 145 | $ sudo docker-compose -f ~/home/ubuntu/docker-compose.yml up -d 146 | $ sudo rm -f ~/home/ubuntu/docker-compose.yml 147 | 148 | ```` 149 | 150 | ### Deploying Wordpress and Mariadb Containers using Docker Compose 151 | 152 | It can be done using the ansible playbook. 153 | 154 | 155 | ```` 156 | $ sudo ansible-playbook app-deploy.yml -vv --private-key 157 | ```` 158 | 159 | The playbook consists of the following below commands: 160 | 161 | ```` 162 | $ cp app1/docker-compose.yml ~/home/ubuntu/ 163 | $ sudo docker-compose -f ~/home/ubuntu/docker-compose.app.yml up -d 164 | $ sudo rm -f ~/home/ubuntu/docker-compose.app.yml 165 | ```` 166 | 167 | ### Output 168 | 169 | **Add tag Owner : in EC2 instance.** 170 | 171 | The output can be observed using the ip address of the ec2 instance.The Public DNS would be like ec2-xxx-xxx-xxx.compute.amazonaws.com. 172 | 173 | Service | Port | 174 | |:--------|------:| 175 | |Wordpress | 8080| 176 | |Kibana | 5601| 177 | 178 | **Please check the inbound and outbound rules in case of any page loading and reloading errors.You can check it out at EC2 Dashboard > Security Groups.** 179 | 180 | Sample video output can be found out [here](https://youtu.be/BHcSNVzWRlo) : 181 | 182 | IMAGE ALT TEXT HERE 183 | 184 | ## License 185 | 186 | MIT License 187 | 188 | -------------------------------------------------------------------------------- /_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-cayman -------------------------------------------------------------------------------- /ansible/info/aws-credentials.yml: -------------------------------------------------------------------------------- 1 | AWS_ACCESS_KEY_ID: 2 | AWS_SECRET_ACCESS_KEY: 3 | -------------------------------------------------------------------------------- /ansible/info/specs.yml: -------------------------------------------------------------------------------- 1 | aws_region: us-east-1 2 | 3 | # Ubuntu 14.04 64-bit 4 | ami_id: ami-06b5810be11add0e2 5 | 6 | # Instance type 7 | instance_type: t2.micro 8 | 9 | # Key pair name 10 | key_name: ramit-rean 11 | 12 | # Tags 13 | tags_used: aws-docker-ansible 14 | 15 | # CIDR Range 16 | cidr_range: */32 17 | 18 | # VPC Information 19 | vpc_name: aws-ansible-docker 20 | vpc_cidr_block: 10.0.0.0/16 21 | 22 | # For Security Group Rule 23 | my_ip_range: */32 24 | 25 | # Subnets 26 | public_subnet_1_cidr: 10.0.0.0/20 27 | 28 | # VPC Id 29 | vpc_id: vpc-* 30 | vpc_subnet_id: subnet-* 31 | -------------------------------------------------------------------------------- /ansible/provision.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - name: AWS-Docker-Ansible Setup 4 | hosts: local 5 | connection: local 6 | gather_facts: False 7 | 8 | 9 | vars_files: 10 | - info/aws-credentials.yml 11 | - info/specs.yml 12 | 13 | tasks: 14 | - name: Create security group 15 | ec2_group: 16 | name: AWS-Docker-Ansible-group 17 | description: "A Security group" 18 | region: "{{aws_region}}" 19 | vpc_id: "{{ vpc_id }}" 20 | aws_access_key: "{{ AWS_ACCESS_KEY_ID }}" 21 | aws_secret_key: "{{ AWS_SECRET_ACCESS_KEY }}" 22 | rules: 23 | - proto: tcp 24 | from_port: 22 25 | to_port: 22 26 | cidr_ip: "{{ cidr_range }}" 27 | - proto: tcp 28 | from_port: 5601 29 | to_port: 5601 30 | cidr_ip: "{{ cidr_range }}" 31 | - proto: tcp 32 | from_port: 9200 33 | to_port: 9200 34 | cidr_ip: "{{ cidr_range }}" 35 | - proto: tcp 36 | from_port: 8080 37 | to_port: 8080 38 | cidr_ip: "{{ cidr_range }}" 39 | rules_egress: 40 | - proto: all 41 | from_port: 0 42 | to_port: 65535 43 | cidr_ip: 0.0.0.0/0 44 | register: firewall 45 | 46 | 47 | - name: Create EC-2 instance 48 | ec2: 49 | aws_access_key: "{{ AWS_ACCESS_KEY_ID }}" 50 | aws_secret_key: "{{ AWS_SECRET_ACCESS_KEY }}" 51 | vpc_subnet_id: "{{ vpc_subnet_id }}" 52 | region: "{{ aws_region }}" 53 | group_id: "{{ firewall.group_id }}" 54 | instance_type: "{{ instance_type }}" 55 | image: "{{ ami_id }}" 56 | key_name: "{{ key_name }}" 57 | instance_tags: 58 | Name: "{{ tags_used }}" 59 | exact_count: 1 60 | count_tag: 61 | Name: "{{ tags_used }}" 62 | wait: true 63 | assign_public_ip: yes 64 | register: ec2 65 | -------------------------------------------------------------------------------- /ansible/vpc-provision.yml: -------------------------------------------------------------------------------- 1 | --- 2 | ### provision AWS VPC 3 | - hosts: localhost 4 | connection: local 5 | gather_facts: false 6 | user: root 7 | 8 | vars_files: 9 | - info/aws-credentials.yml 10 | - info/specs.yml 11 | 12 | tasks: 13 | - name: Create VPC 14 | ec2_vpc_net: 15 | name: "{{ vpc_name }}" 16 | cidr_block: "{{ vpc_cidr_block }}" 17 | region: "{{ aws_region }}" 18 | state: "present" 19 | ec2_access_key: "{{ AWS_ACCESS_KEY_ID }}" 20 | ec2_secret_key: "{{ AWS_SECRET_ACCESS_KEY }}" 21 | register: my_vpc 22 | 23 | 24 | - name: sleep for 30 seconds and continue with play 25 | wait_for: timeout=30 26 | delegate_to: localhost 27 | 28 | - name: Set VPC ID in variable 29 | set_fact: 30 | vpc_id: "{{ my_vpc.vpc.id }}" 31 | ec2_access_key: "{{ AWS_ACCESS_KEY_ID }}" 32 | ec2_secret_key: "{{ AWS_SECRET_ACCESS_KEY }}" 33 | 34 | - name: Create Public Subnet 35 | ec2_vpc_subnet: 36 | state: "present" 37 | vpc_id: "{{ vpc_id }}" 38 | cidr: "{{ public_subnet_1_cidr }}" 39 | az: "{{ aws_region }}a" 40 | region: "{{ aws_region }}" 41 | resource_tags: 42 | Name: "Public Subnet" 43 | ec2_access_key: "{{ AWS_ACCESS_KEY_ID }}" 44 | ec2_secret_key: "{{ AWS_SECRET_ACCESS_KEY }}" 45 | register: my_public_subnet 46 | 47 | - name: Set Public Subnet ID in variable 48 | set_fact: 49 | public_subnet_id: "{{ my_public_subnet.subnet.id }}" 50 | ec2_access_key: "{{ AWS_ACCESS_KEY_ID }}" 51 | ec2_secret_key: "{{ AWS_SECRET_ACCESS_KEY }}" 52 | 53 | 54 | - name: Create Internet Gateway for VPC 55 | ec2_vpc_igw: 56 | vpc_id: "{{ vpc_id }}" 57 | region: "{{ aws_region }}" 58 | state: "present" 59 | ec2_access_key: "{{ AWS_ACCESS_KEY_ID }}" 60 | ec2_secret_key: "{{ AWS_SECRET_ACCESS_KEY }}" 61 | register: my_vpc_igw 62 | 63 | 64 | - name: Set Internet Gateway ID in variable 65 | set_fact: 66 | igw_id: "{{ my_vpc_igw.gateway_id }}" 67 | ec2_access_key: "{{ AWS_ACCESS_KEY_ID }}" 68 | ec2_secret_key: "{{ AWS_SECRET_ACCESS_KEY }}" 69 | 70 | - name: Set up public subnet route table 71 | ec2_vpc_route_table: 72 | vpc_id: "{{ vpc_id }}" 73 | region: "{{ aws_region }}" 74 | tags: 75 | Name: "Public" 76 | subnets: 77 | - "{{ public_subnet_id }}" 78 | routes: 79 | - dest: "0.0.0.0/0" 80 | gateway_id: "{{ igw_id }}" 81 | ec2_access_key: "{{ AWS_ACCESS_KEY_ID }}" 82 | ec2_secret_key: "{{ AWS_SECRET_ACCESS_KEY }}" 83 | 84 | - name: Create Main Security Group 85 | ec2_group: 86 | name: "My Security Group" 87 | description: "My Security Group" 88 | vpc_id: "{{ vpc_id }}" 89 | region: "{{ aws_region }}" 90 | rules: 91 | - proto: "tcp" 92 | from_port: "22" 93 | to_port: "22" 94 | cidr_ip: "{{ my_ip_range }}" 95 | ec2_access_key: "{{ AWS_ACCESS_KEY_ID }}" 96 | ec2_secret_key: "{{ AWS_SECRET_ACCESS_KEY }}" 97 | register: my_vpc_sg 98 | 99 | - name: Set Security Group ID in variable 100 | set_fact: 101 | sg_id: "{{ my_vpc_sg.group_id }}" 102 | ec2_access_key: "{{ AWS_ACCESS_KEY_ID }}" 103 | ec2_secret_key: "{{ AWS_SECRET_ACCESS_KEY }}" 104 | -------------------------------------------------------------------------------- /demo/demo-info.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "Your Current IP is ==> " $(curl http://checkip.amazonaws.com/plain) 4 | -------------------------------------------------------------------------------- /demo/demo.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | FOLDER_PATH='$HOME/projects/personal/ansible-ec2-docker-deployment/' 4 | EC2_PEM_FILE='$HOME/Downloads/ramit-rean.pem' 5 | 6 | VPC_PROVISION_FILE='vpc-provision.yml' 7 | EC2_FILE='provision.yml' 8 | EC2_CONFIG_FILE='ec2-configure.yml' 9 | ELK_CONFIG_FILE='elk-deploy.yml' 10 | APP_CONFIG_FILE='app-deploy.yml' 11 | 12 | AWS_REGION='us-east-1' 13 | TAG_NAME='aws-docker-ansible' 14 | 15 | function DeployPlaybook { 16 | sudo ansible-playbook $1 -i hosts -vv 17 | } 18 | 19 | function ConfigurePlaybook { 20 | sudo ansible-playbook $1 -vv --private-key $2 21 | } 22 | 23 | function ListID { 24 | aws ec2 $1 --filter Name=tag:Name,Values=$TAG_NAME --region=$AWS_REGION 25 | } 26 | 27 | ## Create an VPC 28 | cd $FOLDER_PATH/ansible/ 29 | DeployPlaybook $VPC_PROVISION_FILE 30 | 31 | ## List ID and Replace info 32 | ListID describe-vpcs 33 | 34 | ## Create an EC2 35 | cd $FOLDER_PATH/ansible/ 36 | DeployPlaybook $EC2_FILE 37 | 38 | ## Configuring EC2 Server 39 | cd $FOLDER_PATH/deploy/ 40 | ConfigurePlaybook $EC2_CONFIG_FILE $EC2_PEM_FILE 41 | 42 | ## Configuring ELK 43 | cd $FOLDER_PATH/docker/elk/ 44 | ConfigurePlaybook $ELK_CONFIG_FILE $EC2_PEM_FILE 45 | 46 | ## Configuring Wordpress 47 | cd $FOLDER_PATH/docker/app/ 48 | ConfigurePlaybook $APP_CONFIG_FILE $EC2_PEM_FILE 49 | 50 | -------------------------------------------------------------------------------- /deploy/ec2-configure.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - name: Configure EC2 instance 4 | hosts: ec2 5 | connection: ssh 6 | sudo: true 7 | 8 | 9 | tasks: 10 | - name: Update the machine 11 | command: sudo apt-get clean && update -y 12 | 13 | - name: Installing essentials 14 | command: apt-get install apt-transport-https ca-certificates curl software-properties-common -y 15 | 16 | - name: Installing Curl 17 | command: apt-get install curl -y 18 | 19 | - name: Installing docker 20 | command: apt install docker.io -y 21 | 22 | - name: Adding user to group 23 | command: sudo usermod -aG docker ${USER} 24 | 25 | - name: Restarting docker service 26 | command: sudo service docker restart 27 | 28 | - name: Updating the machine 2 29 | command: sudo apt-get update 30 | 31 | - name: Installing Python Pip 32 | command: sudo apt-get install python-pip python-dev build-essential -y 33 | 34 | - name: Installing Docker compose 35 | command: sudo pip install docker-compose==1.3.0 36 | 37 | - name: apt update 38 | apt: update_cache=yes cache_valid_time=3600 39 | register: apt_result 40 | until: apt_result|success 41 | retries: 3 42 | delay: 1 43 | sudo: yes 44 | ignore_errors: yes 45 | 46 | - name: retry if needed using command apt-get update 47 | command: apt-get update 48 | sudo: yes 49 | when: apt_result|failed 50 | 51 | -------------------------------------------------------------------------------- /docker/app/app-deploy.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - name: Deploying app 4 | hosts: ec2 5 | connection: ssh 6 | 7 | tasks: 8 | - name: Copying docker-compose file 9 | copy: src=app1/docker-compose.app.yml dest=~/home/ubuntu/ 10 | 11 | - name: Running docker-compose.yml 12 | command: sudo docker-compose -f ~/home/ubuntu/docker-compose.app.yml up -d 13 | 14 | - name: Removing docker compose file 15 | command: sudo rm -f ~/home/ubuntu/docker-compose.app.yml 16 | -------------------------------------------------------------------------------- /docker/app/app1/docker-compose.app.yml: -------------------------------------------------------------------------------- 1 | mariadb: 2 | image: mariadb 3 | environment: 4 | MYSQL_ROOT_PASSWORD: ramit 5 | wordpress: 6 | image: wordpress 7 | links: 8 | - mariadb:mariadb 9 | ports: 10 | - 8080:80 11 | -------------------------------------------------------------------------------- /docker/elk/elk-deploy.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - name: Deploying ELK Stack 4 | hosts: ec2 5 | connection: ssh 6 | 7 | tasks: 8 | - name: Copying docker-compose file 9 | copy: src=elk1/docker-compose.yml dest=~/home/ubuntu/ 10 | 11 | - name: Running docker-compose.yml 12 | command: sudo docker-compose -f ~/home/ubuntu/docker-compose.yml up -d 13 | 14 | - name: Removing docker compose file 15 | command: sudo rm -f ~/home/ubuntu/docker-compose.yml 16 | -------------------------------------------------------------------------------- /docker/elk/elk1/docker-compose.yml: -------------------------------------------------------------------------------- 1 | elasticsearch: 2 | image: bashell/alpine-elasticsearch 3 | ports: 4 | - 9200:9200 5 | logstash: 6 | image: logstash:latest 7 | links: 8 | - elasticsearch:elasticsearch 9 | ports: 10 | - 12201:12201 11 | kibana: 12 | image: kibana 13 | links: 14 | - elasticsearch:elasticsearch 15 | ports: 16 | - 5601:5601 17 | environment: 18 | - ELASTICSEARCH_URL=http://elasticsearch:9200 19 | 20 | --------------------------------------------------------------------------------