This repository contains Bash scripts designed to automate the deployment of high-availability configurations for servers using HAProxy, Keepalived, and Nginx, along with SSL setups. These tools work in tandem to ensure that your web services are both reliable and secure.
This script is specifically tailored for Ubuntu operating systems. It utilizes Ubuntu's package management and configuration standards to install and configure HAProxy, Keepalived, and Nginx.
To run the installation script from this repository, execute the following command in your terminal:
bash <(curl -Ls https://raw.githubusercontent.com/mhrezaei/HighAvailabilitySetup/master/install.sh)This command will download and run the installation script directly.
- HAProxy: Acts as a load balancer, distributing incoming network traffic across multiple servers to improve the availability and reliability of your application's services.
- Keepalived: Uses VRRP (Virtual Router Redundancy Protocol) to ensure high availability by preventing a single point of failure in the load balancer setup.
- Nginx: Serves as a web server and reverse proxy, handling client requests efficiently and serving content from your application.
Upon execution, the script prompts you to provide specific configuration details interactively:
-
Server Type Selection:
- Prompt: "Select the type of this server:"
- Options:
1for Load Balancer: Distributes network traffic to multiple backend servers.2for Application Server: Directly hosts web applications.
- Example:
Enter choice [1-2]: 1
-
Domain Name:
- Prompt: "Enter the domain name for the server:"
- Example:
example.com
-
Server IP Address:
- Prompt: "Enter the IP address for this server:"
- Example:
192.168.1.100
-
Ports Activation:
- Prompt: "Select ports to activate:"
- Options:
1for HTTP2for HTTPS
- Example:
Enter choice [1-2]: 2
- Prompt: "Choose the method to setup SSL certificates:"
- Options:
- Use Existing Certificate Paths: Provide paths to your existing SSL certificate and key.
- Input Certificate and Key Contents Directly: Enter the contents of your SSL certificate and key.
- Use Certbot: Obtain certificates automatically via DNS challenge with Certbot.
- Generate a Self-Signed Certificate: For testing or internal use.
- Example for Existing Paths:
Enter SSL certificate file path: /etc/ssl/certs/server.crtEnter SSL key file path: /etc/ssl/private/server.key
- Prompt: "Enter backend server IPs (comma-separated):"
- Example:
192.168.1.101,192.168.1.102
Running the script after the initial setup offers a menu with options to:
- Show Service Statuses: Checks and displays the status of HAProxy, Keepalived, and Nginx.
- Restart Services: Restarts all relevant services based on the server type selected.
- Uninstall: Removes all installations, configurations, and cleans up installed files.
Encounter any issues? Please report them in the Issues section. Include detailed information like error messages, steps to reproduce, and screenshots if possible.
Contributions to improve or extend the functionality of these scripts are welcome. Follow these steps:
- Fork the repository.
- Create a new branch for your changes.
- Commit changes and push them to your branch.
- Submit a pull request with a comprehensive description of modifications.
Visit the GitHub repository for more information and updates.