2
0

extra-settings 1.2 KB

123456789101112131415161718192021222324252627282930
  1. #!/bin/bash
  2. # Get the IP address from the Docker container
  3. docker_ip=$(docker run --rm alpine ip route | awk 'NR==1 {print $3}')
  4. # Add a new entry to /etc/hosts
  5. echo "$docker_ip host.docker.internal" | sudo tee -a /etc/hosts
  6. echo "A new entry in the /etc/hosts file has been created"
  7. # Ask the user whether to execute the iptables command
  8. read -p "Do you want to open port 9003 for xdebug? (y/n): " choice
  9. if [ "$choice" == "y" ]; then
  10. sudo iptables -A INPUT -p tcp --dport 9003 -j ACCEPT
  11. echo "Port 9003 has been opened for xdebug."
  12. fi
  13. # Ask the user whether to increase the virtual memory map count for Elasticsearch
  14. read -p "Do you need to increase the virtual memory map count for Elasticsearch? (y/n): " vm_choice
  15. if [ "$vm_choice" == "y" ]; then
  16. # Check if the setting already exists in /etc/sysctl.conf
  17. if ! grep -q "vm.max_map_count=262144" /etc/sysctl.conf; then
  18. echo "vm.max_map_count=262144" | sudo tee -a /etc/sysctl.conf
  19. sudo sysctl -p
  20. echo "The virtual memory map count has been increased for Elasticsearch."
  21. else
  22. echo "The setting vm.max_map_count=262144 already exists in /etc/sysctl.conf."
  23. fi
  24. fi
  25. echo "Tasks completed successfully"