Skip to content

Load balance (NGNIX) and APACHE web server over VirtualBox provisioned with Vagrant.

Notifications You must be signed in to change notification settings

macedojleo/loadbalancer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Prerequisites

Vagrant

Vagrant is a tool for building and managing virtual machine environments in a single workflow. Following the instructions here in order to install it.

VirtualBox Provider

Download and install Virtual Box as virtualization provider.

Topology

image

Hostname Role
CONTROL Configuration management
LB01 Load Balancer
DB01 Database
APP01 Webserver
APP02 Webserver

Creating VM's

  1. Clone this project
  2. Access the project directory
  3. Using the system CLI, run the following Vagrant commands in order to create and provisioning the Virtual Machines.

3.1. Provisioning VM's:

$ vagrant up --provisioning

3.2. Access the control VM (Machine where Ansible has installed previously):

$ vagrant ssh control

3.3. Since you've got access to control VM, validate if Ansible has been installed successfully.

vagrant@control:~$ ansible --version

3.4. Now, from the control VM you can have access to another machines by using ssh command.

vagrant@control:~$ ssh lb01

vagrant@control:~$ ssh db01

vagrant@control:~$ ssh app01

vagrant@control:~$ ssh app02

Setting up Virtual Machines

Run all following commands in control Machine.

  1. Pre-install (ALL MACHINES)

vagrant@control:~$ ansible-playbook -i /etc/ansible/inventories/hosts /etc/ansible/playbooks/pre-install.yml

  1. Setting up Load Balance (LB01)

vagrant@control:~$ ansible-playbook -i /etc/ansible/inventories/hosts /etc/ansible/playbooks/nginx.yml

  1. Setting up web servers (APP01, APP02)

vagrant@control:~$ ansible-playbook -i /etc/ansible/inventories/hosts /etc/ansible/playbooks/apache2.yml

  1. Setting up Database (DB01)

vagrant@control:~$ ansible-playbook -i /etc/ansible/inventories/hosts /etc/ansible/playbooks/mysql.yml

Deploying simple static web page

Run the following command in control machine.

vagrant@control:~$ ansible-playbook -i /etc/ansible/inventories/hosts /etc/ansible/playbooks/app.yml

Testing HTTP load balancing

From web browser access: http://192.168.135.101/page.html

image

Reload the page and check if the HTTP traffic was redirected to another web server by NGINX.

image

About

Load balance (NGNIX) and APACHE web server over VirtualBox provisioned with Vagrant.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages