A simple project demonstrating the round robin load balancing features of the NGINX web server using chef-zero to deploy the Web and App servers involved.
To run this project from your workstation you will need the following;
- Ruby 2.0 or above installed
- Terraform 6.8 or above installed
- AWS Secret Key and Access Key provided by maintainer (DO NOT check-in AWS creds into GitHub)
- The "mega_syndicate_west.pem" placed in the keys directory
- Your workstation IP. You can use https://www.1and1.co.uk/ip-address to identify the address to use.
-
Clone this GitHub Repository to your machine
-
Navigate to the base directory and place the
mega_syndicate_west.pem
in the keys directory -
Within the same directory edit the local.tfvars
ip_for_ssh
value with your workstation's IP address e.g. "93.232.83.232" -
Again, update the local.tfvars this time with the AWS secret and access keys provided
-
Run the Rake task to perform the provision, this will deploy the Web server and two App servers with the Sample Go code deployed.
Example;
rake ENVIRONMENT=local provision
Finally, open a browser and enter the value of the web_server_address
given in the output of the provision... Or use curl on the web_server_address to test it's round robin functionality :)
The inspec tests will ensure the functionaility of the web and app servers is expected and ensures all instances are secure. Run tests locally after performing the provision/build
rake ENVIRONMENT=local test
Once done please decommission the environment by running
rake ENVIRONMENT=local destroy
You can keep up with the CI of this project here;
All steps are defined in the Jenkinsfile
- Establish an AMI build for patch updates to image (via Packer)
- Neglect chef-zero and use chef server
e.g.
-
Fork the repository on Github
-
Create a named feature branch (like
add_component_x
) -
Write your change
-
Write tests for your change (if applicable)
-
Run the tests, ensuring they all pass
-
Submit a Pull Request using Github
Authors: James Nduka