elasticsearch-cloud-deploy icon indicating copy to clipboard operation
elasticsearch-cloud-deploy copied to clipboard

Nginx installation is missing

Open Hellseher opened this issue 4 years ago • 1 comments

Hi,

Thank you for sharing your deployment plan.

I tried to find how to put client LB behind Security group to limit access to specific IPs and did not find on which point Nginx is installed and how it was provisioned.

Hellseher avatar Jan 13 '21 16:01 Hellseher

You'll end up needing nginx anyways if you want to have the public endpoint of Kibana served behind a different port.

  1. I added this to the file to the assets under assets/scripts/nginx/config-clients.sh
#!/bin/bash
set +e

sudo mkdir -p /var/log/nginx/

sudo rm /etc/nginx/sites-enabled/default
sudo touch /etc/nginx/sites-enabled/default

sudo bash -c 'cat <<EOF >>/etc/nginx/sites-enabled/default
server {
  listen       80;

  access_log /var/log/nginx/reverse-access.log;
  error_log /var/log/nginx/reverse-error.log;

  location / {
    proxy_pass http://$(hostname -i):5601;
  }
}
EOF'

# Make sure config file is valid
sudo nginx -t
# Start nginx
systemctl enable nginx.service
sudo systemctl restart nginx
  1. Added this file to packer install-nginx.sh
# Fix for the apt lock issue
sleep 100

echo "Installing Nginx"

sudo apt-get update
sudo -E apt-get install -y nginx
  1. Added this provisition at the end of the kibana packer file
      ...
   },
   {
      "type": "shell",
      "script": "install-nginx.sh",
      "execute_command": "echo '' | {{ .Vars }} sudo -E -S sh '{{ .Path }}'"
   }
]
  1. and finally added this to the end of the client script in assets/scripts/client.sh
/opt/cloud-deploy-scripts/nginx/config-clients.sh

Hope this helps

Bamieh avatar Jun 23 '21 10:06 Bamieh